From 9247871839f8b50f80c179a9e26b00d353ba8b22 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 1 Feb 2012 00:40:04 +0100 Subject: [PATCH] build-and-provide-package: support PROVIDE_ONLY and BUILD_ONLY, drop REMOTE_REPOS Support setting PROVIDE_ONLY for skipping cowbuilder stage and BUILD_ONLY for skipping reprepro repository stage. Drop REMOTE_REPOS configuration variable, as the name actually doesn't reflect what the script supports nor is it of any use in the main configuration file when having PROVIDE_ONLY and BUILD_ONLY available. This provides the base for using $job-source, $job-binaries and $job-repos to get the build process scaling and distributed on specific slaves. --- examples/debian_glue | 4 ---- scripts/build-and-provide-package | 33 ++++++++++++++++++++---------- scripts/generate-reprepro-codename | 4 ++-- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/examples/debian_glue b/examples/debian_glue index 492917f..9fd919f 100644 --- a/examples/debian_glue +++ b/examples/debian_glue @@ -5,10 +5,6 @@ # Expected format: DEADBEEF # KEY_ID= -# Don't use local reprepro repository. -# Supported values: [true|false] -# REMOTE_REPOS=true - # If TRUNK_RELEASE is set then the package(s) of the repository # receiving the packages that are built will be copied to the # repository specified in TRUNK_RELEASE. This provides the option diff --git a/scripts/build-and-provide-package b/scripts/build-and-provide-package index cba9e5e..9bbcd79 100755 --- a/scripts/build-and-provide-package +++ b/scripts/build-and-provide-package @@ -200,12 +200,12 @@ identify_build_type() { if [ -z "${MAIN_ARCHITECTURE:-}" ] ; then if [ "$(dpkg-architecture -qDEB_HOST_ARCH)" = "${architecture:-}" ] ; then echo "*** MAIN_ARCHITECTURE is unset. ***" - echo "*** Host architecture matches \$architecture, using default ${DEBBUILDOPTS} buildoption ***" + echo "*** Host architecture matches \$architecture, using default ${DEBBUILDOPTS:-} buildoption ***" return 0 fi else if [ "${MAIN_ARCHITECTURE:-}" = "${architecture:-}" ] ;then - echo "*** MAIN_ARCHITECTURE matches architecture [${architecture}], using default ${DEBBUILDOPTS} buildoption ***" + echo "*** MAIN_ARCHITECTURE matches architecture [${architecture:-}], using default ${DEBBUILDOPTS:-} buildoption ***" return 0 else echo "*** MAIN_ARCHITECTURE does not match ${architecture:-}, continuing with identify_build_type ***" @@ -254,13 +254,13 @@ cowbuilder_run() { i386) linux32 sudo cowbuilder --buildresult "$WORKSPACE"/binaries/ \ --build $sourcefile \ - --basepath $BASE --debbuildopts "$DEBBUILDOPTS" + --basepath $BASE --debbuildopts "${DEBBUILDOPTS:-}" [ $? -eq 0 ] || bailout 1 "Error: Failed to build with cowbuilder." ;; amd64|all) sudo cowbuilder --buildresult "$WORKSPACE"/binaries/ \ --build $sourcefile \ - --basepath $BASE --debbuildopts "$DEBBUILDOPTS" + --basepath $BASE --debbuildopts "${DEBBUILDOPTS:-}" [ $? -eq 0 ] || bailout 1 "Error: Failed to build with cowbuilder." ;; *) @@ -297,7 +297,7 @@ remove_missing_binary_packages() { # be reported as missing from the build and to be considered for removal. # As we don't want to remove the arch-all package e.g. from the amd64 repos # in the i386 run we've to skip the removal procedure then. - case "$DEBBUILDOPTS" in + case "${DEBBUILDOPTS:-}" in *-B*) echo "*** Skipping removal of missing binaries as being a binary-only build ***" return 0 @@ -396,9 +396,7 @@ EOF } deploy_to_releases() { - if [ "${REMOTE_REPOS:-}" = "true" ] ; then - echo "*** Config variable 'REMOTE_REPOS' is set, ignoring request to use local repository. ***" - elif [ -n "${release:-}" ] && [ "$release" != "none" ] && [ "$release" != "trunk" ] ; then + if [ -n "${release:-}" ] && [ "$release" != "none" ] && [ "$release" != "trunk" ] ; then release_repos else reprepro_wrapper @@ -423,9 +421,22 @@ set_base_path build_info identify_sourcefile dist_and_arch_settings -cowbuilder_init -cowbuilder_run -deploy_to_releases + +# do not run in repos job? +if [ -n "${PROVIDE_ONLY:-}" ] ; then + echo "*** Config variable 'PROVIDE_ONLY' is set, ignoring request to run cowbuilder. ***" +else + cowbuilder_init + cowbuilder_run +fi + +# do not run in binaries job? +if [ -n "${BUILD_ONLY:-}" ] ; then + echo "*** Config variable 'BUILD_ONLY' is set, ignoring request to use local repository. ***" +else + deploy_to_releases +fi + binaries_to_workspace bailout 0 diff --git a/scripts/generate-reprepro-codename b/scripts/generate-reprepro-codename index 2ea3ddd..d5f49d1 100755 --- a/scripts/generate-reprepro-codename +++ b/scripts/generate-reprepro-codename @@ -7,8 +7,8 @@ if [ -r /etc/jenkins/debian_glue ] ; then . /etc/jenkins/debian_glue fi -if [ "${REMOTE_REPOS:-}" = "true" ] ; then - echo "REMOTE_REPOS is set, ignoring request to generate local repository." +if [ "${BUILD_ONLY:-}" = "true" ] ; then + echo "BUILD_ONLY is set to true, ignoring request to generate local repository." exit 0 fi