DevHeads.net

The Fedora build system and the use of %{_unitdir} in specfiles

Hi,

I'm trying to build the latest cachefilesd package in the Fedora build system
for Rawhide/F17, but the build failed because I used %{_unitdir} in my specfile
and this doesn't appear to be expanded in the Fedora build system (see the
attached build.log). For reference, the build log can be found at:

<a href="http://koji.fedoraproject.org/koji/taskinfo?taskID=3552622" title="http://koji.fedoraproject.org/koji/taskinfo?taskID=3552622">http://koji.fedoraproject.org/koji/taskinfo?taskID=3552622</a>

I was attempting to use this to determine the location of the systemd service
definitions. It works fine on my F16 desktop.

Can this be fixed in the build system, please? This is a feature noted in the
systemd usage docs:

<a href="https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd" title="https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd">https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd</a>

David
ENTER do(['bash', '--login', '-c', 'rpmbuild -bb --target i686 --nodeps builddir/build/SPECS/cachefilesd.spec'], False, '/var/lib/mock/f17-build-1191033-189987/root/', None, 86400, True, 0, 497, 497, None, logger=<mock.trace_decorator.getLog object at 0x2580b90>)
Executing command: ['bash', '--login', '-c', 'rpmbuild -bb --target i686 --nodeps builddir/build/SPECS/cachefilesd.spec']
Building target platforms: i686
Building for target i686
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.JH2fNa
+ umask 022
+ cd /builddir/build/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /builddir/build/BUILD
+ rm -rf cachefilesd-0.10.3
+ /bin/tar -xf /builddir/build/SOURCES/cachefilesd-0.10.3.tar.bz2
+ cd cachefilesd-0.10.3
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.4b9tiH
+ umask 022
+ cd /builddir/build/BUILD
+ cd cachefilesd-0.10.3
+ LANG=C
+ export LANG
+ unset DISPLAY
+ PIE=-fpie
+ export PIE
++ echo -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fpie
+ CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fpie'
+ make all
cc -g -O2 -Wall -m32 -o cachefilesd cachefilesd.c
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.x0BhUe
+ umask 022
+ cd /builddir/build/BUILD
+ '[' /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386 '!=' / ']'
+ rm -rf /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386
++ dirname /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386
+ mkdir -p /builddir/build/BUILDROOT
+ mkdir /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386
+ cd cachefilesd-0.10.3
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386
+ mkdir -p /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/sbin
+ mkdir -p '/builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386%{_unitdir}'
+ mkdir -p /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/man/man5 /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/man/man8
+ mkdir -p /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ mkdir -p /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-selinux-0.10.3
+ mkdir -p /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/var/cache/fscache
+ make DESTDIR=/builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386 install
install -D cachefilesd /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/sbin/cachefilesd
install -D -m 0644 cachefilesd.conf /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/etc/cachefilesd.conf
install -D -m 0644 cachefilesd.conf.5 /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/man/man5/cachefilesd.conf.5
install -D -m 0644 cachefilesd.8 /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/man/man8/cachefilesd.8
+ install -m 644 cachefilesd.conf /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/etc
+ install -m 644 cachefilesd.service '/builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386%{_unitdir}/cachefilesd.service'
+ install -m 644 selinux/move-cache.txt /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3/
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /builddir/build/BUILD/cachefilesd-0.10.3
extracting debug info from /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/sbin/cachefilesd
67 blocks
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: cachefilesd-0.10.3-1.fc17.i686
error: File must begin with "/": %{_unitdir}/*
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.EV9o8M
+ umask 022
+ cd /builddir/build/BUILD
+ cd cachefilesd-0.10.3
+ DOCDIR=/builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ export DOCDIR
+ /bin/mkdir -p /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ cp -pr README /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ cp -pr howto.txt /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ cp -pr selinux/move-cache.txt /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ cp -pr selinux/cachefilesd.fc /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ cp -pr selinux/cachefilesd.if /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ cp -pr selinux/cachefilesd.te /builddir/build/BUILDROOT/cachefilesd-0.10.3-1.fc17.i386/usr/share/doc/cachefilesd-0.10.3
+ exit 0
RPM build errors:
File must begin with "/": %{_unitdir}/*
Child returncode was: 1
EXCEPTION: Command failed. See logs for output.
# ['bash', '--login', '-c', 'rpmbuild -bb --target i686 --nodeps builddir/build/SPECS/cachefilesd.spec']
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/mock/trace_decorator.py", line 70, in trace
result = func(*args, **kw)
File "/usr/lib/python2.6/site-packages/mock/util.py", line 325, in do
raise mock.exception.Error, ("Command failed. See logs for output.\n # %s" % (command,), child.returncode)
Error: Command failed. See logs for output.
# ['bash', '--login', '-c', 'rpmbuild -bb --target i686 --nodeps builddir/build/SPECS/cachefilesd.spec']
LEAVE do --> EXCEPTION RAISED

Comments

Re: The Fedora build system and the use of %{_unitdir} in specfi

By David Howells at 11/30/2011 - 07:49

Yes, I seem to be missing that. I have Requires but not BuildRequires. The
question is, though, why it builds on my desktop machine at all then... Did
F16 always set it?

David

Re: The Fedora build system and the use of %{_unitdir} in specfi

By David Howells at 11/30/2011 - 11:20

Ah. That explains it. Can rpmlint be made to check for this?

David

Re: The Fedora build system and the use of %{_unitdir} in specfi

By Richard W.M. Jones at 11/30/2011 - 12:17

On Wed, Nov 30, 2011 at 03:20:41PM +0000, David Howells wrote:
Missing build dependencies are hard to find. It's usually best to do
a scratch build. I doubt rpmlint could reliably detect them.

I wrote a script called auto-buildrequires (it's in Fedora) which can
in some circumstances determine what BRs are needed for a package:

<a href="http://people.redhat.com/~rjones/auto-buildrequires/" title="http://people.redhat.com/~rjones/auto-buildrequires/">http://people.redhat.com/~rjones/auto-buildrequires/</a>

It tends to overestimate the actual BRs though, and it doesn't take
into account of the "core" packages which are always installed.

Rich.

Re: The Fedora build system and the use of %{_unitdir} in specfi

By Michael Cronenworth at 11/30/2011 - 10:49

David Howells wrote:
There's your answer. The rpmbuild command would inherit all the packages
already installed on your system. You will already have systemd-units
installed because it is a dependency of just about every service.

If you used mock or scratch building on koji (which kicks off mock) you
would catch any missing BuildRequires.

Re: The Fedora build system and the use of %{_unitdir} in specfi

By Ralf Corsepius at 11/30/2011 - 10:58

On 11/30/2011 03:49 PM, Michael Cronenworth wrote:
An extended interpretation: The systemd-units package isn't cleanly
split into *-devel and run-time components.

Ralf

Re: The Fedora build system and the use of %{_unitdir} in specfi

By Michael Cronenworth at 11/30/2011 - 10:19

David Howells wrote:
Are you using mock or rpmbuild on your desktop machine?

Re: The Fedora build system and the use of %{_unitdir} in specfi

By Paul Howarth at 11/30/2011 - 09:05

On 11/30/2011 11:49 AM, David Howells wrote:
I'd guess that it's being pulled in as a dependency of something.

Paul.

Re: The Fedora build system and the use of %{_unitdir} in specfi

By Paul Howarth at 11/30/2011 - 07:44

On 11/30/2011 11:39 AM, David Howells wrote:
You must have missed the bit in the guidelines where it says:

Please note that in order for the %{_unitdir} macro to exist, your
package must have:

BuildRequires: systemd-units

Paul.