]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commit
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)
commit82ff876f5d945416e75d107b01cd2da7d3d5877f
tree1a98e128562509623c86d51e3274d8462cd4b993
parent43396251f85c3bbf9897537dd8af23c6d122a371
buildpackages: fix make-rpm.sh for kraken + SUSE

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