Bug 1415802 - [RFE] Add --define option working the same as in rpmbuild
Summary: [RFE] Add --define option working the same as in rpmbuild
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Copr
Classification: Community
Component: cli
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-23 18:54 UTC by Michal Bocek
Modified: 2017-06-29 08:51 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-24 13:17:57 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1462788 0 unspecified NEW RFE: include scm revision information in package name? 2021-02-22 00:41:40 UTC

Internal Links: 1462788

Description Michal Bocek 2017-01-23 18:54:57 UTC
Description of problem:
Currently when I run copr from command line, it builds the package with fixed spec file macros. I would appreciate an copr-cli option which would be able to change any macro used in spec file.

The specific use case: using this option I'd like to change the name of the package version, for example adding timestamp to it.

Version-Release number of selected component (if applicable):
copr-cli-1.58-1

Comment 1 Miroslav Suchý 2017-01-24 13:17:57 UTC
I disagree. Build system should be transparent and reproducible as much as possible. So if someone else send the same RPM again to Copr he should get the same option.

If you want to add timestamp to release or version, then it should be task of tool, which create SRPM for you.

E.g. Tito does that.

Comment 2 Pavel Raiskup 2017-01-24 14:44:25 UTC
Well, at least it looks there were some good reasons to have support for
--define in mock (and copr still just a thin wrapper around mock).

I can imagine that having --define in copr-cli would simplify the task a
lot for trivial _static_ spec files (for new tarballs generated by e.g.
git archive).  In such cases incorporating tito is just a plain overhead.

Also, I'd like to build multiple SCLs in one copr project (for example
autotools-git, autotools-latest, etc.), but that means I have to define
%scl macro explicitly in each package which is pain (multiple spec files
for the same packages built against different SCLs).

So I would still vote for '--define' support, but as a work-around for
plain CI purposes (Michal Bocek's case):

  1. let's have a package 'relese-override' installing ..
  2. .. /etc/rpm/macros.release-override ..
  3. .. having '%ci_release %(date +"%%Y%%m%%d_%%H%%M%%S")' inside
  4. Then add 'release-override' into minimal buildroot.

Then you can have something like this in your spec file:

  Release: %{?ci_release:%ci_release.}1%{?dist}

Comment 3 Pavel Raiskup 2017-06-29 08:51:18 UTC
Another upstream discussion:
https://pagure.io/copr/copr/issue/98


Note You need to log in before you can comment on or make changes to this bug.