Bug 1415802

Summary: [RFE] Add --define option working the same as in rpmbuild
Product: [Community] Copr Reporter: Michal Bocek <mbocek>
Component: cliAssignee: Miroslav Suchý <msuchy>
Status: CLOSED WONTFIX QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: praiskup
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-24 13:17:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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