I am trying to build and deploy an RPM package from Jenkins based on some spec file boilerplate from another project that was written earlier than mine. For some reasons, I am getting build errors when I try to build or release this package from within Jenkins.

+ rm -rf /builddir/build/BUILDROOT/component-prefix-blah-api-proxy-
BUILDSTDERR: ++ dirname /builddir/build/BUILDROOT/component-prefix-blah-api-proxy-
RPM build errors:
BUILDSTDERR: error: File not found by glob: /builddir/build/BUILDROOT/component-prefix-blah-api-proxy-*
BUILDSTDERR:     File not found by glob: /builddir/build/BUILDROOT/component-prefix-blah-api-proxy-*
Child return code was: 1
EXCEPTION: [Error()]
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 96, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/util.py", line 734, in do_with_status
    raise exception.Error("Command failed: \n # %s\n%s" % (command, output), child.returncode)
Error: Command failed: 
 # /usr/bin/systemd-nspawn -q -M b88888b933974fe283e8497d165b5369 -D /var/lib/mock/epel-7-x86_64-9876/root --capability=cap_ipc_lock --bind=/tmp/mock-resolv.kXeD1i:/etc/resolv.conf --setenv=LANG=en_GB.UTF-8 --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOSTNAME=mock --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=HOME=/builddir --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PS1=<mock-chroot> \s-\v\$  -u mockbuild bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps /builddir/build/SPECS/blah-api-proxy.spec

There is another error that came up earlier than the one above in the RPM build.log file that I do not think is the main error as I have seen this occur in other well-working builds before

BUILDSTDERR: Failed to create directory /var/lib/mock/epel-7-x86_64-9876/root//sys/fs/selinux: Read-only file system

I have tried setting the --old-chroot flag on the execution of mock. However, I started getting two errors -

ERROR: Exception(/var/lib/jenkins/workspace/component-prefix-blah-api-proxy/blah-api-proxy/SRPMS/component-prefix-blah-api-proxy- Config(epel-7-x86_64) 0 minutes 11 seconds and

 # bash --login -c /usr/bin/rpmbuild -bb --target x86_64 --nodeps /builddir/build/SPECS/blah-api-proxy.spec
Version: 0.1.0%{?BUILD_NUMBER:.%{BUILD_NUMBER}}
Release: 1%{?dist}
Group: System Environment/Daemons
License: Internal COY use only
Summary: BLAH API Proxy
Source0: src.tar.gz
Requires: blah-blah-ssl-services-blah-staff jq
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildArch: x86_64


%setup -q -n src


mkdir -p %{buildroot}
cp -r * %{buildroot}/

rm -rf %{buildroot}


%defattr(0755, root, root, 0755)

%defattr(-, root, root, 0755)

%defattr(0755, root, root, 0755)

N.B: blah-api-proxy is a directory containing Apache proxy server configurations.

The src folder structure is as follows:

├── etc
│   └── bake-scripts
│       ├── blah-api-proxy
│       └── public-endpoints
└── var
    └── www
        └── cgi-bin

I will be very grateful if I get help in resolving this issue. Thank you very much in advance.

2 Answers

sage On Best Solutions

I am very thankful to @msuchy for his help with this problem. His recommendation helped me in identifying the root cause quickly.

The problem was that one of the directories, /var/, specified in the %files section of the spec file was excluded from the git repo by the .gitignore file. Removing the directory from the .gitignore file solved this problem

The other thing that was required which we did was specify the rpm repositories that our spec file relied on, in our release system (not Jenkins).

msuchy On

The error state (during processing %files section) that %{buildroot}/var/www/cgi-bin/ does not exist.

So you think that you copy something, but the reality is different.

Add at the end of %install section: find %{buildroot}/ and run the build again, and you will see what cp actually put there.