From 1aee4a42e6af9248c7688848c68a071971cb70fb Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 15 Oct 2018 14:49:25 -0400 Subject: [PATCH] Refusal to build libvirt src.rpm after CTRL-C Problem: An incremental build was interrupted by CTRL-C. Libvirt was one of the packages interrupted mid build. Subsequent incremental builds failed to rebuild libvirt. The BUILD_NEEDED logic fails to trigger if the working directory has been created, but is empty of src.rpms's. Solution: Add additional tests to ensure empty working directories trigger a BUILD_NEEDED condition. Closes-Bug: 1798191 Change-Id: I99e1fe76b016a5779d623d2ff91cc924b45a9338 Signed-off-by: Scott Little --- build-tools/build-srpms-common.sh | 2 +- build-tools/build-srpms-parallel | 30 +++++++++++++++++++++++------- build-tools/build-srpms-serial | 31 ++++++++++++++++++++++++------- 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/build-tools/build-srpms-common.sh b/build-tools/build-srpms-common.sh index 2afce635..d83e6545 100644 --- a/build-tools/build-srpms-common.sh +++ b/build-tools/build-srpms-common.sh @@ -152,7 +152,7 @@ md5sums_from_input_vars () { fi ) if [ $? -eq 1 ]; then - return -1 + return 1 fi # Create sorted, unique list of cononical paths diff --git a/build-tools/build-srpms-parallel b/build-tools/build-srpms-parallel index 47e91e87..7af9eff5 100755 --- a/build-tools/build-srpms-parallel +++ b/build-tools/build-srpms-parallel @@ -684,6 +684,7 @@ build_dir_srpm () { fi if [ -d "$FULL_BUILD_DIR/SRPMS" ]; then + b="" for SRPM_PATH in $(find "$FULL_BUILD_DIR/SRPMS" -name '*.src.rpm' | sort -V); do b=$(basename $SRPM_PATH) SRPM_OUT_PATH2=$(find $SRPM_OUT -name $b) @@ -692,6 +693,11 @@ build_dir_srpm () { BUILD_NEEDED=1 fi done + + if [ "$b" == "" ]; then + echo "Rebuild required due no src.rpm in directory: '$FULL_BUILD_DIR/SRPMS'" + BUILD_NEEDED=1 + fi else echo "Rebuild required due to missing directory: '$FULL_BUILD_DIR/SRPMS'" BUILD_NEEDED=1 @@ -995,14 +1001,24 @@ build_dir_spec () { fi if [ -d "$FULL_BUILD_DIR/SRPMS" ]; then - for SRPM_PATH2 in $(find "$RPMBUILD_BASE/SRPMS" -name '*.src.rpm' | sort -V); do - b=$(basename $SRPM_PATH2) - SRPM_OUT_PATH2=$(find $SRPM_OUT -name $b) - if [ "x$SRPM_OUT_PATH2" == "x" ]; then - echo "Rebuild required due to missing srpm: $b" - BUILD_NEEDED=1 + if [ -d "$RPMBUILD_BASE/SRPMS" ]; then + b="" + for SRPM_PATH2 in $(find "$RPMBUILD_BASE/SRPMS" -name '*.src.rpm' | sort -V); do + b=$(basename $SRPM_PATH2) + SRPM_OUT_PATH2=$(find $SRPM_OUT -name $b) + if [ "x$SRPM_OUT_PATH2" == "x" ]; then + echo "Rebuild required due to missing srpm: $b" + BUILD_NEEDED=1 + fi + done + if [ "$b" == "" ]; then + echo "Rebuild required due no src.rpm found in directory: '$RPMBUILD_BASE/SRPMS'" + BUILD_NEEDED=1 fi - done + else + echo "Rebuild required due to missing directory: '$RPMBUILD_BASE/SRPMS'" + BUILD_NEEDED=1 + fi else echo "Rebuild required due to missing directory: '$FULL_BUILD_DIR/SRPMS'" BUILD_NEEDED=1 diff --git a/build-tools/build-srpms-serial b/build-tools/build-srpms-serial index 8449c531..796157b2 100755 --- a/build-tools/build-srpms-serial +++ b/build-tools/build-srpms-serial @@ -662,6 +662,7 @@ build_dir_srpm () { fi if [ -d "$FULL_BUILD_DIR/SRPMS" ]; then + b="" for SRPM_PATH in $(find "$FULL_BUILD_DIR/SRPMS" -name '*.src.rpm' | sort -V); do b=$(basename $SRPM_PATH) SRPM_OUT_PATH2=$(find $SRPM_OUT -name $b) @@ -670,6 +671,11 @@ build_dir_srpm () { BUILD_NEEDED=1 fi done + + if [ "$b" == "" ]; then + echo "Rebuild required due no src.rpm in directory: '$FULL_BUILD_DIR/SRPMS'" + BUILD_NEEDED=1 + fi else echo "Rebuild required due to missing directory: '$FULL_BUILD_DIR/SRPMS'" BUILD_NEEDED=1 @@ -971,14 +977,25 @@ build_dir_spec () { fi if [ -d "$FULL_BUILD_DIR/SRPMS" ]; then - for SRPM_PATH2 in $(find "$RPMBUILD_BASE/SRPMS" -name '*.src.rpm' | sort -V); do - b=$(basename $SRPM_PATH2) - SRPM_OUT_PATH2=$(find $SRPM_OUT -name $b) - if [ "x$SRPM_OUT_PATH2" == "x" ]; then - echo "Rebuild required due to missing srpm: $b" - BUILD_NEEDED=1 + if [ -d "$RPMBUILD_BASE/SRPMS" ]; then + b="" + for SRPM_PATH2 in $(find "$RPMBUILD_BASE/SRPMS" -name '*.src.rpm' | sort -V); do + b=$(basename $SRPM_PATH2) + SRPM_OUT_PATH2=$(find $SRPM_OUT -name $b) + if [ "x$SRPM_OUT_PATH2" == "x" ]; then + echo "Rebuild required due to missing srpm: $b" + BUILD_NEEDED=1 + fi + done + + if [ "$b" == "" ]; then + echo "Rebuild required due no src.rpm found in directory: '$RPMBUILD_BASE/SRPMS'" + BUILD_NEEDED=1 fi - done + else + echo "Rebuild required due to missing directory: '$RPMBUILD_BASE/SRPMS'" + BUILD_NEEDED=1 + fi else echo "Rebuild required due to missing directory: '$FULL_BUILD_DIR/SRPMS'" BUILD_NEEDED=1