e9bbaaf8a0
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 <felipe.de.jesus.ruiz.garcia@intel.com>
106 lines
2.5 KiB
Bash
Executable File
106 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#
|
|
# Copyright (c) 2018 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
#
|
|
# Build first src.rpms, then rpms, from source, or from a downloaded tarball
|
|
# or src.rpm plus our additional patches.
|
|
#
|
|
# This program is a wrapper around build-pkgs-parallel and build-pkgs-serial
|
|
#
|
|
|
|
BUILD_PKGS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
|
|
|
usage () {
|
|
echo ""
|
|
echo "Usage: "
|
|
echo " Create source and binary rpms:"
|
|
echo " build-pkgs [--serial] [args]"
|
|
}
|
|
|
|
SERIAL_FLAG=0
|
|
RC=0
|
|
|
|
for arg in "$@"; do
|
|
case "$1" in
|
|
--serial) SERIAL_FLAG=1 ;;
|
|
esac
|
|
done
|
|
|
|
which mock_tmpfs_umount >> /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
SERIAL_FLAG=1
|
|
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."
|
|
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
|
|
echo "build-pkgs-serial $@"
|
|
build-pkgs-serial "$@"
|
|
RC=$?
|
|
else
|
|
echo "build-pkgs-parallel $@"
|
|
build-pkgs-parallel "$@"
|
|
RC=$?
|
|
fi
|
|
|
|
exit $RC
|