From: Alfredo Deza Date: Mon, 3 Nov 2014 17:57:42 +0000 (-0500) Subject: gigantic script to build deb+rpm X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0264a94e67d9cc405c40a9d888437c7e6a11c63a;p=ceph-build.git gigantic script to build deb+rpm Signed-off-by: Alfredo Deza --- diff --git a/python-bindings/config/definitions/build.sh b/python-bindings/config/definitions/build.sh index 61c8e6d1..fa2d70bf 100644 --- a/python-bindings/config/definitions/build.sh +++ b/python-bindings/config/definitions/build.sh @@ -32,27 +32,151 @@ gitbuilder-*-rpm*) rm -rf rpm-repo dist/* build/rpmbuild pwd cd build - ./scripts/build-rpm.sh --release - if [ $? -eq 0 ] ; then - mv rpm-repo $WORKSPACE/. - cd $WORKSPACE - mkdir -p dist + + # Tag tree and update version number in change log and + # in setup.py before building. + + REPO=debian-repo + COMPONENT=main + KEYID=${KEYID:-03C3951A} # default is autobuild keyid + DEB_DIST="sid wheezy squeeze quantal precise oneiric natty raring" + DEB_BUILD=$(lsb_release -s -c) + RELEASE=1 + + if [ ! -d debian ] ; then + echo "Are we in the right directory" + exit 1 + fi + + if gpg --list-keys 2>/dev/null | grep -q ${KEYID} ; then + echo "Signing packages and repo with ${KEYID}" + else + echo "Package signing key (${KEYID}) not found" + echo "Have you set \$GNUPGHOME ? " + exit 3 + fi + + # Clean up any leftover builds + #rm -f ../ceph-deploy*.dsc ../ceph-deploy*.changes ../ceph-deploy*.deb ../ceph-deploy.tgz + #rm -rf ./debian-repo + + # Apply backport tag if release build + # I am going to jump out the window if this is not fixed and removed from the source + # of this package. There is absolutely **NO** reason why we need to hard code the + # DEBEMAIL like this. + if [ $RELEASE -eq 1 ] ; then + DEB_VERSION=$(dpkg-parsechangelog | sed -rne 's,^Version: (.*),\1, p') + BP_VERSION=${DEB_VERSION}${BPTAG} + DEBEMAIL="adeza@redhat.com" dch -D $DIST --force-distribution -b -v "$BP_VERSION" "$comment" + dpkg-source -b . fi + + # Build Package + echo "Building for dist: $DEB_BUILD" + dpkg-buildpackage -k$KEYID + if [ $? -ne 0 ] ; then + echo "Build failed" + exit 2 + fi + + # Build Repo + PKG=../python-*.changes + mkdir -p $REPO/conf + if [ -e $REPO/conf/distributions ] ; then + rm -f $REPO/conf/distributions + fi + + for DIST in $DEB_DIST ; do + cat <> $REPO/conf/distributions +Codename: $DIST +Suite: stable +Components: $COMPONENT +Architectures: amd64 armhf i386 source +Origin: Inktank +Description: Ceph distributed file system +DebIndices: Packages Release . .gz .bz2 +DscIndices: Sources Release .gz .bz2 +Contents: .gz .bz2 +SignWith: $KEYID + +EOF + done + + echo "Adding package to repo, dist: $DEB_BUILD ($PKG)" + reprepro --ask-passphrase -b $REPO -C $COMPONENT --ignore=undefinedtarget --ignore=wrongdistribution include $DEB_BUILD $PKG + + mv rpm-repo $WORKSPACE/. + cd $WORKSPACE + mkdir -p dist + ;; gitbuilder-cdep-deb* | tala* | mira*) pwd rm -rf debian-repo rm -rf dist rm -f *.changes *.dsc *.gz *.diff - cd build pwd - ./scripts/build-debian.sh --release - if [ $? -eq 0 ] ; then - mv debian-repo $WORKSPACE/. - cd $WORKSPACE - mkdir -p dist - mv *.changes *.dsc *.deb *.tar.gz dist/. + + # Tag tree and update version number in change log and + # in setup.py before building. + + REPO=rpm-repo + KEYID=${KEYID:-03C3951A} # Default is autobuild-key + BUILDAREA=./rpmbuild + DIST=el6 + RPM_BUILD=$(lsb_release -s -c) + + if [ ! -e setup.py ] ; then + echo "Are we in the right directory" + exit 1 + fi + + if gpg --list-keys 2>/dev/null | grep -q ${KEYID} ; then + echo "Signing packages and repo with ${KEYID}" + else + echo "Package signing key (${KEYID}) not found" + echo "Have you set \$GNUPGHOME ? " + exit 3 fi + + if ! CREATEREPO=`which createrepo` ; then + echo "Please install the createrepo package" + exit 4 + fi + + # Create Tarball + python setup.py sdist --formats=bztar + + # Build RPM + mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} + BUILDAREA=`readlink -fn ${BUILDAREA}` ### rpm wants absolute path + cp *.spec ${BUILDAREA}/SPECS + cp dist/*.tar.bz2 ${BUILDAREA}/SOURCES + echo "buildarea is: ${BUILDAREA}" + rpmbuild -ba --define "_topdir ${BUILDAREA}" --define "_unpackaged_files_terminate_build 0" ${BUILDAREA}/SPECS/ceph-deploy.spec + + # create repo + DEST=${REPO}/${DIST} + mkdir -p ${REPO}/${DIST} + cp -r ${BUILDAREA}/*RPMS ${DEST} + + # Sign all the RPMs for this release + rpm_list=`find ${REPO} -name "*.rpm" -print` + rpm --addsign --define "_gpg_name ${KEYID}" $rpm_list + + # Construct repodata + for dir in ${DEST}/SRPMS ${DEST}/RPMS/* + do + if [ -d $dir ] ; then + createrepo $dir + gpg --detach-sign --armor -u ${KEYID} $dir/repodata/repomd.xml + fi + done + + mv debian-repo $WORKSPACE/. + cd $WORKSPACE + mkdir -p dist + mv *.changes *.dsc *.deb *.tar.gz dist/. ;; *) echo "Can't determine build host type"