[git-buildpackage] Bug#752503: [PATCH] Implement gbp-buildpackage-rpm

Tzafrir Cohen tzafrir at cohens.org.il
Thu Aug 20 13:21:08 CEST 2015


On Wed, Aug 19, 2015 at 07:10:35PM +0200, Guido Günther wrote:
> Hi Markus,
> On Fri, Feb 06, 2015 at 02:18:11PM +0200, Markus Lehtonen wrote:
> > Hi,
> > 
> > The attached patch series implements initial version of the
> > gbp-buildpackage-rpm tool.
> > 
> > The patches modifying gbp.command_wrappers:Command (patches 0011 and
> > 0012) are not strictly required but they make the output from nosetests
> > much cleaner.
> > 
> > These patches, plus some additional features extending gbp-buildpackage
> > and gbp-buildpackage-rpm, can also be found on the
> > feature/buildpackage-rpm branch in my Github repository:
> > https://github.com/marquiz/git-buildpackage-rpm
> 
> Thanks a lot! I had commented on these a while ago and since you seem to
> be busy elsewhere I pulled everything that looked good and then dumped
> the actual script verbatim into the tree removing options not yet
> supported. All this is on master now.
> 
> I need to fix up the component tests at one point but I think it's
> better to give this some exosure within Debian now - very well knowing
> that things mostly stalled due to inacivity on my end.
> 
> We now have a pretty good baseline with only import-orig-rpm missing
> completely atm.

Big thanks to both of you!

For the record, this is what happens when I try to build GBP itself as
an RPM package on a Debian Stretch system (GBP built from git with GBP
on the same system):


$ gbp buildpackage-rpm 
Traceback (most recent call last):
  File "/usr/bin/gbp", line 9, in <module>
    load_entry_point('gbp==0.6.33', 'console_scripts', 'gbp')()
  File "/usr/lib/python2.7/dist-packages/gbp/scripts/supercommand.py",
line 136, in supercommand
    return module.main(args)
  File
"/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage_rpm.py", line
507, in main
    spec = rpm.SpecFile(os.path.join(dump_dir, spec.specfile))
  File "/usr/lib/python2.7/dist-packages/gbp/rpm/__init__.py", line 138,
in __init__
    raise NoSpecError("Unable to read spec file: %s" % err)
gbp.rpm.NoSpecError: Unable to read spec file: [Errno 2] No such file or
directory:
'/var/tmp/gbp/buildpackage-rpm_HMyA9V/packaging_YoGUAN/git-buildpackage.spec'


So, let's point to the spec file explicitly. Do we want to move the
file? Fix buildpackage-rpm? Leave things as they are?


$ gbp buildpackage-rpm --git-spec-file=packaging/git-buildpackage.spec
gbp:info: Creating (native) source archive
git-buildpackage_0.6.34.tar.gz from 'HEAD'
error: Failed build dependencies:
        docbook-utils is needed by git-buildpackage-0.6.34-0.noarch
        epydoc is needed by git-buildpackage-0.6.34-0.noarch
        gtk-doc is needed by git-buildpackage-0.6.34-0.noarch
        python is needed by git-buildpackage-0.6.34-0.noarch
        python-setuptools is needed by git-buildpackage-0.6.34-0.noarch
gbp:error: 'rpmbuild -ba --define "_topdir /home/tzafrir/Proj/Packs/git-buildpackage/rpmbuild" --define "_specdir %_topdir/SPECS" --define "_sourcedir %_topdir/SOURCES" %/home/tzafrir/Proj/Packs/git-buildpackage/rpmbuild/SPECS/git-buildpackage.spec'
%failed: it exited with 1


I am not aware of any way to tell rpm on a Debian system to pretend it
has those dependencies satisfied. Obviously the proper way to build
packages is in mock or whatever other chroot environment. But sometimes
(at least for some packages) you just want to build and you know it will
work (at least for throw-away temporary builds). So the obvious attempt
would be:

$ gbp buildpackage-rpm --git-builder='rpmbuild --nodeps'
--git-spec-file=packaging/git-buildpackage.spec 
gbp:info: Creating (native) source archive
git-buildpackage_0.6.34.tar.gz from 'HEAD'
error: File /home/tzafrir/rpmbuild/SOURCES/git-buildpackage_0.6.34.tar.gz: No such file or directory
gbp:error: 'rpmbuild --nodeps /home/tzafrir/Proj/Packs/git-buildpackage/rpmbuild/SPECS/git-buildpackage.spec' failed: it exited with 1


The error here may not be obvious at first glance. But it becomes clear
when you notice that all the --define-s from the above are missing.
buildpackage-rpm adds them if the builder is exactly "rpmbuild" (if not,
you may have you own tricks, and it should not mess with your
environment).


So the proper fix: use --git-mock (when it is merged).

-- 
Tzafrir Cohen         | tzafrir at jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir at cohens.org.il |                    |  best
tzafrir at debian.org    |                    | friend


More information about the git-buildpackage mailing list