]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
buildpackages: fix make-rpm.sh for kraken + SUSE
authorNathan Cutler <ncutler@suse.com>
Sun, 12 Feb 2017 21:14:32 +0000 (22:14 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Mon, 14 Oct 2019 14:47:01 +0000 (16:47 +0200)
tl;dr:

SUSE builds in the OBS do not use the make-dist script to generate the
tarball.  This commit overrides a SUSE downstream patch that was breaking
make-dist.

Full analysis:

make-rpm.sh breaks for kraken when run on SLE-12-SP2:

+ rpmbuild -ba --define '_unpackaged_files_terminate_build 0' --define '_topdir /tmp/release/sles/WORKDIR' ceph.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.F2hJfx
+ umask 022
+ cd /tmp/release/sles/WORKDIR/BUILD
+ cd /tmp/release/sles/WORKDIR/BUILD
+ rm -rf ceph-11.1.0
+ /usr/bin/bzip2 -dc /tmp/release/sles/WORKDIR/SOURCES/ceph-11.1.0-7423-g8f37fcc.tar.bz2
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd ceph-11.1.0
/var/tmp/rpm-tmp.F2hJfx: line 35: cd: ceph-11.1.0: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.F2hJfx (%prep)

The buildpackages task uses "make-dist" to generate the tarball. In order for
the tarball so generated to be buildable by rpmbuild, the spec file must
contain the following lines:

Version:        @VERSION@
Release:        @RPM_RELEASE@%{?dist}
...
%prep
%autosetup -p1 -n @TARBALL_BASENAME@

SUSE builds in OBS/IBS use a modified spec file and uses a different mechanism
to generate the tarball. (This worked well up until jewel but for kraken and
beyond we may need to reconsider.) In the SUSE downstream version of the spec
file, the lines look like this:

Version:        @VERSION@
Release:        @RPM_RELEASE@%{?dist}
...
%prep
%if 0%{?rhel}
%autosetup -p1 -n @TARBALL_BASENAME@
%endif
%if ! 0%{?rhel}
%autosetup -p1
%endif

The absence of "-n @TARBALL_BASENAME@" causes the tarball basename to be
"ceph-$VERSION" (e.g. ceph-12.0.0) instead of the full
"ceph-$VERSION-$RPM_RELEASE" (e.g. ceph-12.0.0-3534.g000000), yet rpmbuild
expects the latter because the "Release:" field of the spec file is populated.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
teuthology/task/buildpackages/make-rpm.sh

index 9555afb1d40350a5f66d9898713b1b437eca1b62..d6e09285201ee68f8fd6e58ac9a9f4247c9189dd 100755 (executable)
@@ -114,6 +114,10 @@ function build_package() {
         make dist-bzip2
     else
         # kraken and above
+        if [ "$suse" = true ]; then
+            sed -i -e 's/^%autosetup -p1$/%autosetup -p1 -n @TARBALL_BASENAME@/' \
+                ceph.spec.in
+        fi
         ./make-dist
     fi
     # Set up build area