From 650b6fdd3d100c88fc8aaf30257f70ec0b1c0f7c Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Mon, 5 Sep 2016 13:44:00 +0200 Subject: [PATCH] diamond: Redesign + fixes Signed-off-by: Boris Ranto --- diamond-build/build/build_rpm | 29 +++++++------------ diamond-build/build/setup | 1 - .../config/definitions/diamond-build.yml | 6 +++- diamond-setup/build/build | 20 +++++++++++++ 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/diamond-build/build/build_rpm b/diamond-build/build/build_rpm index 2c60f35f..423c9073 100644 --- a/diamond-build/build/build_rpm +++ b/diamond-build/build/build_rpm @@ -57,12 +57,8 @@ dist=$DIST [ -z "$dist" ] && echo no dist && exit 1 echo dist $dist -vers=$(./version.sh) -chacra_ref="$BRANCH" - -chacra_endpoint="diamond/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}" -chacra_check_url="${chacra_endpoint}/${ARCH}/diamond-${vers}-0.${DIST}.${ARCH}.rpm" - +chacra_endpoint="diamond/${BRANCH}/${SHA1}/${DISTRO}/${RELEASE}" +chacra_check_url="${chacra_endpoint}/${ARCH}/diamond-${VERSION}-0.${DIST}.${ARCH}.rpm" if [ "$THROWAWAY" = false ] ; then # this exists in scripts/build_utils.sh @@ -80,30 +76,27 @@ echo "*****" env echo "*****" -# Create the spec file and install the dependencies -sed -e "s/@VERSION@/${vers}/g" < diamond.spec.in > diamond.spec -yum-builddep -y diamond.spec +# Install the dependencies +sudo yum-builddep -y dist/diamond.spec # Create the source rpm echo "Building SRPM" -rpmbuild \ - --define "_sourcedir $PWD/dist" \ - --define "_specdir $PWD" \ - --define "_builddir $PWD" \ - --define "_srcrpmdir $PWD" \ - --define "_rpmdir $PWD" \ +rpmbuild \ + --define "_sourcedir ./dist" \ + --define "_specdir ." \ + --define "_builddir ." \ + --define "_srcrpmdir ." \ + --define "_rpmdir ." \ --define "dist .any" \ --define "fedora 21" \ --define "rhel 7" \ - --nodeps -bs diamond.spec + --nodeps -bs dist/diamond.spec SRPM=$(readlink -f *.src.rpm) - # Build the binaries echo "Building RPMs" sudo mock -r epel-${RELEASE}-${ARCH} --resultdir=./dist/rpm/"%(dist)s"/"%(target_arch)s"/ ${SRPM} - # Make sure we execute at the top level directory cd "$WORKSPACE" diff --git a/diamond-build/build/setup b/diamond-build/build/setup index a56e5b8b..bccd321c 100644 --- a/diamond-build/build/setup +++ b/diamond-build/build/setup @@ -47,7 +47,6 @@ CentOS|Fedora|SUSE*|RedHatEnterpriseServer) $SUDO yum install -y yum-utils mock ;; esac - _vers=$(./version.sh) ;; *) echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually." diff --git a/diamond-build/config/definitions/diamond-build.yml b/diamond-build/config/definitions/diamond-build.yml index 057ea078..05eed809 100644 --- a/diamond-build/config/definitions/diamond-build.yml +++ b/diamond-build/config/definitions/diamond-build.yml @@ -16,7 +16,7 @@ type: label-expression name: MACHINE_SIZE values: - - huge + - small - axis: type: label-expression name: AVAILABLE_ARCH @@ -54,6 +54,10 @@ which-build: last-successful - inject: properties-file: ${WORKSPACE}/dist/sha1 + - inject: + properties-file: ${WORKSPACE}/dist/branch + - inject: + properties-file: ${WORKSPACE}/dist/version # rpm build scripts - shell: !include-raw: diff --git a/diamond-setup/build/build b/diamond-setup/build/build index 1dc903a0..daf44332 100644 --- a/diamond-setup/build/build +++ b/diamond-setup/build/build @@ -16,15 +16,35 @@ fi echo "Building version $(git describe) Branch $BRANCH" +# Make sure the dist directory is clean rm -rf dist +mkdir -p dist +# Install any setup-time deps if [ -x install-deps.sh ]; then echo "Ensuring dependencies are installed" ./install-deps.sh fi +# Make sure the repo is clean echo "Cleaning up the repo" git clean -fxd echo "Building source distribution" python setup.py sdist + +# Prepare the spec file for build +sed -e "s/@VERSION@/${vers}/g" < diamond.spec.in > dist/diamond.spec + +# Save these so that we can later inject them into the build script +cat > dist/sha1 << EOF +SHA1=${GIT_COMMIT} +EOF + +cat > dist/branch << EOF +BRANCH=${BRANCH} +EOF + +cat > dist/version << EOF +VERSION=$(./version.sh) +EOF -- 2.39.5