From e9bbaaf8a0dce05a8fe3c27c9f43d2208d11f36d Mon Sep 17 00:00:00 2001 From: Felipe De Jesus Ruiz Garcia Date: Fri, 1 Feb 2019 22:05:24 +0000 Subject: [PATCH] Fix mtce-guest not rebuilt after mtce-common MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A recent change to stx-metal/mtce-common broke the nightly StarlingX build due to stx-nfv/mtce-guest build failure. This occurred after a stx-metal/mtce-common change removed a structure member that the stx-nfv/mtce-guest compile required. Since mtce-guest was not rebuilt automatically the pending compile error was not noticed during UT and the update was delivered only to show up as a nightly build failure. This commit recreates $MY_REPO/cgcs-tis-repo/dependancy-cache running create_dependancy_cache.py every time when any rpms and srpms changes, to keep the stx cache updated. The rpms/srpms changes are detected using the repodata files: The repodata filenames includes it’s own sha256 in their name, this is useful to detect rpm/srpms by only comparing the filenames. Closes-Bug: #1804687 Change-Id: Ieb6bf59542451a0cb4cc275bd9d59b532c5b6189 Signed-off-by: Felipe De Jesus Ruiz Garcia --- build-tools/build-pkgs | 49 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/build-tools/build-pkgs b/build-tools/build-pkgs index 15f7dd93..fe7d5567 100755 --- a/build-tools/build-pkgs +++ b/build-tools/build-pkgs @@ -38,11 +38,58 @@ fi # Make sure we have a dependency cache DEP_CACHE="$MY_REPO/cgcs-tis-repo/dependancy-cache" + +BUILD_TYPES=(" std rt installer containers") +DEP_RPM_TYPE=(" RPMS SRPMS ") +DEP_DELTAS="$DEP_CACHE/deltas-rpms-srpms" + +make_cache_current_rpms () { + + FILE=${1} + + if [ -z "${FILE}" ]; then + echo "File not specified" + return; + fi + + if [ -f ${FILE} ]; then + rm ${FILE} + fi + + for build_type in $BUILD_TYPES; do + for rpm_type in $DEP_RPM_TYPE; do + + if [ -d $MY_WORKSPACE/$build_type/rpmbuild/$rpm_type/repodata ]; then + current=$MY_WORKSPACE/$build_type/rpmbuild/$rpm_type/ + + repoquery \ + --repofrompath=$build_type-$rpm_type,$current \ + --repoid=$build_type-$rpm_type --arch=noarch,src,x86_64 -a \ + --qf "%-10{repoid} %-40{name} %-10{version} %-10{release}" \ + >> ${FILE} + fi + done; + done; +} + if [ ! -d $DEP_CACHE ]; then echo "Dependency cache is missing. Creating it now." $BUILD_PKGS_DIR/create_dependancy_cache.py > $MY_WORKSPACE/create_dependancy_cache.log + make_cache_current_rpms $DEP_DELTAS echo "Dependency cache created." - echo "" +else + DEP_TMP=$(mktemp) + make_cache_current_rpms $DEP_TMP + if diff $DEP_DELTAS $DEP_TMP; then + echo "No changes for stx projects" + rm $DEP_TMP + else + echo "Changes detected for stx projects" + echo "Recreating dependecy cache now." + mv $DEP_TMP $DEP_DELTAS + $BUILD_PKGS_DIR/create_dependancy_cache.py > $MY_WORKSPACE/create_dependancy_cache.log + echo "Dependency cache recreated." + fi fi if [ $SERIAL_FLAG -eq 1 ]; then