#11 fedpkg should allow adding options to rpmbuild command line
Closed Opened by martinlanghoff.

Copy/paste below from https://fedorahosted.org/fedora-packager/ticket/102 , I hunted down the gitweb link with a proposed patch which is now at https://fedorapeople.org/cgit/ndim/public_git/fedora-packager.git/log/?h=rpmbuild-option-passthrough

There should be a way to give fedpkg a few options to pass on to the rpmbuild command line fedpkg ends up calling.

This should come in quite useful when there is a need to debug something with e.g. --without doc or --define "foo check".

As many of fedpkg's subcommands internally call rpmbuild (e.g. local, install, verify-files, prep, and even mockbuild), it would make sense to make this either a global option or an equally global environment variable:

$ env RPMBUILD_OPTS="--without doc --define 'foo check'" fedpkg -v local
$ fedpkg --rpmbuild --without --rpmbuild doc --rpmbuild --define --rpmbuild "foo check" -v local
$ fedpkg --rpmbuild "--without doc" --rpmbuild "--define 'foo check'" -v local

Mock has an interface like follows which avoids the quoting issues obvious in the above examples:

$ mock --without doc --define 'foo bar' --rebuild NVR.srpm

Any better ideas for a user interface are welcome.

In any case, I want to do something less error prone than editing pyfedpkg/__init__.py every time I need a special rpmbuild option for debugging package builds.


Again copy/paste - comment by ndim

Implementation of the mock like options --define, --with, --without for fedpkg:

[ new url : https://fedorapeople.org/cgit/ndim/public_git/fedora-packager.git/log/?h=rpmbuild-option-passthrough ]

Citing the new fedpkg --help output:

 optional arguments:
  -h, --help            show this help message and exit
  --dist DIST           Override the distribution, eg f15 or el6
  -u USER, --user USER  Override the username found in the fedora cert
  -D 'MACRO EXPR', --define 'MACRO EXPR'
                    define an rpm macro for rpmbuild
  --with RPMWITH        enable configure option for rpmbuild
  --without RPMWITHOUT  disable configure option for rpmbuild
  --path PATH           Directory to interact with instead of current dir
  -v                    Run with verbose debug output
  -q                    Run quietly only displaying errors

Perhaps the global options should be reordered a bit, but at least this work.

The codebase has shifted enough that the branch is unmergeable, but it's a reasonable proof-of-concept.

Looking at current codebase, I'd say frobbing rpmdefines might be the trick, though I do not understand the split with rpkg :-(

Metadata Update from @cqi:
- Issue set to the milestone: 1.30

Metadata Update from @cqi:
- Issue set to the milestone: NEXT (was: 1.30)

There are issues reported for passing options to underlying rpmbuild. So far, we would like to see concrete use case for such features. It would be good to file issue for concrete fedpkg commands that use rpmbuild with use cases examples. I'm going to close this issue. Thanks.

Metadata Update from @cqi:
- Issue set to the milestone: None (was: NEXT)
- Issue status updated to: Closed (was: Open)

Metadata