From 9b77e2e1b346c7f2f6fe617bc9c48e3c9c39d6de Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 28 Oct 2019 19:22:57 -0400 Subject: [PATCH] Build avoidance fixes 1) Build avoidance fails on a clean workspace because directory $MY_WORKSPACE/tmp doesn't exist when mktemp needs to create a forth subdir under that path. Add a 'mkdir -p $MY_WORKSPACE/tmp' to ensure it exists prior to mktemp. 2) Failed to rebuild kmods after a kernel change and building with build-avoidance enabled. The problem was a missing dependency cache that would have listed the kmods as having dependencies on the kernel. Reusing kmods from a prior build in conjunction with a rebuilt kernel results int load with unusable kmods due to a key mismatch. Add the dependancy-cache to the list of artifacts to syncronize as part of build avoidance. A primed dependency cache will allow build-pkgs to determine that kmods must be rebuilt when the kernel has changed. 3) Make sure $MY_WORKSPACE/$BUILD_TYPE/repo symlink exists after a build avoidance build. If no packages require a rebuild, it was missing. 4) Fix an error message that was puzzling while debugging the above issues. Closes-Bug: 1864110 Change-Id: Ia912b2e3e110efbe69004d7978109ebb089d684b Signed-off-by: Scott Little --- build-data/build_avoidance_source | 2 +- build-tools/build-avoidance-utils.sh | 20 ++++++++++++++++++++ build-tools/build-rpms-parallel | 1 + build-tools/build-rpms-serial | 1 + build-tools/build-srpms-common.sh | 2 +- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/build-data/build_avoidance_source b/build-data/build_avoidance_source index 71135f20..45c7f32e 100644 --- a/build-data/build_avoidance_source +++ b/build-data/build_avoidance_source @@ -10,7 +10,7 @@ # BUILD_AVOIDANCE_SRPM_DIRECTORIES="inputs srpm_assemble rpmbuild/SRPMS rpmbuild/SOURCES" BUILD_AVOIDANCE_SRPM_FILES="" -BUILD_AVOIDANCE_RPM_DIRECTORIES="results rpmbuild/RPMS rpmbuild/SPECS" +BUILD_AVOIDANCE_RPM_DIRECTORIES="results rpmbuild/RPMS rpmbuild/SPECS repo/cgcs-tis-repo/dependancy-cache" BUILD_AVOIDANCE_RPM_FILES=".platform_release" diff --git a/build-tools/build-avoidance-utils.sh b/build-tools/build-avoidance-utils.sh index 962d8642..7bff8a63 100644 --- a/build-tools/build-avoidance-utils.sh +++ b/build-tools/build-avoidance-utils.sh @@ -35,6 +35,10 @@ # BUILD_AVOIDANCE_FILE_TRANSFER="my-supported-prototcol" # +BUILD_AVOIDANCE_UTILS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )" + +source "${BUILD_AVOIDANCE_UTILS_DIR}/git-utils.sh" + BUILD_AVOIDANCE_USR="" BUILD_AVOIDANCE_HOST="" BUILD_AVOIDANCE_DIR="" @@ -778,6 +782,22 @@ build_avoidance () { return 1 fi + if [ ! -d $MY_WORKSPACE/$BUILD_TYPE ]; then + mkdir -p $MY_WORKSPACE/$BUILD_TYPE + if [ $? -ne 0 ]; then + >&2 echo "Error: $FUNCNAME (${LINENO}): Failed to create directory $MY_WORKSPACE/$BUILD_TYPE" + return 1 + fi + fi + + if [ ! -L $MY_WORKSPACE/$BUILD_TYPE ]; then + ln -s $MY_REPO $MY_WORKSPACE/$BUILD_TYPE/repo + if [ $? -ne 0 ]; then + >&2 echo "Error: $FUNCNAME (${LINENO}): Failed to create symlink $MY_WORKSPACE/$BUILD_TYPE/repo -> $MY_REPO" + return 1 + fi + fi + build_avoidance_pre_clean $BUILD_TYPE if [ $? -ne 0 ]; then >&2 echo "Error: $FUNCNAME (${LINENO}): build_avoidance_pre_clean $BUILD_TYPE" diff --git a/build-tools/build-rpms-parallel b/build-tools/build-rpms-parallel index 84358480..12546e13 100755 --- a/build-tools/build-rpms-parallel +++ b/build-tools/build-rpms-parallel @@ -1838,6 +1838,7 @@ update_spec_cache () { echo "Find the list of packages we must compile" +mkdir -p $MY_WORKSPACE/tmp/ NEED_BUILD_DIR=$(mktemp -d $MY_WORKSPACE/tmp/$USER-$ME-need-build-XXXXXX) if [ $? -ne 0 ] || [ "x$NEED_BUILD_DIR" == "x" ]; then echo "Failed to create temp directory under $MY_WORKSPACE/tmp" diff --git a/build-tools/build-rpms-serial b/build-tools/build-rpms-serial index 3f355e04..6db137e7 100755 --- a/build-tools/build-rpms-serial +++ b/build-tools/build-rpms-serial @@ -1598,6 +1598,7 @@ update_spec_cache () { echo "Find the list of packages we must compile" +mkdir -p $MY_WORKSPACE/tmp/ NEED_BUILD_DIR=$(mktemp -d $MY_WORKSPACE/tmp/$USER-$ME-need-build-XXXXXX) if [ $? -ne 0 ] || [ "x$NEED_BUILD_DIR" == "x" ]; then echo "Failed to create temp directory under $MY_WORKSPACE/tmp" diff --git a/build-tools/build-srpms-common.sh b/build-tools/build-srpms-common.sh index a0336b1e..0db1c409 100644 --- a/build-tools/build-srpms-common.sh +++ b/build-tools/build-srpms-common.sh @@ -119,7 +119,7 @@ md5sums_from_input_vars () { if [ "x$COPY_LIST" != "x" ]; then ABS_COPY_LIST=$(readlink -f $COPY_LIST) if [ $? -ne 0 ]; then - >&2 echo "ERROR: $FUNCNAME (${LINENO}): readlink -f '$COPY_LIST' -type f" + >&2 echo "ERROR: $FUNCNAME (${LINENO}): readlink -f '$COPY_LIST'" return 1 fi