From 16ec0f39237e36a588edd0ce619f3defcbb3442e Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 24 Feb 2017 16:43:33 +0100 Subject: [PATCH] Support SKIP_SOURCE_REMOVAL to not remove source package in binary only package builds For example when the MAIN_ARCHITECTURE or the host architecture doesn't match the package architecture, we build binary only packages by setting DEBBUILDOPTS to -B. But when looking at packages to remove from the repository, we remove the source package too, although we have nothing to replace it with. Thanks: Antoine Delvaux for the bugreport + initial patch Closes #173 @ GH --- scripts/build-and-provide-package | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/build-and-provide-package b/scripts/build-and-provide-package index a7c8264..ab59c6a 100755 --- a/scripts/build-and-provide-package +++ b/scripts/build-and-provide-package @@ -451,6 +451,9 @@ identify_build_type() { SKIP_ARCH_BUILD=false echo "*** Setting SKIP_ARCH_BUILD=$SKIP_ARCH_BUILD to skip further arch builds. ***" + + SKIP_SOURCE_REMOVAL=true + echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" return 0 fi @@ -474,6 +477,9 @@ identify_build_type() { echo "*** Host architecture [${HOST_ARCH}] does not match \$architecture [${architecture:-}] ... ***" echo "*** ... setting binary only build and continuing with identify_build_type ***" DEBBUILDOPTS="-B" + + SKIP_SOURCE_REMOVAL=true + echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" fi else if [ "${MAIN_ARCHITECTURE:-}" = "${architecture:-}" ] ;then @@ -483,6 +489,9 @@ identify_build_type() { else echo "*** MAIN_ARCHITECTURE [${MAIN_ARCHITECTURE:-}] does not match \$architecture [${architecture:-}], setting binary only build and continuing with identify_build_type ***" DEBBUILDOPTS="-B" + + SKIP_SOURCE_REMOVAL=true + echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" fi fi @@ -500,6 +509,9 @@ identify_build_type() { echo "*** Package provides arch 'all' + 'any', enabling -B buildoption for this architecture. ***" # -B -> binary-only build, limited to architecture dependent packages DEBBUILDOPTS="-B" + + SKIP_SOURCE_REMOVAL=true + echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" break else # only "Architecture: all", so no arch specific packages since @@ -776,8 +788,12 @@ remove_packages() { return 0 fi - echo "*** Removing source package version from repository ***" - ${SUDO_CMD:-} ${REPREPRO_CMD} -A source -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${SOURCE_PACKAGE}" + if [ -n "${SKIP_SOURCE_REMOVAL:-}" ] ; then + echo "*** Skipping removal of existing source package as requested via SKIP_SOURCE_REMOVAL ***" + else + echo "*** Removing source package version from repository ***" + ${SUDO_CMD:-} ${REPREPRO_CMD} -A source -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${SOURCE_PACKAGE}" + fi echo "*** Removing previous binary package versions from repository ***" for p in $(list_deb_files "${WORKSPACE}/binaries/"*"_${newest_version}_${arch}.changes") ; do