Build script readiness for renaming cgcs-centos-repo to centos-repo

I want the build to work with either centos-repo or cgcs-centos-repo.
In many places we will be testing for the existance centos-repo as
the prefered path, then fall back to cgcs-centos-repo as an alternative.
If neither are present, either exit or continue but assuming the new
path is intended.

NOTE: The patch_rebase_1/2/3/4 scripts remain broken, but I hope
to salvage them one day.  The current coding assumes content under
centos-repo/cgcs-centos-repo is managed by a git, which is not
currently true.

Story: 2006387
Task: 36912
Change-Id: I8f694814c41957c5b37eb2e64b653b7d42f2e2c9
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2020-09-04 15:42:35 -04:00
parent cf2c5804a4
commit 01c5009d7d
37 changed files with 260 additions and 2079 deletions

View File

@ -28,6 +28,16 @@ rpm_compare () {
done done
} }
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
echo "" echo ""
echo "======================================================" echo "======================================================"
echo "Auditing built packages vs unpatched upstream packages" echo "Auditing built packages vs unpatched upstream packages"
@ -35,7 +45,7 @@ echo "======================================================"
for r in $(find $MY_WORKSPACE/*/rpmbuild/RPMS -name '*.rpm' | grep -v '.src.rpm' | grep -v debuginfo); do for r in $(find $MY_WORKSPACE/*/rpmbuild/RPMS -name '*.rpm' | grep -v '.src.rpm' | grep -v debuginfo); do
f=$(basename $r) f=$(basename $r)
f2=$(echo $f | sed 's#[.]tis[.][0-9]*[.]#.#' | sed 's#[.]tis[.]#.#') f2=$(echo $f | sed 's#[.]tis[.][0-9]*[.]#.#' | sed 's#[.]tis[.]#.#')
r2=$(find $MY_REPO/cgcs-centos-repo/Binary/ -name $f2) r2=$(find ${CENTOS_REPO}/Binary/ -name $f2)
if [ "$r2" == "" ]; then if [ "$r2" == "" ]; then
# Probably one of our own # Probably one of our own
# echo "Couldn't find '$f2'" # echo "Couldn't find '$f2'"
@ -49,16 +59,18 @@ echo "============================"
echo "Auditing built for conflicts" echo "Auditing built for conflicts"
echo "============================" echo "============================"
grep 'conflicts with file from package' -r --binary-files=without-match $MY_WORKSPACE/*/results/ | grep 'conflicts with file from package' -r --binary-files=without-match $MY_WORKSPACE/*/results/ |
while read -r line; do while read -r line; do
w=$(echo "$line" | awk '{ print $8 }')".rpm" w=$(echo "$line" | awk '{ print $8 }')".rpm"
w2=$(echo "$line" | awk '{ print $14 }')".rpm" w2=$(echo "$line" | awk '{ print $14 }')".rpm"
echo "$w $w2" echo "$w $w2"
done | sort --unique | sed 's#bash-completion-1:#bash-completion-#' | done | sort --unique | sed 's#bash-completion-1:#bash-completion-#' |
while read -r line2; do while read -r line2; do
f=$(echo "$line2" | awk '{ print $1 }') f=$(echo "$line2" | awk '{ print $1 }')
f2=$(echo "$line2" | awk '{ print $2 }') f2=$(echo "$line2" | awk '{ print $2 }')
r=$(find $MY_REPO/cgcs-centos-repo/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f) r=$(find ${CENTOS_REPO}/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f)
r2=$(find $MY_REPO/cgcs-centos-repo/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f2) r2=$(find ${CENTOS_REPO}/Binary/ $MY_WORKSPACE/*/rpmbuild/RPMS -name $f2)
# echo "" # echo ""
# echo "$f vs $f2" # echo "$f vs $f2"
# echo "$r vs $r2" # echo "$r vs $r2"
@ -66,5 +78,3 @@ while read -r line2; do
rpm_compare "$r" "$r2" rpm_compare "$r" "$r2"
fi fi
done done

View File

@ -452,8 +452,18 @@ if [ ${#IMAGE_RECORDS[@]} -ne 0 ]; then
fi fi
fi fi
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# Extract helm charts and app version from the application rpm # Extract helm charts and app version from the application rpm
RPMS_DIRS="${MY_WORKSPACE}/std/rpmbuild/RPMS ${MY_REPO}/cgcs-centos-repo/Binary/noarch" RPMS_DIRS="${MY_WORKSPACE}/std/rpmbuild/RPMS ${CENTOS_REPO}/Binary/noarch"
FIND_GLOB="*.tis.noarch.rpm" FIND_GLOB="*.tis.noarch.rpm"
extract_application_rpms extract_application_rpms

View File

@ -184,6 +184,14 @@ function init_vars {
# Generate an error if the output file is below this threshold # Generate an error if the output file is below this threshold
MINIMUM_EXPECTED_SIZE=500000000 MINIMUM_EXPECTED_SIZE=500000000
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/centos-repo
fi
fi
# report variables # report variables
REPORT_FILE=$OUTPUT_DIR/report.txt REPORT_FILE=$OUTPUT_DIR/report.txt
@ -234,6 +242,11 @@ function check_vars {
exit 1 exit 1
fi fi
if [ ! -z "${CENTOS_REPO}" ] && [ ! -d ${CENTOS_REPO} ]; then
echo " Error -- directory '${CENTOS_REPO}' not found."
exit 1
fi
STX_DIR=$INTERNAL_REPO_ROOT/stx STX_DIR=$INTERNAL_REPO_ROOT/stx
printf "\nChecking that we can access $DISTRO_REPO_DIR\n" printf "\nChecking that we can access $DISTRO_REPO_DIR\n"
@ -711,11 +724,12 @@ printf "*************************\n\n"
init_vars init_vars
check_vars check_vars
DISTRO="centos" DISTRO="centos"
PKGLIST_MINIMAL="${INTERNAL_REPO_ROOT}/build-tools/build_iso/minimal_rpm_list.txt" PKGLIST_MINIMAL="${INTERNAL_REPO_ROOT}/build-tools/build_iso/minimal_rpm_list.txt"
PKGLIST_STX="${OUTPUT_DIR}/image.inc" PKGLIST_STX="${OUTPUT_DIR}/image.inc"
PKGLIST_DEV="${OUTPUT_DIR}/image-dev.inc" PKGLIST_DEV="${OUTPUT_DIR}/image-dev.inc"
PKGLIST_THIS_LAYER="${OUTPUT_DIR}/image-layer.inc" PKGLIST_THIS_LAYER="${OUTPUT_DIR}/image-layer.inc"
PKGLIST_LOWER_LAYER_DIR="${MY_REPO}/cgcs-centos-repo/layer_image_inc" PKGLIST_LOWER_LAYER_DIR="${CENTOS_REPO}/layer_image_inc"
PKGLIST_LOWER_LAYER_LIST="" PKGLIST_LOWER_LAYER_LIST=""
if [ -d ${PKGLIST_LOWER_LAYER_DIR} ]; then if [ -d ${PKGLIST_LOWER_LAYER_DIR} ]; then

View File

@ -64,6 +64,15 @@ DEP_TEST_FLAG=0
export BUILD_AVOIDANCE_URL="" export BUILD_AVOIDANCE_URL=""
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# read the options # read the options
TEMP=$(getopt -o h --long parallel,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,dep-test,append-log -n 'build-pkgs-parallel' -- "$@") TEMP=$(getopt -o h --long parallel,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,dep-test,append-log -n 'build-pkgs-parallel' -- "$@")
@ -193,7 +202,12 @@ find_targets () {
for d2 in $(grep -v '^#' $d/$centos_pkg_dirs); do for d2 in $(grep -v '^#' $d/$centos_pkg_dirs); do
name="" name=""
if [ -f $d/$d2/centos/srpm_path ]; then if [ -f $d/$d2/centos/srpm_path ]; then
path=$(cat $d/$d2/centos/srpm_path | head -n 1 | sed "s#^mirror:CentOS/tis-r3-CentOS/mitaka#$MY_REPO/cgcs-centos-repo#" | sed "s#^mirror:#$MY_REPO/cgcs-centos-repo/#" | sed "s#^repo:#$MY_REPO/#" | sed "s#^3rd_party:#$MY_REPO/cgcs-3rd-party-repo/#" | sed "s#^Source/#$MY_REPO/cgcs-centos-repo/Source/#") path=$(cat $d/$d2/centos/srpm_path | head -n 1 | \
sed -e "s#^mirror:CentOS/tis-r3-CentOS/mitaka#${CENTOS_REPO}#" \
-e "s#^mirror:#${CENTOS_REPO}/#" \
-e "s#^repo:#$MY_REPO/#" \
-e "s#^3rd_party:#$MY_REPO/cgcs-3rd-party-repo/#" \
-e "s#^Source/#${CENTOS_REPO}/Source/#")
name=$(rpm -q --qf='%{NAME}' --nosignature -p $path) name=$(rpm -q --qf='%{NAME}' --nosignature -p $path)
else else
path=$(find $d/$d2/centos/ -name '*.spec' | head -n 1) path=$(find $d/$d2/centos/ -name '*.spec' | head -n 1)

View File

@ -65,6 +65,15 @@ DEP_TEST_FLAG=0
export BUILD_AVOIDANCE_URL="" export BUILD_AVOIDANCE_URL=""
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# read the options # read the options
TEMP=$(getopt -o h --long serial,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,dep-test,append-log -n 'build-pkgs-serial' -- "$@") TEMP=$(getopt -o h --long serial,rt,std,installer,containers,layer:,edit,build-avoidance,no-build-avoidance,build-avoidance-dir:,build-avoidance-host:,build-avoidance-user:,build-avoidance-day:,no-meta-patch,no-descendants,no-required,no-build-info,no-autoclean,formal,careful,help,clean,dep-test,append-log -n 'build-pkgs-serial' -- "$@")
@ -194,7 +203,12 @@ find_targets () {
for d2 in $(grep -v '^#' $d/$centos_pkg_dirs); do for d2 in $(grep -v '^#' $d/$centos_pkg_dirs); do
name="" name=""
if [ -f $d/$d2/centos/srpm_path ]; then if [ -f $d/$d2/centos/srpm_path ]; then
path=$(cat $d/$d2/centos/srpm_path | head -n 1 | sed "s#^mirror:CentOS/tis-r3-CentOS/mitaka#$MY_REPO/cgcs-centos-repo#" | sed "s#^mirror:#$MY_REPO/cgcs-centos-repo/#" | sed "s#^repo:#$MY_REPO/#" | sed "s#^3rd_party:#$MY_REPO/cgcs-3rd-party-repo/#" | sed "s#^Source/#$MY_REPO/cgcs-centos-repo/Source/#") path=$(cat $d/$d2/centos/srpm_path | head -n 1 | \
sed -e "s#^mirror:CentOS/tis-r3-CentOS/mitaka#${CENTOS_REPO}#" \
-e "s#^mirror:#${CENTOS_REPO}/#" \
-e "s#^repo:#$MY_REPO/#" \
-e "s#^3rd_party:#$MY_REPO/cgcs-3rd-party-repo/#" \
-e "s#^Source/#${CENTOS_REPO}/Source/#")
name=$(rpm -q --qf='%{NAME}' --nosignature -p $path) name=$(rpm -q --qf='%{NAME}' --nosignature -p $path)
else else
path=$(find $d/$d2/centos/ -name '*.spec' | head -n 1) path=$(find $d/$d2/centos/ -name '*.spec' | head -n 1)

View File

@ -2161,8 +2161,17 @@ for n in ${SRPMS_TO_COMPILE[@]}; do
done done
echo echo
CENTOS_REPO=centos-repo
if [ ! -d ${MY_REPO}/${CENTOS_REPO} ]; then
CENTOS_REPO=cgcs-centos-repo
if [ ! -d ${MY_REPO}/${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
if [ $CLEAN_FLAG -eq 0 ]; then if [ $CLEAN_FLAG -eq 0 ]; then
update_cgcs_repo cgcs-centos-repo update_cgcs_repo ${CENTOS_REPO}
if [ -d $MY_REPO/cgcs-3rd-party-repo ]; then if [ -d $MY_REPO/cgcs-3rd-party-repo ]; then
update_cgcs_repo cgcs-3rd-party-repo update_cgcs_repo cgcs-3rd-party-repo
fi fi

View File

@ -1924,8 +1924,17 @@ for n in ${SRPMS_TO_COMPILE[@]}; do
done done
echo echo
CENTOS_REPO=centos-repo
if [ ! -d ${MY_REPO}/${CENTOS_REPO} ]; then
CENTOS_REPO=cgcs-centos-repo
if [ ! -d ${MY_REPO}/${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
if [ $CLEAN_FLAG -eq 0 ]; then if [ $CLEAN_FLAG -eq 0 ]; then
update_cgcs_repo cgcs-centos-repo update_cgcs_repo ${CENTOS_REPO}
if [ -d $MY_REPO/cgcs-3rd-party-repo ]; then if [ -d $MY_REPO/cgcs-3rd-party-repo ]; then
update_cgcs_repo cgcs-3rd-party-repo update_cgcs_repo cgcs-3rd-party-repo
fi fi

View File

@ -46,7 +46,16 @@ FILES_PATH="$DISTRO/files"
PATCHES_PATH="$DISTRO/patches" PATCHES_PATH="$DISTRO/patches"
ORIG_SPECS_PATH="$DISTRO" ORIG_SPECS_PATH="$DISTRO"
SRPM_LIST_PATH="$DISTRO/srpm_path" SRPM_LIST_PATH="$DISTRO/srpm_path"
MIRROR_ROOT="$MY_REPO/cgcs-${DISTRO}-repo"
MIRROR_ROOT="$MY_REPO/${DISTRO}-repo"
if [ ! -d ${MIRROR_ROOT} ]; then
# Old value... a temporary measure for backward compatibility
MIRROR_ROOT="$MY_REPO/cgcs-${DISTRO}-repo"
if [ ! -d ${MIRROR_ROOT} ]; then
MIRROR_ROOT="$MY_REPO/${DISTRO}-repo"
fi
fi
THIRD_PARTY_ROOT="$MY_REPO/cgcs-3rd-party-repo" THIRD_PARTY_ROOT="$MY_REPO/cgcs-3rd-party-repo"
REPO_DOWNLOADS_ROOT="$MY_REPO" REPO_DOWNLOADS_ROOT="$MY_REPO"
SRPM_REBUILT_LIST="" SRPM_REBUILT_LIST=""
@ -269,6 +278,7 @@ export CCACHE_DIR="$BUILD_ROOT/.ccache"
export SRC_BASE="$SRC_ROOT" export SRC_BASE="$SRC_ROOT"
export STX_BASE="$SRC_BASE/stx" export STX_BASE="$SRC_BASE/stx"
export CGCS_BASE="$STX_BASE" export CGCS_BASE="$STX_BASE"
export DISTRO_REPO_BASE=$MIRROR_ROOT
export SPECS_BASE="$ORIG_SPECS_PATH" export SPECS_BASE="$ORIG_SPECS_PATH"
export FILES_BASE="$FILES_PATH" export FILES_BASE="$FILES_PATH"
export PATCHES_BASE="$PATCHES_PATH" export PATCHES_BASE="$PATCHES_PATH"

View File

@ -47,7 +47,16 @@ FILES_PATH="$DISTRO/files"
PATCHES_PATH="$DISTRO/patches" PATCHES_PATH="$DISTRO/patches"
ORIG_SPECS_PATH="$DISTRO" ORIG_SPECS_PATH="$DISTRO"
SRPM_LIST_PATH="$DISTRO/srpm_path" SRPM_LIST_PATH="$DISTRO/srpm_path"
MIRROR_ROOT="$MY_REPO/cgcs-${DISTRO}-repo"
MIRROR_ROOT="$MY_REPO/${DISTRO}-repo"
if [ ! -d ${MIRROR_ROOT} ]; then
# Old value... a temporary measure for backward compatibility
MIRROR_ROOT="$MY_REPO/cgcs-${DISTRO}-repo"
if [ ! -d ${MIRROR_ROOT} ]; then
MIRROR_ROOT="$MY_REPO/${DISTRO}-repo"
fi
fi
THIRD_PARTY_ROOT="$MY_REPO/cgcs-3rd-party-repo" THIRD_PARTY_ROOT="$MY_REPO/cgcs-3rd-party-repo"
REPO_DOWNLOADS_ROOT="$MY_REPO" REPO_DOWNLOADS_ROOT="$MY_REPO"
SRPM_REBUILT_LIST="" SRPM_REBUILT_LIST=""
@ -255,6 +264,7 @@ export CCACHE_DIR="$BUILD_ROOT/.ccache"
export SRC_BASE="$SRC_ROOT" export SRC_BASE="$SRC_ROOT"
export STX_BASE="$SRC_BASE/stx" export STX_BASE="$SRC_BASE/stx"
export CGCS_BASE="$STX_BASE" export CGCS_BASE="$STX_BASE"
export DISTRO_REPO_BASE=$MIRROR_ROOT
export SPECS_BASE="$ORIG_SPECS_PATH" export SPECS_BASE="$ORIG_SPECS_PATH"
export FILES_BASE="$FILES_PATH" export FILES_BASE="$FILES_PATH"
export PATCHES_BASE="$PATCHES_PATH" export PATCHES_BASE="$PATCHES_PATH"

View File

@ -84,12 +84,22 @@ fi
source ${MY_REPO}/build-tools/git-utils.sh source ${MY_REPO}/build-tools/git-utils.sh
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
function get_wheels_files { function get_wheels_files {
find ${GIT_LIST} -maxdepth 1 -name "${OS}_${BUILD_STREAM}_wheels.inc" find ${GIT_LIST} -maxdepth 1 -name "${OS}_${BUILD_STREAM}_wheels.inc"
} }
function get_lower_layer_wheels_files { function get_lower_layer_wheels_files {
find ${MY_REPO}/cgcs-centos-repo/layer_wheels_inc -maxdepth 1 -name "*_${OS}_${BUILD_STREAM}_wheels.inc" find ${CENTOS_REPO}/layer_wheels_inc -maxdepth 1 -name "*_${OS}_${BUILD_STREAM}_wheels.inc"
} }
function find_wheel_rpm { function find_wheel_rpm {
@ -97,7 +107,7 @@ function find_wheel_rpm {
local repo= local repo=
for repo in ${MY_WORKSPACE}/std/rpmbuild/RPMS \ for repo in ${MY_WORKSPACE}/std/rpmbuild/RPMS \
${MY_REPO}/cgcs-centos-repo/Binary; do ${CENTOS_REPO}/Binary; do
if [ -d $repo ]; then if [ -d $repo ]; then
find $repo -name "${wheel}-[^-]*-[^-]*[.][^.]*[.]rpm" find $repo -name "${wheel}-[^-]*-[^-]*[.][^.]*[.]rpm"
fi fi

View File

@ -5,12 +5,22 @@ if [ $? -ne 0 ]; then
CREATEREPO="createrepo" CREATEREPO="createrepo"
fi fi
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# If a file listed in list.txt is missing, this function attempts to find the # If a file listed in list.txt is missing, this function attempts to find the
# RPM and copy it to the local directory. This should not be required normally # RPM and copy it to the local directory. This should not be required normally
# and is only used when collecting the source RPMs initially. # and is only used when collecting the source RPMs initially.
function findSrc { function findSrc {
local lookingFor=$1 local lookingFor=$1
find $MY_REPO/cgcs-centos-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' . find ${CENTOS_REPO}/Source -name $lookingFor | xargs -I '{}' cp '{}' .
find $MY_REPO/cgcs-tis-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' . find $MY_REPO/cgcs-tis-repo/Source -name $lookingFor | xargs -I '{}' cp '{}' .
find $MY_WORKSPACE/std/rpmbuild/SRPMS -name $lookingFor | xargs -I '{}' cp '{}' . find $MY_WORKSPACE/std/rpmbuild/SRPMS -name $lookingFor | xargs -I '{}' cp '{}' .
} }

View File

@ -1,54 +0,0 @@
#!/bin/bash
DEST_DIR="$MY_REPO/cgcs-centos-repo"
ORIGIN="$DEST_DIR/origin"
CREATEREPO=$(which createrepo_c)
if [ $? -ne 0 ]; then
CREATEREPO="createrepo"
fi
if [ ! -f $ORIGIN ]; then
echo "ERROR: file not found '$ORIGIN'"
exit -1
fi
ORIGIN_DIR=$(cat $MY_REPO/cgcs-centos-repo/origin | grep -v '^#' | head -n 1)
if [ ! -d $ORIGIN_DIR ]; then
echo "ERROR: directory not found '$ORIGIN_DIR'"
exit -1
fi
echo "ORIGIN_DIR=$ORIGIN_DIR"
for d in $(find $ORIGIN_DIR -type d | tail -n +2); do
RELATIVE_DIR=$(echo $d | sed "s#^$ORIGIN_DIR/##")
if [ -d $DEST_DIR/$RELATIVE_DIR ]; then
rm -rf $DEST_DIR/$RELATIVE_DIR/*
fi
mkdir -p $DEST_DIR/$RELATIVE_DIR
done
for d in $(find $ORIGIN_DIR -type d | tail -n +2); do
for f in $(find $d -maxdepth 1 -type f); do
RELATIVE_FILE=$(echo $f | sed "s#^$ORIGIN_DIR/##")
if [ -e "$DEST_DIR/$RELATIVE_FILE" ]; then
rm -f "$DEST_DIR/$RELATIVE_FILE"
fi
ln -s $f "$DEST_DIR/$RELATIVE_FILE"
done
done
for d in `find -L $DEST_DIR -type d -name repodata`; do
(cd $d/..
cp -L -f repodata/*comps*xml comps.xml
rm -rf repodata
if [ -f comps.xml ]; then
$CREATEREPO -g comps.xml --workers $(cat /usr/bin/nproc) $(pwd)
else
$CREATEREPO --workers $(cat /usr/bin/nproc) $(pwd)
fi
)
done

View File

@ -30,11 +30,21 @@ MY_YUM_CONF="$MY_WORKSPACE/yum.conf"
YUM_DIR="$MY_WORKSPACE/yum" YUM_DIR="$MY_WORKSPACE/yum"
YUM_CACHE="$YUM_DIR/cache" YUM_CACHE="$YUM_DIR/cache"
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# Try to find a layer specific mock.cfg.proto # Try to find a layer specific mock.cfg.proto
MOCK_CFG_PROTO="$MY_REPO/cgcs-centos-repo/mock.cfg.${LAYER}.proto" MOCK_CFG_PROTO="${CENTOS_REPO}/mock.cfg.${LAYER}.proto"
if [ ! -f "$MOCK_CFG_PROTO" ]; then if [ ! -f "$MOCK_CFG_PROTO" ]; then
# Not present, Use default mock.cfg.proto # Not present, Use default mock.cfg.proto
MOCK_CFG_PROTO="$MY_REPO/cgcs-centos-repo/mock.cfg.proto" MOCK_CFG_PROTO="${CENTOS_REPO}/mock.cfg.proto"
fi fi

View File

@ -8,7 +8,7 @@
# #
# Create a RPM dependency cache frpm the RPMS found in # Create a RPM dependency cache frpm the RPMS found in
# 1) $MY_REPO/cgcs-centos-repo # 1) $MY_REPO/centos-repo
# 2) $MY_WORKSPACE/$BUILD_TYPE/rpmbuild/ # 2) $MY_WORKSPACE/$BUILD_TYPE/rpmbuild/
# #
# Cache files are written to $MY_REPO/cgcs-tis-repo/dependancy-cache # Cache files are written to $MY_REPO/cgcs-tis-repo/dependancy-cache
@ -66,7 +66,6 @@ if not os.path.isdir(repodata_dir):
sys.exit(1) sys.exit(1)
publish_cache_dir="%s/cgcs-tis-repo/dependancy-cache" % os.environ['MY_REPO'] publish_cache_dir="%s/cgcs-tis-repo/dependancy-cache" % os.environ['MY_REPO']
centos_repo_dir="%s/cgcs-centos-repo" % os.environ['MY_REPO']
workspace_repo_dirs={} workspace_repo_dirs={}
for rt in rpm_types: for rt in rpm_types:
@ -78,9 +77,15 @@ if not os.path.isdir(os.environ['MY_REPO']):
print("ERROR: directory not found MY_REPO=%s" % os.environ['MY_REPO']) print("ERROR: directory not found MY_REPO=%s" % os.environ['MY_REPO'])
sys.exit(1) sys.exit(1)
centos_repo_dir="%s/centos-repo" % os.environ['MY_REPO']
if not os.path.isdir(centos_repo_dir): if not os.path.isdir(centos_repo_dir):
print("ERROR: directory not found %s" % centos_repo_dir) # Test for the old path
sys.exit(1) centos_repo_dir="%s/cgcs-centos-repo" % os.environ['MY_REPO']
if not os.path.isdir(centos_repo_dir):
# That doesn't exist either
centos_repo_dir="%s/centos-repo" % os.environ['MY_REPO']
print("ERROR: directory not found %s" % centos_repo_dir)
sys.exit(1)
bin_rpm_mirror_roots = ["%s/Binary" % centos_repo_dir] bin_rpm_mirror_roots = ["%s/Binary" % centos_repo_dir]
src_rpm_mirror_roots = ["%s/Source" % centos_repo_dir] src_rpm_mirror_roots = ["%s/Source" % centos_repo_dir]

View File

@ -351,7 +351,14 @@ class IPReport(object):
fullpath = None fullpath = None
filename = filename.replace('mirror:', self.repo + '/cgcs-centos-repo/') # Old or new location of centos repo?
if os.path.isdir(self.repo + '/centos-repo/'):
filename = filename.replace('mirror:', self.repo + '/centos-repo/')
elif os.path.isdir(self.repo + '/cgts-centos-repo/'):
filename = filename.replace('mirror:', self.repo + '/cgcs-centos-repo/')
else:
filename = filename.replace('mirror:', self.repo + '/centos-repo/')
filename = filename.replace('repo:', self.repo + '/') filename = filename.replace('repo:', self.repo + '/')
filename = filename.replace('3rd_party:', self.repo + '/cgcs-3rd-party-repo/') filename = filename.replace('3rd_party:', self.repo + '/cgcs-3rd-party-repo/')

View File

@ -1,229 +0,0 @@
#!/bin/bash
if [ "$USER" != "jenkins" ]; then
echo "ERROR: only jenkins should run this"
return 1
fi
CENTOS_BASE_VERSION=7.2.1511
EPEL_BASE_VERSION=7
BIN_ARCH=x86_64
BIN_DIRS="/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/updates/x86_64
/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/cloud/x86_64/openstack-mitaka
/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/os/x86_64
/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/extras/x86_64
/export/jenkins/mirrors/fedora/epel/$EPEL_BASE_VERSION/x86_64
"
SRC_DIRS="/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/updates/Source
/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/cloud/Source/openstack-mitaka
/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/os/Source
/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/extras/Source
/export/jenkins/mirrors/fedora/dl.fedoraproject.org/pub/epel/$EPEL_BASE_VERSION/SRPMS
"
TESTING_BIN_DIRS="/export/jenkins/mirrors/fedora/epel/testing/7/x86_64
"
TESTING_SRC_DIRS="/export/jenkins/mirrors/dl.fedoraproject.org/pub/epel/testing/7/SRPMS
"
BIN_ARCH=x86_64
NEW_DIR="/export/jenkins/mirrors/CentOS/tis-r3-CentOS/mitaka"
BACKUP_DIR="/export/jenkins/mirrors/CentOS/tis-r3-CentOS/mitaka.old"
CREATEREPO=$(which createrepo_c)
if [ $? -ne 0 ]; then
CREATEREPO="createrepo"
fi
if [ -d $BACKUP_DIR ]; then
rm -rf $BACKUP_DIR
fi
cp -r $NEW_DIR $BACKUP_DIR
BIN_DEST="$NEW_DIR/Binary"
SRC_DEST="$NEW_DIR/Source"
LOG_DEST="$NEW_DIR/Data"
DATA_DEST="$NEW_DIR/Data"
mkdir -p $BIN_DEST $SRC_DEST $LOG_DEST
WHITE_LIST_FILE="$DATA_DIR/white_list.txt"
BLACK_LIST_FILE="$DATA_DIR/black_list.txt"
OBSOLETE_LOG="$LOG_DEST/obsolete.log"
NO_SOURCERPM_LOG="$LOG_DEST/no_sourcerpm.log"
SOURCERPM_NOT_FOUND_LOG="$LOG_DEST/sourcerpm_not_found.log"
BIN_COPY_LOG="$LOG_DEST/bin_copy.log"
SRC_COPY_LOG="$LOG_DEST/src_copy.log"
NO_INSTALLED_COPY="$LOG_DEST/installed_copy.log"
BLACKLISTED_LOG="$LOG_DEST/blacklisted.log"
WHITELISTED_LOG="$LOG_DEST/whitelisted.log"
rm -f $OBSOLETE_LOG $NO_SOURCERPM_LOG $SOURCERPM_NOT_FOUND_LOG $BIN_COPY_LOG $SRC_COPY_LOG $NO_INSTALLED_COPY $BLACKLISTED_LOG $WHITELISTED_LOG
LAST_INSTALLED_NAME=""
LAST_NAME=""
NAME=""
# The following is similar to a find for *.rpm files,
# but we transform the path into <name_and_version>#<filename>#<directory_name> .
# Then do a reverse 'version' sort, so that the newest version
# of the rpm appears first, no matter what directory it originates from.
for dat in $((for bd in `echo $BIN_DIRS`; do
for br in $(find $bd/ -name '*.rpm' ); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done
done) | sort -r -V)
do
b=$(echo "$dat" | awk -F '#' '{ print $2 }')
d=$(echo "$dat" | awk -F '#' '{ print $3 }')
br="$d/$b"
echo $br
MATCH=$(grep "^$b" $BLACK_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "$bs" >> $BLACKLISTED_LOG
continue
fi
SOURCERPM=$(rpm -q --queryformat='%{SOURCERPM}' -p $br --nosignature)
if [ "x$SOURCERPM" != "x" ]; then
MATCH=$(grep "^$SOURCERPM" $BLACK_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "$bs" >> $BLACKLISTED_LOG
echo "$SOURCERPM" >> $BLACKLISTED_LOG
continue
fi
fi
ARCH=$(rpm -q --queryformat='%{ARCH}' -p $br --nosignature)
LAST_NAME="$NAME"
NAME=$(rpm -q --queryformat='%{NAME}' -p $br --nosignature)
if [ "$NAME" != "$LAST_NAME" ] && [ "$LAST_NAME" != "$LAST_INSTALLED_NAME" ]; then
echo "$LAST_NAME" >> $NO_INSTALLED_COPY
fi
if [ "$ARCH" == "$BIN_ARCH" ] || [ "$ARCH" == "noarch" ]; then
if [ "$NAME" != "$LAST_INSTALLED_NAME" ]; then
if [ "x$SOURCERPM" != "x" ]; then
bs=$(find $SRC_DIRS -name $SOURCERPM | head -n 1)
if [ "x$bs" != "x" ]; then
mkdir -p $BIN_DEST/$ARCH
if [ ! -f $BIN_DEST/$ARCH/$b ]; then
cp -v $br $BIN_DEST/$ARCH/
echo "$br" >> $BIN_COPY_LOG
fi
if [ ! -f $SRC_DEST/$SOURCERPM ]; then
cp -v $bs $SRC_DEST/
echo "$bs" >> $SRC_COPY_LOG
fi
LAST_INSTALLED_NAME=$NAME
else
echo "$SOURCERPM not found"
echo "$br" >> $SOURCERPM_NOT_FOUND_LOG
fi
else
echo "no SOURCERPM for $br"
echo "$br" >> $NO_SOURCERPM_LOG
fi
else
echo "$br is obsolete"
echo "$br" >> $OBSOLETE_LOG
fi
fi
done
for dat in $((for bd in $(echo $BIN_DIRS; echo $TESTING_BIN_DIRS); do
for br in $(find $bd/ -name '*.rpm'); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done
done) | sort -r -V)
do
b=$(echo "$dat" | awk -F '#' '{ print $2 }')
d=$(echo "$dat" | awk -F '#' '{ print $3 }')
br="$d/$b"
echo $br
MATCH=$(grep "^$b" $WHITE_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "$bs" >> $WHITELISTED_LOG
else
continue
fi
SOURCERPM=$(rpm -q --queryformat='%{SOURCERPM}' -p $br --nosignature)
if [ "x$SOURCERPM" != "x" ]; then
grep "^$SOURCERPM" $WHITE_LIST_FILE >> /dev/null || true
if [ $? -eq 0 ]; then
echo "$bs" >> $WHITELISTED_LOG
echo "$SOURCERPM" >> $WHITELISTED_LOG
else
continue
fi
fi
ARCH=$(rpm -q --queryformat='%{ARCH}' -p $br --nosignature)
LAST_NAME="$NAME"
NAME=$(rpm -q --queryformat='%{NAME}' -p $br --nosignature)
if [ "$NAME" != "$LAST_NAME" ] && [ "$LAST_NAME" != "$LAST_INSTALLED_NAME" ]; then
echo "$LAST_NAME" >> $NO_INSTALLED_COPY
fi
if [ "$ARCH" == "$BIN_ARCH" ] || [ "$ARCH" == "noarch" ]; then
if [ "$NAME" != "$LAST_INSTALLED_NAME" ]; then
if [ "x$SOURCERPM" != "x" ]; then
bs=$(find $SRC_DIRS $TESTING_SRC_DIRS -name $SOURCERPM | head -n 1)
if [ "x$bs" != "x" ]; then
mkdir -p $BIN_DEST/$ARCH
if [ ! -f $BIN_DEST/$ARCH/$b ]; then
cp -v $br $BIN_DEST/$ARCH/
echo "$br" >> $BIN_COPY_LOG
fi
if [ ! -f $SRC_DEST/$SOURCERPM ]; then
cp -v $bs $SRC_DEST/
echo "$bs" >> $SRC_COPY_LOG
fi
LAST_INSTALLED_NAME=$NAME
else
echo "$SOURCERPM not found"
echo "$br" >> $SOURCERPM_NOT_FOUND_LOG
fi
else
echo "no SOURCERPM for $br"
echo "$br" >> $NO_SOURCERPM_LOG
fi
else
echo "$br is obsolete"
echo "$br" >> $OBSOLETE_LOG
fi
fi
done
repodata_update () {
DIR=${1}
(
cd $DIR
for d in `find -L . -type d -name repodata`; do
(cd $d/..
for c in $(find repodata -name '*comps*xml'); do
mv -f $c comps.xml
done
rm -rf repodata
if [ -f comps.xml ]; then
$CREATEREPO -g comps.xml --workers $(cat /usr/bin/nproc) $(pwd)
else
$CREATEREPO --workers $(cat /usr/bin/nproc) $(pwd)
fi
)
done
)
return 0
}
repodata_update $SRC_DEST
repodata_update $BIN_DEST

View File

@ -1,216 +0,0 @@
#!/bin/bash
if [ "$USER" != "jenkins" ]; then
echo "ERROR: only jenkins should run this"
return 1
fi
CENTOS_BASE_VERSION=7.2.1511
EPEL_BASE_VERSION=7
BIN_ARCH=x86_64
BIN_DIRS="/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/updates/x86_64
/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/cloud/x86_64/openstack-mitaka
/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/os/x86_64
/export/jenkins/mirrors/CentOS/$CENTOS_BASE_VERSION/extras/x86_64
/export/jenkins/mirrors/fedora/epel/$EPEL_BASE_VERSION/x86_64
"
SRC_DIRS="/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/updates/Source
/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/cloud/Source/openstack-mitaka
/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/os/Source
/export/jenkins/mirrors/CentOS/vault.centos.org/$CENTOS_BASE_VERSION/extras/Source
/export/jenkins/mirrors/fedora/dl.fedoraproject.org/pub/epel/$EPEL_BASE_VERSION/SRPMS
"
TESTING_BIN_DIRS="/export/jenkins/mirrors/fedora/epel/testing/7/x86_64
"
TESTING_SRC_DIRS="/export/jenkins/mirrors/dl.fedoraproject.org/pub/epel/testing/7/SRPMS
"
ORIG_DIR="/export/jenkins/mirrors/CentOS/tis-r3-CentOS/mitaka"
NEW_DIR="/export/jenkins/mirrors/CentOS/tis-r3-CentOS/mitaka-2"
cp -r $ORIG_DIR $NEW_DIR
BIN_DEST="$NEW_DIR/Binary"
SRC_DEST="$NEW_DIR/Source"
LOG_DEST="$NEW_DIR/Data"
DATA_DEST="$NEW_DIR/Data"
rm -rf $LOG_DEST
mkdir -p $BIN_DEST $SRC_DEST $LOG_DEST
WHITE_LIST_FILE="$DATA_DIR/white_list.txt"
BLACK_LIST_FILE="$DATA_DIR/black_list.txt"
OBSOLETE_LOG="$LOG_DEST/obsolete.log"
NO_SOURCERPM_LOG="$LOG_DEST/no_sourcerpm.log"
SOURCERPM_NOT_FOUND_LOG="$LOG_DEST/sourcerpm_not_found.log"
BIN_COPY_LOG="$LOG_DEST/bin_copy.log"
SRC_COPY_LOG="$LOG_DEST/src_copy.log"
NO_INSTALLED_COPY="$LOG_DEST/installed_copy.log"
BLACKLISTED_LOG="$LOG_DEST/blacklisted.log"
WHITELISTED_LOG="$LOG_DEST/whitelisted.log"
rm -f $OBSOLETE_LOG $NO_SOURCERPM_LOG $SOURCERPM_NOT_FOUND_LOG $BIN_COPY_LOG $SRC_COPY_LOG $NO_INSTALLED_COPY $BLACKLISTED_LOG $WHITELISTED_LOG
LAST_INSTALLED_NAME=""
LAST_NAME=""
NAME=""
# The following is similar to a find for *.rpm files,
# but we transform the path into <name_and_version>#<filename>#<directory_name> .
# Then do a reverse 'version' sort, so that the newest version
# of the rpm appears first, no matter what directory it originates from.
for dat in $((for bd in `echo $BIN_DIRS`; do
for br in $(find $bd/ -name '*.rpm' ); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done
done) | sort -r -V)
do
b=$(echo "$dat" | awk -F '#' '{ print $2 }')
d=$(echo "$dat" | awk -F '#' '{ print $3 }')
br="$d/$b"
echo $br
MATCH=$(grep "^$b" $BLACK_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "$bs" >> $BLACKLISTED_LOG
continue
fi
SOURCERPM=$(rpm -q --queryformat='%{SOURCERPM}' -p $br --nosignature)
if [ "x$SOURCERPM" != "x" ]; then
MATCH=$(grep "^$SOURCERPM" $BLACK_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "$bs" >> $BLACKLISTED_LOG
echo "$SOURCERPM" >> $BLACKLISTED_LOG
continue
fi
fi
ARCH=$(rpm -q --queryformat='%{ARCH}' -p $br --nosignature)
LAST_NAME="$NAME"
NAME=$(rpm -q --queryformat='%{NAME}' -p $br --nosignature)
if [ "$NAME" != "$LAST_NAME" ] && [ "$LAST_NAME" != "$LAST_INSTALLED_NAME" ]; then
echo "$LAST_NAME" >> $NO_INSTALLED_COPY
fi
if [ "$ARCH" == "$BIN_ARCH" ] || [ "$ARCH" == "noarch" ]; then
if [ "$NAME" != "$LAST_INSTALLED_NAME" ]; then
if [ "x$SOURCERPM" != "x" ]; then
bs=$(find $SRC_DIRS -name $SOURCERPM | head -n 1)
if [ "x$bs" != "x" ]; then
mkdir -p $BIN_DEST/$ARCH
if [ ! -f $BIN_DEST/$ARCH/$b ]; then
cp -v $br $BIN_DEST/$ARCH/
echo "$br" >> $BIN_COPY_LOG
fi
if [ ! -f $SRC_DEST/$SOURCERPM ]; then
cp -v $bs $SRC_DEST/
echo "$bs" >> $SRC_COPY_LOG
fi
LAST_INSTALLED_NAME=$NAME
else
echo "$SOURCERPM not found"
echo "$br" >> $SOURCERPM_NOT_FOUND_LOG
fi
else
echo "no SOURCERPM for $br"
echo "$br" >> $NO_SOURCERPM_LOG
fi
else
echo "$br is obsolete"
echo "$br" >> $OBSOLETE_LOG
fi
fi
done
for dat in $((for bd in $(echo $BIN_DIRS; echo $TESTING_BIN_DIRS); do
for br in $(find $bd/ -name '*.rpm'); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done
done) | sort -r -V)
do
b=$(echo "$dat" | awk -F '#' '{ print $2 }')
d=$(echo "$dat" | awk -F '#' '{ print $3 }')
br="$d/$b"
echo $br
MATCH=$(grep "^$b" $WHITE_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "$bs" >> $WHITELISTED_LOG
else
continue
fi
SOURCERPM=$(rpm -q --queryformat='%{SOURCERPM}' -p $br --nosignature)
if [ "x$SOURCERPM" != "x" ]; then
grep "^$SOURCERPM" $WHITE_LIST_FILE >> /dev/null || true
if [ $? -eq 0 ]; then
echo "$bs" >> $WHITELISTED_LOG
echo "$SOURCERPM" >> $WHITELISTED_LOG
else
continue
fi
fi
ARCH=$(rpm -q --queryformat='%{ARCH}' -p $br --nosignature)
LAST_NAME="$NAME"
NAME=$(rpm -q --queryformat='%{NAME}' -p $br --nosignature)
if [ "$NAME" != "$LAST_NAME" ] && [ "$LAST_NAME" != "$LAST_INSTALLED_NAME" ]; then
echo "$LAST_NAME" >> $NO_INSTALLED_COPY
fi
if [ "$ARCH" == "$BIN_ARCH" ] || [ "$ARCH" == "noarch" ]; then
if [ "$NAME" != "$LAST_INSTALLED_NAME" ]; then
if [ "x$SOURCERPM" != "x" ]; then
bs=$(find $SRC_DIRS $TESTING_SRC_DIRS -name $SOURCERPM | head -n 1)
if [ "x$bs" != "x" ]; then
mkdir -p $BIN_DEST/$ARCH
if [ ! -f $BIN_DEST/$ARCH/$b ]; then
cp -v $br $BIN_DEST/$ARCH/
echo "$br" >> $BIN_COPY_LOG
fi
if [ ! -f $SRC_DEST/$SOURCERPM ]; then
cp -v $bs $SRC_DEST/
echo "$bs" >> $SRC_COPY_LOG
fi
LAST_INSTALLED_NAME=$NAME
else
echo "$SOURCERPM not found"
echo "$br" >> $SOURCERPM_NOT_FOUND_LOG
fi
else
echo "no SOURCERPM for $br"
echo "$br" >> $NO_SOURCERPM_LOG
fi
else
echo "$br is obsolete"
echo "$br" >> $OBSOLETE_LOG
fi
fi
done
TMP_DIR=$(mktemp -d /tmp/copy_external_mirror_to_tis_mirror_XXXXXX)
if [ $? -ne 0 ]; then
echo "Failed to create temporary directory"
return 1
fi
(cd $ORIG_DIR; find . | sort -V > $TMP_DIR/pre)
(cd $NEW_DIR; find . | sort -V > $TMP_DIR/post)
echo "Listing deletions"
diff $TMP_DIR/pre $TMP_DIR/post | grep -v '^< ./Data/' | grep '^<'
if [ $? -eq 0 ]; then
echo
echo "Cowardly refusing to alter $ORIG_DIR due to deletions: please see $NEW_DIR"
return 1
fi
mv -f $ORIG_DIR $ORIG_DIR.old
mv -f $NEW_DIR $ORIG_DIR
rm -rf $TMP_DIR
return 0

View File

@ -1,225 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# This step updates Binary links, and adds Source links
#
MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/newton
BIN_ROOT=$MIRROR_ROOT/Binary
SRC_ROOT=$MIRROR_ROOT/Source
BLACK_LIST_FILE=$MIRROR_ROOT/Data/black_list.txt
WHITE_LIST_FILE=$MIRROR_ROOT/Data/white_list.txt
cd $MY_REPO/cgcs-centos-repo
if [ $? -ne 0 ]; then
echo 'ERROR: failed to cd to $MY_REPO/cgcs-centos-repo'
return 1
fi
names=' '
snames=' '
do_work () {
dat=${1}
b=$(echo "$dat" | awk -F '#' '{ print $2 }')
d=$(echo "$dat" | awk -F '#' '{ print $3 }')
r="$d/$b"
DEBUG_INFO=0
MATCH=$(echo $b | grep '[-]debuginfo-')
if [ "$MATCH" != "" ]; then
DEBUG_INFO=1
fi
MATCH=$(grep "^$b" $BLACK_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "NOTE: '$b' is black listed"
continue
fi
if [ $DEBUG_INFO -eq 1 ]; then
sb=$(rpm -q --info --nosignature -p $r | grep '^Source RPM : ' | sed 's#^Source RPM : ##')
if [ "x$sb" == "x" ]; then
echo "ERROR: no source rpm listed for '$b'"
continue
fi
s=$(find Source -name "$sb")
if [ "x$s" == "x" ]; then
echo "NOTE: no source rpm '$sb' found for '$b'"
continue
fi
fi
name=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $r)
MATCH=$(grep "^$b" $WHITE_LIST_FILE || true)
if [ "$MATCH" == "" ]; then
# Not white listed, check for python2 alternative
# python-rpm-macros-3-6.1 is a notable case white_list case...
# We need BOTH python-rpm-macros-3-6.1 and python2-rpm-macros-3-6.1
# so substituting python-rpm-macros-3-6.1 with python2-rpm-macros-3-6.1 is an error
altname=$(echo $name | sed 's#^python-#python2-#')
if [ "$altname" != "$name" ]; then
# look for python2 alternative
sb=$(rpm -q --info --nosignature -p $r | grep '^Source RPM : ' | sed 's#^Source RPM : ##')
if [ "x$sb" != "x" ]; then
MATCH=$(grep "^$sb" $BLACK_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "NOTE: '$sb' is black listed, so '$b' is ignored"
continue
fi
fi
for dat2 in $(for br in $(find $BIN_ROOT -name "$altname-*.rpm" | grep -v '.src.rpm$' | grep -v '[-]debuginfo-'); do
ddd=$(dirname $br)
bbb=$(basename $br)
sss=$(echo $bbb | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$sss#$bbb#$ddd"
done | sort -r -V)
do
b2=$(echo "$dat2" | awk -F '#' '{ print $2 }')
d2=$(echo "$dat2" | awk -F '#' '{ print $3 }')
r2="$d2/$b2"
name2=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $r2)
if [ "$name2" != "$altname" ]; then
continue
fi
sb2=$(rpm -q --info --nosignature -p $r2 | grep '^Source RPM : ' | sed 's#^Source RPM : ##')
# if [ "$sb" == "$sb2" ]; then
# continue
# fi
sbs=$(echo $sb | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
sbs2=$(echo $sb2 | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
newer=$((echo $sbs; echo $sbs2) | sort -r -V | head -n 1)
if [ "$sbs" != "$sbs2" ]; then
if [ "$newer" == "$sbs2" ]; then
# swap alternate for original
for link in $(find Binary -name $b); do
echo "SUGGEST: rm $link"
git rm -f $link
done
r=$r2
name=$name2
b=$b2
break
fi
fi
done
fi
fi
echo "$names" | grep " $name " >> /dev/null
if [ $? -ne 0 ]; then
sb=$(rpm -q --info --nosignature -p $r | grep '^Source RPM : ' | sed 's#^Source RPM : ##')
if [ "x$sb" == "x" ]; then
echo "ERROR: no source rpm listed for '$b'"
continue
fi
s=$(find $SRC_ROOT -name "$sb")
if [ "x$s" == "x" ]; then
echo "ERROR: no source rpm '$sb' found for '$b'"
continue
fi
if [ "x$sb" != "x" ]; then
MATCH=$(grep "^$sb" $BLACK_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
echo "NOTE: '$sb' is black listed, so '$b' is ignored"
continue
fi
fi
sname=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $s)
lb=$(find Binary -name "$b")
if [ "x$lb" == "x" ]; then
echo "MISSING: '$b'"
link=$(echo $r | sed "s#^$MIRROR_ROOT/##")
echo "SUGGEST: ln -s $r $link"
ln -s $r $link
git add $link
else
echo "OK: '$b'"
fi
for r2 in $(find Binary -name "$name-*.rpm"); do
b2=$(basename $r2)
if [ "$b" != "$b2" ]; then
name2=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $r2)
if [ "$name" == "$name2" ]; then
MATCH=$(grep "^$b2" $WHITE_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
link=$(echo $r2 | sed "s#^$MIRROR_ROOT/##")
echo "SUGGEST: rm $link"
git rm -f $link
fi
fi
fi
done
if [ $DEBUG_INFO -eq 0 ]; then
# Not a debuginfo therefore we can pull in new src.rpm
names="${names}${name} "
lsb=$(find Source -name "$sb")
if [ "x$lsb" == "x" ]; then
echo "MISSING: '$sb'"
link=$(echo $s | sed "s#^$MIRROR_ROOT/##")
echo "SUGGEST: ln -s $s $link"
ln -s $s $link
git add $link
else
echo "OK: '$sb'"
fi
echo "$names" | grep " $name " >> /dev/null
if [ $? -ne 0 ]; then
for s2 in $(find Source -name "$sname-*.rpm"); do
sb2=$(basename $s2)
if [ "$sb" != "$sb2" ]; then
sname2=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $s2)
if [ "$sname" == "$sname2" ]; then
MATCH=$(grep "^$sb2" $WHITE_LIST_FILE || true)
if [ "$MATCH" != "" ]; then
link=$(echo $s2 | sed "s#^$MIRROR_ROOT/##")
echo "SUGGEST: rm $link"
git rm -f $link
fi
fi
fi
done
fi
snames="${snames}${sname} "
fi
fi
}
for dat in $(for br in $(find $BIN_ROOT -name '*.rpm' | grep -v '.src.rpm$' | grep -v '[-]debuginfo-'); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done | sort -r -V)
do
do_work ${dat}
done
for dat in $(for br in $(find $BIN_ROOT -name '*.rpm' | grep -v '.src.rpm$' | grep '[-]debuginfo-'); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done | sort -r -V)
do
do_work ${dat}
done

View File

@ -1,82 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# This step removes obsolete or broken Source links
#
MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/newton
BIN_ROOT=$MIRROR_ROOT/Binary
SRC_ROOT=$MIRROR_ROOT/Source
cd $MY_REPO/cgcs-centos-repo
if [ $? -ne 0 ]; then
echo 'ERROR: failed to cd to $MY_REPO/cgcs-centos-repo'
return 1
fi
# Clean broken and obsolete srpm links
snames=" "
for dat in $(for br in $(find Source -name '*.src.rpm'); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done | sort -r -V)
do
sb=$(echo "$dat" | awk -F '#' '{ print $2 }')
d=$(echo "$dat" | awk -F '#' '{ print $3 }')
s="$d/$sb"
if [ ! -f $s ]; then
continue
fi
link=$(readlink $s)
if [ ! -f $link ]; then
echo "ERROR: '$sb' link to non-existant file '$link'"
echo "SUGGEST: rm $s"
git rm -f $s
continue
fi
echo $link | grep "$MIRROR_ROOT" >> /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: '$sb' links to unexpected file '$link'"
echo "SUGGEST: rm $s"
git rm -f $s
continue
fi
sname=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $s)
echo "$snames" | grep " $sname " >> /dev/null
if [ $? -ne 0 ]; then
if [ "x$sname" != "x" ]; then
for s2 in $(find Source -name "$sname-*.src.rpm"); do
sb2=$(basename $s2)
if [ "$sb" != "$sb2" ]; then
sname2=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $s2)
if [ "$sname" == "$sname2" ]; then
link=$(echo $s2 | sed "s#^$MIRROR_ROOT/##")
echo "SUGGEST: rm $link, due to $sb"
git rm -f $link
for r3 in $(find Binary -name "$sname-*.rpm"); do
sb3=$(rpm -q --info --nosignature -p $r3 | grep '^Source RPM : ' | sed 's#^Source RPM : ##')
if [ "$sb3" == "$sb2" ]; then
echo "SUGGEST: rm $r3, due to $sb2"
fi
done
fi
fi
done
fi
snames="${snames}${sname} "
fi
done

View File

@ -1,40 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# This step removes broken Binary links
#
MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/newton
cd $MY_REPO/cgcs-centos-repo
if [ $? -ne 0 ]; then
echo 'ERROR: failed to cd to $MY_REPO/cgcs-centos-repo'
return 1
fi
# Clean broken rpm links
for r in $(find Binary -name '*.rpm' | grep -v '.src.rpm$' | sort -r -V); do
b=$(basename $r)
link=$(readlink $r)
if [ ! -f $link ]; then
echo "ERROR: '$b' link to non-existant file '$link'"
echo "SUGGEST: rm $r"
git rm -f $r
continue
fi
echo $link | grep "$MIRROR_ROOT" >> /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: '$b' links to unexpected file '$link'"
echo "SUGGEST: rm $r"
git rm -f $r
continue
fi
done

View File

@ -1,176 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# This step removes obsolete Binary links
#
cd $MY_REPO/cgcs-centos-repo
MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/newton
BIN_ROOT=$MIRROR_ROOT/Binary
SRC_ROOT=$MIRROR_ROOT/Source
cd $MY_REPO/cgcs-centos-repo
if [ $? -ne 0 ]; then
echo 'ERROR: failed to cd to $MY_REPO/cgcs-centos-repo'
return 1
fi
for dat in $(for br in $(find Binary -name '*.rpm' | grep -v '.src.rpm$' ); do
d=$(dirname $br)
b=$(basename $br)
s=$(echo $b | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$s#$b#$d"
done | sort -r -V)
do
b=$(echo "$dat" | awk -F '#' '{ print $2 }')
d=$(echo "$dat" | awk -F '#' '{ print $3 }')
r="$d/$b"
name=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $r)
link=$(readlink $r)
sb=$(rpm -q --info --nosignature -p $r | grep '^Source RPM : ' | sed 's#^Source RPM : ##')
if [ "x$sb" == "x" ]; then
echo "ERROR: no source rpm listed for '$b'"
continue
fi
s=$(find Source -name "$sb")
if [ "x$s" == "x" ]; then
DELETED=0
altname=$(echo $name | sed 's#^python-#python2-#')
if [ "$altname" != "$name" ]; then
# look for python2 alternative
for dat2 in $(for br in $(find $BIN_ROOT -name "$altname-*.rpm" | grep -v '.src.rpm$' | grep -v '[-]debuginfo-'); do
ddd=$(dirname $br)
bbb=$(basename $br)
sss=$(echo $bbb | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
echo "$sss#$bbb#$ddd"
done | sort -r -V)
do
b2=$(echo "$dat2" | awk -F '#' '{ print $2 }')
d2=$(echo "$dat2" | awk -F '#' '{ print $3 }')
r2="$d2/$b2"
name2=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $r2)
if [ "$name2" != "$altname" ]; then
continue
fi
sb2=$(rpm -q --info --nosignature -p $r2 | grep '^Source RPM : ' | sed 's#^Source RPM : ##')
if [ "$sb" == "$sb2" ]; then
continue
fi
sbs=$(echo $sb | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
sbs2=$(echo $sb2 | sed -e 's#.centos.#.#' -e 's#.el7.#.#' -e 's#.el7_##' -e 's#.rpm$##' -e 's#.src$##' -e 's#.noarch$##' -e 's#.x86_64$##')
newer=$((echo $sbs; echo $sbs2) | sort -r -V | head -n 1)
if [ "$sbs" != "$sbs2" ]; then
if [ "$newer" == "$sbs2" ]; then
# swap alternate for original
echo "SUGGEST: rm $r"
git rm -f $r
DELETED=1
fi
fi
done
fi
if [ $DELETED -eq 0 ]; then
echo "ERROR: no source rpm '$sb' found for '$b'"
echo "SUGGEST: rm $r"
git rm -f $r
continue
fi
fi
done
#
# The following would delete all binary rpms that Titanium Cloud would otherwise compile.
# However for bootstrapping the build there are some packages that we must have...
# e.g. bash, kernel-headers, ....
# So we will need something smarter than to just delete everything.
#
# TMP_DIR=$(mktemp -d /tmp/link_cgcs_centos_repo_XXXXXX)
#
# BUILT_SRPMS_FILE=$TMP_DIR/built_srpms_file
#
# for r in $(for c in $(find $MY_REPO -type d -name centos); do
# for sp in $(find $c -name srpm_path); do
# echo "$sp: $(cat $sp)"
# done
# done | grep 'mirror:' | awk -F ' ' '{ print $2 }') ; do
# b=$(basename $r)
# s=$(find $MY_REPO/cgcs-centos-repo/Source/ -name $b)
# n=$(rpm -q --qf '%{NAME}' --nosignature -p $s)
# echo "$n:$b" >> $BUILT_SRPMS_FILE
# done
#
# cd $MY_REPO/cgcs-centos-repo
#
# for r in $(find Binary -name '*.rpm'); do
# b=$(basename $r)
# sb=$(rpm -q --info --nosignature -p $r | grep '^Source RPM :' | sed 's#^Source RPM : ##')
# if [ "x$sb" != "x" ]; then
# s=$(find Source/ -name $sb)
# if [ "x$s" != "x" ]; then
# n=$(rpm -q --qf '%{NAME}' --nosignature -p $s)
# grep "^$n:" $BUILT_SRPMS_FILE
# if [ $? -eq 0 ]; then
# git rm -f $r
# fi
# fi
# fi
# done
#
# \rm $BUILT_SRPMS_FILE
# rmdir $TMP_DIR
TMP_DIR=$(mktemp -d /tmp/link_cgcs_centos_repo_XXXXXX)
EXCLUDE_LIST=$TMP_DIR/exclude_list
# List od packages we compile from scratch, not from centos srpm, goes to $EXCLUDE_LIST
for g in $(find $MY_REPO -type d -name .git); do
d=$(dirname $g)
for cpd in $(find $d -maxdepth 1 -name 'centos_pkg_dir*'); do
(
cd $d
for pd in $(cat $cpd); do
(
cd $pd/centos
if [ -f srpm_path ]; then
continue
fi
for spec in $(find . -name '*.spec'); do
n=$(spec_find_tag 'name' $spec '/tmp/' '0' 2> /dev/null)
echo "$spec: $n"
echo $n >> $EXCLUDE_LIST
done
)
done
)
done
done
cd $MY_REPO/cgcs-centos-repo
for r in $(find Binary -name '*.rpm'); do
s=$(rpm -q --info --nosignature -p $r | grep '^Source RPM' | sed 's#^Source RPM ..##')
n=$(rpm -q --nosignature --qf '%{NAME}' -p $(find Source -name $s) )
grep "^$n$" $EXCLUDE_LIST
if [ $? -eq 0 ]; then
echo "rm $r"
git rm $r
fi
done
\rm -r $TMP_DIR
echo "REMINDER: inspect changes in $MY_REPO/cgcs-centos-repo and commit with ..."
echo ' TIMESTAMP=$(date +"%Y-%m-%d")'
echo ' git commit -m "JENKINS: repo update $TIMESTAMP"'

View File

@ -1,94 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# Search for tis patched centos src.rpm's that have been upversioned
#
cd $MY_REPO/cgcs-centos-repo
# OLD_MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/mitaka
OLD_MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/newton
# MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/newton
OLD_THIRD_MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/tis-r4-3rd-Party
# THIRD_MIRROR_ROOT=/import/mirrors/CentOS/tis-r5-CentOS/tis-r4-3rd-Party
# BIN_ROOT=$MIRROR_ROOT/Binary
# SRC_ROOT=$MIRROR_ROOT/Source
UPVERSION_LOG=$MY_WORKSPACE/upversion.log
REPO_DOWNLOADS_ROOT="$MY_REPO"
NEW_MIRROR_ROOT="$MY_REPO/cgcs-centos-repo"
THIRD_PARTY_ROOT="$MY_REPO/cgcs-3rd-party-repo"
if [ -f $UPVERSION_LOG ]; then
rm -f $UPVERSION_LOG
fi
cd $MY_REPO
for g in $(find $MY_REPO -type d -name .git); do
d=$(dirname $g)
for pf in $(find $d -maxdepth 1 -name 'centos_pkg_dirs*'); do
if [ -f $pf ]; then
for p in $(cat $pf); do
pkg_dir="$d/$p"
sf="$pkg_dir/centos/srpm_path"
if [ -f $sf ]; then
for s in $(grep '^[^#]' $sf); do
ORIG_SRPM_PATH=""
# absolute path source rpms
echo "$s" | grep "^/" >/dev/null && ORIG_SRPM_PATH=$s
if [ "${ORIG_SRPM_PATH}x" == "x" ]; then
# handle repo: definitions
echo "$s" | grep "^repo:" >/dev/null && ORIG_SRPM_PATH=$(echo $s | sed "s%^repo:%$REPO_DOWNLOADS_ROOT/%")
fi
if [ "${ORIG_SRPM_PATH}x" == "x" ]; then
# handle 3rd_party: definitions
echo "$s" | grep "^3rd_party:" >/dev/null && ORIG_SRPM_PATH=$(echo $s | sed "s%^3rd_party:%$THIRD_PARTY_ROOT/%")
fi
if [ "${ORIG_SRPM_PATH}x" == "x" ]; then
# handle mirror: definitions
# SAL TEMPORARY echo "$s" | grep "^mirror:" >/dev/null && ORIG_SRPM_PATH=`echo $s | sed "s%^mirror:%$MIRROR_ROOT/%"`
echo "$s" | grep "^mirror:" >/dev/null && ORIG_SRPM_PATH=$(echo $s | sed "s%^mirror:%$NEW_MIRROR_ROOT/%" | sed "s#CentOS/tis-r4-CentOS/kilo/##" | sed "s#CentOS/tis-r4-CentOS/mitaka/##" | sed "s#CentOS/tis-r4-CentOS/newton/##")
fi
if [ "${ORIG_SRPM_PATH}x" == "x" ]; then
# we haven't found a valid prefix yet, so assume it's a legacy
# file (mirror: interpretation)
ORIG_SRPM_PATH="$NEW_MIRROR_ROOT/$s"
fi
if [ ! -f $ORIG_SRPM_PATH ]; then
b=$(basename "$ORIG_SRPM_PATH")
old_srpm=$(find $OLD_MIRROR_ROOT $OLD_THIRD_MIRROR_ROOT -name $b | head -n 1)
old_name=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $old_srpm)
if [ "$old_name" == "" ]; then
echo "FAILED to find name for '$b', ORIG_SRPM_PATH='$ORIG_SRPM_PATH'"
exit 1
fi
NEW_SRPM_PATH=""
for new_srpm in $(find $NEW_MIRROR_ROOT/Source $THIRD_PARTY_ROOT/Source -name "$old_name-[0-9]*.src.rpm"); do
new_name=$(rpm -q --nosignature --queryformat '%{NAME}\n' -p $new_srpm)
if [ "$new_name" == "$old_name" ]; then
NEW_SRPM_PATH=$new_srpm
break
fi
done
nb=$(basename $NEW_SRPM_PATH)
echo "FIX: '$sf' : '$b' -> '$nb'"
echo "$old_name#$sf#$s#$b#$nb" >> $UPVERSION_LOG
fi
done
fi
done
fi
done
done

View File

@ -1,91 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# start an edit session for packages to be upgraded - pre upgrade version
#
UPVERSION_LOG=$MY_WORKSPACE/upversion.log
if [ "x$WORKING_BRANCH" == "x" ]; then
WORKING_BRANCH=CGCS_DEV_0029_rebase_7_4
fi
if [ ! -f $UPVERSION_LOG ]; then
echo "ERROR: Can't find UPVERSION_LOG at '$UPVERSION_LOG'"
fi
# One step back to see the old symlinks
cd $MY_REPO/cgcs-3rd-party-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$(pwd)'"
exit 1
fi
git checkout HEAD^
cd $MY_REPO/cgcs-centos-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$(pwd)'"
exit 1
fi
git checkout HEAD^
#
#
#
FAILED=""
for dat in $(cat $UPVERSION_LOG); do
name=$(echo $dat | awk -F '#' '{print $1}')
srpm_path=$(echo $dat | awk -F '#' '{print $2}')
old_src_rpm=$(echo $dat | awk -F '#' '{print $4}')
new_src_rpm=$(echo $dat | awk -F '#' '{print $5}')
echo "$name $old_src_rpm $new_src_rpm"
if [ "$name" == "kernel" ]; then
build-pkgs --std --edit --clean $name
elif [ "$name" == "kernel-rt" ]; then
build-pkgs --rt --edit --clean $name
else
build-pkgs --edit --clean $name
fi
if [ $? -ne 0 ]; then
echo "ERROR: failed cmd 'build-pkgs --edit --clean $name'"
FAILED="$name $FAILED"
break
fi
echo "$? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
if [ "$name" == "kernel" ]; then
build-pkgs --std --edit $name
elif [ "$name" == "kernel-rt" ]; then
build-pkgs --rt --edit $name
else
build-pkgs --edit $name
fi
if [ $? -ne 0 ]; then
echo "ERROR: failed cmd 'build-pkgs --edit $name'"
FAILED="$name $FAILED"
break
fi
echo "$? <=<=<=<=<=<=<=<=<=<=<=<=<=<=<=<="
done
cd $MY_REPO/cgcs-3rd-party-repo
git checkout $WORKING_BRANCH
cd $MY_REPO/cgcs-centos-repo
git checkout $WORKING_BRANCH
if [ "$FAILED" != "" ]; then
echo "Failed build-pkgs --edit for ... $FAILED"
exit 1
fi

View File

@ -1,84 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# Update srpm_path for packages to be upgraded
#
UPVERSION_LOG=$MY_WORKSPACE/upversion.log
if [ "x$ORIGIN_BRANCH" == "x" ]; then
ORIGIN_BRANCH=CGCS_DEV_0029
fi
if [ "x$WORKING_BRANCH" == "x" ]; then
WORKING_BRANCH=CGCS_DEV_0029_rebase_7_4
fi
if [ ! -f $UPVERSION_LOG ]; then
echo "ERROR: Can't find UPVERSION_LOG at '$UPVERSION_LOG'"
fi
# One step back to see the old symlinks
cd $MY_REPO
FAILED=""
for dat in $(cat $UPVERSION_LOG); do
name=$(echo $dat | awk -F '#' '{print $1}')
srpm_path=$(echo $dat | awk -F '#' '{print $2}')
old_src_rpm=$(echo $dat | awk -F '#' '{print $4}')
new_src_rpm=$(echo $dat | awk -F '#' '{print $5}')
(
cd $(dirname $srpm_path)
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "$WORKING_BRANCH" ]; then
git checkout $WORKING_BRANCH
if [ $? -ne 0 ]; then
git checkout $ORIGIN_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: Can't checkout branch '$ORIGIN_BRANCH' in directory '$(pwd)'"
exit 1
fi
git checkout -b $WORKING_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to 'git checkout -b $WORKING_BRANCH' from '$(pwd)'"
exit 1
else
echo "created branch '$WORKING_BRANCH' at '$(pwd)'"
fi
fi
fi
sed -i "s#$old_src_rpm#$new_src_rpm#" $srpm_path
if [ $? -ne 0 ]; then
echo "ERROR: sed failed '$old_src_rpm' -> '$new_src_rpm'"
exit 1
else
echo "updated $srpm_path: '$old_src_rpm' -> '$new_src_rpm'"
fi
exit 0
)
if [ $? -ne 0 ]; then
echo "ERROR: failed while working on package '$name' at '$srpm_path'"
exit 1
fi
done
echo ""
for d in $(for dat in $(cat $UPVERSION_LOG); do srpm_path=$(echo $dat | awk -F '#' '{print $2}'); ( cd $(dirname $srpm_path); git rev-parse --show-toplevel ); done | sort --unique); do
(
cd $d
echo "cd $d"
for f in $(git status --porcelain | grep 'srpm_path$' | awk '{print $2}'); do
echo "git add $f";
done
echo "git commit -m 'srpm_path updates for centos rebase'"
)
done
echo ""

View File

@ -1,65 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# Start an edit session for packages to be upgraded - post upgrade version
#
UPVERSION_LOG=$MY_WORKSPACE/upversion.log
if [ "x$WORKING_BRANCH" == "x" ]; then
WORKING_BRANCH=CGCS_DEV_0029_rebase_7_4
fi
if [ ! -f $UPVERSION_LOG ]; then
echo "ERROR: Can't find UPVERSION_LOG at '$UPVERSION_LOG'"
fi
# Restore new symlinks
cd $MY_REPO/cgcs-3rd-party-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-3rd-party-repo'"
exit 1
fi
cd $MY_REPO/cgcs-centos-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-centos-repo'"
exit 1
fi
FAILED=""
for dat in $(cat $UPVERSION_LOG); do
name=$(echo $dat | awk -F '#' '{print $1}')
srpm_path=$(echo $dat | awk -F '#' '{print $2}')
old_src_rpm=$(echo $dat | awk -F '#' '{print $4}')
new_src_rpm=$(echo $dat | awk -F '#' '{print $5}')
echo "$name $old_src_rpm $new_src_rpm"
if [ "$name" == "kernel" ]; then
build-pkgs --std --edit $name --no-meta-patch
elif [ "$name" == "kernel-rt" ]; then
build-pkgs --rt --edit $name --no-meta-patch
else
build-pkgs --edit $name --no-meta-patch
fi
if [ $? -ne 0 ]; then
echo "ERROR: failed cmd 'build-pkgs --edit $name'"
FAILED="$name $FAILED"
break
fi
echo "$? <=<=<=<=<=<=<=<=<=<=<=<=<=<=<=<="
done
if [ "$FAILED" != "" ]; then
echo "Failed build-pkgs --edit for ... $FAILED"
exit 1
fi

View File

@ -1,346 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r5-CentOS/newton
#
# Search for tis patched centos src.rpm's that have been upversioned
#
UPVERSION_LOG=$MY_WORKSPACE/upversion.log
if [ "x$WORKING_BRANCH" == "x" ]; then
WORKING_BRANCH=CGCS_DEV_0029_rebase_7_4
fi
if [ ! -f $UPVERSION_LOG ]; then
echo "ERROR: Can't find UPVERSION_LOG at '$UPVERSION_LOG'"
fi
if [ "$DISPLAY" == "" ]; then
echo "ERROR: X-Windows 'DISPLAY' variable not set. This script needs to open pop-up windows."
usage
exit 1
fi
# restore new symlinks
cd $MY_REPO/cgcs-3rd-party-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-3rd-party-repo'"
exit 1
fi
cd $MY_REPO/cgcs-centos-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-centos-repo'"
exit 1
fi
FAILED=""
build_types="std rt"
for dat in $(cat $UPVERSION_LOG); do
(
name=$(echo $dat | awk -F '#' '{print $1}')
srpm_path=$(echo $dat | awk -F '#' '{print $2}')
old_src_rpm=$(echo $dat | awk -F '#' '{print $4}')
new_src_rpm=$(echo $dat | awk -F '#' '{print $5}')
PKG_DIR=$(dirname $(dirname $srpm_path))
OLD_BRANCH=$(echo $old_src_rpm | sed 's#[.]src[.]rpm$##')
NEW_BRANCH=$(echo $new_src_rpm | sed 's#[.]src[.]rpm$##')
WORK_META_DIR=""
for dd in $build_types; do
WORK_META_DIR=$MY_WORKSPACE/$dd/srpm_work/$name/rpmbuild
echo "WORK_META_DIR=$WORK_META_DIR"
if [ -d $WORK_META_DIR ]; then
break;
else
WORK_META_DIR=""
fi
done
if [ "$WORK_META_DIR" == "" ]; then
echo "ERROR: failed to find srpm_work directory for '$name'"
exit 1
fi
# WORK_SRC_DIR=$(dirname $(find $MY_WORKSPACE/srpm_work/$name/gits/ -type d -name .git))
NEW_WORK_SRC_DIR=""
OLD_WORK_SRC_DIR=""
for dd in $build_types; do
for g in $(find $MY_WORKSPACE/$dd/srpm_work/$name/gits/ -type d -name .git); do
d=$(dirname $g)
if [ -d $d ]; then
cd $d;
git tag | grep pre_wrs_ >> /dev/null
if [ $? -ne 0 ]; then
continue
fi
git checkout $OLD_BRANCH 2>> /dev/null
if [ $? -eq 0 ]; then
OLD_WORK_SRC_DIR=$d
fi
git checkout $NEW_BRANCH 2>> /dev/null
if [ $? -eq 0 ]; then
NEW_WORK_SRC_DIR=$d
fi
fi
done
done
if [ "$WORK_META_DIR" == "" ]; then
echo "ERROR: failed to find srpm_work directory for '$name'"
exit 1
fi
echo "$name $old_src_rpm $new_src_rpm"
echo "PKG_DIR=$PKG_DIR"
echo "OLD_BRANCH=$OLD_BRANCH"
echo "NEW_BRANCH=$NEW_BRANCH"
echo "WORK_META_DIR=$WORK_META_DIR"
echo "OLD_WORK_SRC_DIR=$OLD_WORK_SRC_DIR"
echo "NEW_WORK_SRC_DIR=$NEW_WORK_SRC_DIR"
echo ""
(
cd $WORK_META_DIR
if [ $? -ne 0 ]; then
echo "ERROR: failed to cd to WORK_META_DIR=$WORK_META_DIR"
exit 1
fi
echo "--- old meta git log (oldest to newest) ---"
git checkout $OLD_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout OLD_BRANCH=$OLD_BRANCH"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit ; echo "") | sed '/^$/d' | tac
PATCH_COMMIT_LIST=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit ; echo "") | sed '/^$/d' | tac | grep WRS: | grep -v 'WRS: COPY_LIST content' | awk '{ print $2 }')
echo "--- new meta git log (oldest to newest) ---"
git checkout $NEW_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout NEW_BRANCH=$NEW_BRANCH"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit ; echo "") | sed '/^$/d' | tac
REFERENCE_COMMIT=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit ; echo "") | sed '/^$/d' | head -n 1 | awk '{ print $2 }')
echo ""
for COMMIT in ${PATCH_COMMIT_LIST}; do
echo "git cherry-pick $COMMIT"
git --no-pager show "$COMMIT"
git cherry-pick "$COMMIT"
if [ $? -ne 0 ]; then
echo "WARNING: 'git cherry-pick $COMMIT' found merge conflicts. Please fix these files"
git status --porcelain | grep '^UU ' | awk '{ print $2}'
echo "pwd=$(pwd)"
# gitk &
echo "git mergetool --no-prompt"
git mergetool --no-prompt
# for FILE_NAME in $(git status --porcelain | grep '^UU ' | awk '{ print $2}'); do
# xterm -e "vi $FILE_NAME -c '/[<=>][<=>][<=>][<=>]'"
# if [ $? -ne 0 ]; then
# echo "ERROR: problem launching editor on "
# exit 1
# fi
# done
echo "git cherry-pick --continue"
git cherry-pick --continue
fi
done
PATCH_LIST=$(git format-patch -n $REFERENCE_COMMIT)
if [ $? -ne 0 ]; then
echo "ERROR: failed to git format-patch -n REFERENCE_COMMIT=$REFERENCE_COMMIT"
exit 1
fi
for PATCH_FILE in ${PATCH_LIST}; do
PATCH_TARGET=$(echo $PATCH_FILE | sed 's/^[0-9][0-9][0-9][0-9]-WRS-//' | sed 's/.patch$//')
echo "$PATCH_FILE -> $PATCH_TARGET"
N=$(find "$PKG_DIR/centos/meta_patches" -name "$PATCH_TARGET*" | wc -l)
if [ $N -eq 1 ]; then
PATCH_DEST=$(find "$PKG_DIR/centos/meta_patches" -name "$PATCH_TARGET*")
echo "cp -f $PATCH_FILE $PATCH_DEST"
\cp -f $PATCH_FILE $PATCH_DEST
if [ $? -ne 0 ]; then
echo "ERROR: copy failed $WORK_META_DIR/$PATCH_FILE -> $PATCH_DEST"
exit 1
fi
else
echo "ERROR: Don't know what destination file name to use for patch '$WORK_META_DIR/$PATCH_FILE' derived from commit $COMMIT, and to be copied to '$PKG_DIR/centos/meta_patches'"
fi
done
echo ""
echo ""
)
if [ $? -ne 0 ]; then
FAILED=$name
break
fi
(
echo "--- old git log (oldest to newest) ---"
cd $OLD_WORK_SRC_DIR
if [ $? -ne 0 ]; then
echo "ERROR: failed to cd to OLD_WORK_SRC_DIR=$OLD_WORK_SRC_DIR"
exit 1
fi
git checkout $OLD_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout OLD_BRANCH=$OLD_BRANCH in directory '$OLD_WORK_SRC_DIR'"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit; echo "") | sed '/^$/d' | tac
PATCH_COMMIT_LIST=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit; echo "") | sed '/^$/d' | tac | grep WRS: | grep -v 'WRS: COPY_LIST content' | awk '{ print $2 }')
echo "--- new git log (oldest to newest) ---"
cd $NEW_WORK_SRC_DIR
if [ $? -ne 0 ]; then
echo "ERROR: failed to cd to NEW_WORK_SRC_DIR=$NEW_WORK_SRC_DIR"
exit 1
fi
git checkout $NEW_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout NEW_BRANCH=$NEW_BRANCH in directory '$NEW_WORK_SRC_DIR'"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit; echo "") | sed '/^$/d' | tac
REFERENCE_COMMIT=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit ; echo "") | sed '/^$/d' | head -n 1 | awk '{ print $2 }')
echo ""
if [ "$OLD_WORK_SRC_DIR" == "$NEW_WORK_SRC_DIR" ]; then
for COMMIT in ${PATCH_COMMIT_LIST}; do
echo "git cherry-pick $COMMIT"
git --no-pager show "$COMMIT"
git cherry-pick "$COMMIT"
if [ $? -ne 0 ]; then
echo "WARNING: 'git cherry-pick $COMMIT' found merge conflicts. Please fix these files"
git status --porcelain | grep '^UU ' | awk '{ print $2}'
echo "pwd=$(pwd)"
# gitk &
echo "git mergetool --no-prompt"
git mergetool --no-prompt
# for FILE_NAME in $(git status --porcelain | grep '^UU ' | awk '{ print $2}'); do
# xterm -e "vi $FILE_NAME -c '/[<=>][<=>][<=>][<=>]'"
# if [ $? -ne 0 ]; then
# echo "ERROR: problem launching editor on "
# exit 1
# fi
# done
echo "git cherry-pick --continue"
git cherry-pick --continue
fi
done
else
cd $OLD_WORK_SRC_DIR
PATCH_LIST=$(git format-patch -n pre_wrs_$OLD_BRANCH)
if [ $? -ne 0 ]; then
echo "ERROR: failed to git format-patch -n REFERENCE_COMMIT=pre_wrs_$OLD_BRANCH"
exit 1
fi
cd $NEW_WORK_SRC_DIR
for PATCH_FILE in ${PATCH_LIST}; do
echo "=== Apply $PATCH_FILE ==="
cat $OLD_WORK_SRC_DIR/$PATCH_FILE
cat $OLD_WORK_SRC_DIR/$PATCH_FILE | patch -p1
if [ $? -ne 0 ]; then
for REJECT in $(find . -name '*.rej'); do
FILE_NAME=$(echo $REJECT | sed 's#.rej$##')
cd $OLD_WORK_SRC_DIR
gitk $FILE_NAME &
cd $NEW_WORK_SRC_DIR
if [ -f $FILE_NAME ] && [ -f $FILE_NAME.orig ]; then
\cp -f $FILE_NAME.orig $FILE_NAME
xterm -e "vi $FILE_NAME $REJECT"
rm -f $REJECT
rm -f $FILE_NAME.orig
fi
done
fi
git add --all
MSG=$(echo $PATCH_FILE | sed 's/^[0-9][0-9][0-9][0-9]-WRS-//' | sed 's/.patch$//')
git commit -m "WRS: $MSG"
done
fi
PATCH_LIST=$(git format-patch -n $REFERENCE_COMMIT)
if [ $? -ne 0 ]; then
echo "ERROR: failed to git format-patch -n REFERENCE_COMMIT=$REFERENCE_COMMIT"
exit 1
fi
for PATCH_FILE in ${PATCH_LIST}; do
PATCH_TARGET=$(echo $PATCH_FILE | sed 's/^[0-9][0-9][0-9][0-9]-WRS-Patch[0-9]*-//' | sed 's/^[0-9][0-9][0-9][0-9]-WRS-Patch//' | sed 's/.patch$//')
echo "$PATCH_FILE -> $PATCH_TARGET"
PKG_PATCH_DIR="$PKG_DIR/centos/patches"
N=0
if [ -d "$PKG_PATCH_DIR" ]; then
N=$(find "$PKG_PATCH_DIR" -name "$PATCH_TARGET*" | grep -v '[/]meta_patches[/]' | wc -l)
fi
if [ $N -ne 1 ]; then
PKG_PATCH_DIR="$PKG_DIR"
if [ -d "$PKG_PATCH_DIR" ]; then
N=$(find "$PKG_PATCH_DIR" -name "$PATCH_TARGET*" | grep -v '[/]meta_patches[/]' | wc -l)
fi
fi
echo "N=$N"
echo "PKG_PATCH_DIR=$PKG_PATCH_DIR"
if [ $N -eq 1 ]; then
PATCH_DEST=$(find "$PKG_PATCH_DIR" -name "$PATCH_TARGET*" | grep -v '[/]meta_patches[/]')
echo "meld $PATCH_FILE -> $PATCH_DEST"
meld $PATCH_FILE $PATCH_DEST
if [ $? -ne 0 ]; then
echo "ERROR: meld failed $WORK_SRC_DIR/$PATCH_FILE -> $PATCH_DEST"
exit 1
fi
else
echo "ERROR: Don't know what destination file name to use for patch '$OLD_WORK_SRC_DIR/$PATCH_FILE', and to be copied to '$PKG_PATCH_DIR'"
fi
done
echo ""
echo ""
)
if [ $? -ne 0 ]; then
FAILED=$name
break
fi
)
done
if [ "$FAILED" != "" ]; then
echo "Failed for ... $FAILED"
exit 1
fi
echo ""
for d in $(for dat in $(cat $UPVERSION_LOG); do srpm_path=$(echo $dat | awk -F '#' '{print $2}'); ( cd $(dirname $srpm_path); git rev-parse --show-toplevel ); done | sort --unique); do
(
cd $d
echo "cd $d"
for f in $(git status --porcelain | awk '{print $2}'); do
echo "git add $f";
done
if [ "$PATCH_ID" == "" ]; then
echo "git commit -m 'rebased patches'"
else
echo "git commit -m 'rebased patches'"
fi
)
done
echo ""

View File

@ -1,330 +0,0 @@
#!/bin/bash
#
# Part of the monthly mirror update
#
# Update symlinks in cgcs-centos-repo to point to the latest version of packages in /import/mirrors/CentOS/tis-r4-CentOS/newton
#
# Search for tis patched centos src.rpm's that have been upversioned
#
UPVERSION_LOG=$MY_WORKSPACE/upversion.log
if [ "x$WORKING_BRANCH" == "x" ]; then
WORKING_BRANCH=CGCS_DEV_0026_may_rebase
fi
if [ ! -f $UPVERSION_LOG ]; then
echo "ERROR: Can't find UPVERSION_LOG at '$UPVERSION_LOG'"
fi
if [ "$DISPLAY" == "" ]; then
echo "ERROR: X-Windows 'DISPLAY' variable not set. This script needs to open pop-up windows."
usage
exit 1
fi
# restore new symlinks
cd $MY_REPO/cgcs-3rd-party-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-3rd-party-repo'"
exit 1
fi
cd $MY_REPO/cgcs-centos-repo
git checkout $WORKING_BRANCH
if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-centos-repo'"
exit 1
fi
FAILED=""
build_types="std rt"
for dat in $(cat $UPVERSION_LOG); do
(
name=$(echo $dat | awk -F '#' '{print $1}')
srpm_path=$(echo $dat | awk -F '#' '{print $2}')
old_src_rpm=$(echo $dat | awk -F '#' '{print $4}')
new_src_rpm=$(echo $dat | awk -F '#' '{print $5}')
PKG_DIR=$(dirname $(dirname $srpm_path))
OLD_BRANCH=$(echo $old_src_rpm | sed 's#[.]src[.]rpm$##')
NEW_BRANCH=$(echo $new_src_rpm | sed 's#[.]src[.]rpm$##')
WORK_META_DIR=""
for dd in $build_types; do
WORK_META_DIR=$MY_WORKSPACE/$dd/srpm_work/$name/rpmbuild
echo "WORK_META_DIR=$WORK_META_DIR"
if [ -d $WORK_META_DIR ]; then
break;
else
WORK_META_DIR=""
fi
done
if [ "$WORK_META_DIR" == "" ]; then
echo "ERROR: failed to find srpm_work directory for '$name'"
exit 1
fi
# WORK_SRC_DIR=$(dirname $(find $MY_WORKSPACE/srpm_work/$name/gits/ -type d -name .git))
NEW_WORK_SRC_DIR=""
OLD_WORK_SRC_DIR=""
for dd in $build_types; do
for g in $(find $MY_WORKSPACE/$dd/srpm_work/$name/gits/ -type d -name .git); do
d=$(dirname $g)
if [ -d $d ]; then
cd $d;
git tag | grep pre_wrs_ >> /dev/null
if [ $? -ne 0 ]; then
continue
fi
git checkout $OLD_BRANCH 2>> /dev/null
if [ $? -eq 0 ]; then
OLD_WORK_SRC_DIR=$d
fi
git checkout $NEW_BRANCH 2>> /dev/null
if [ $? -eq 0 ]; then
NEW_WORK_SRC_DIR=$d
fi
fi
done
done
if [ "$WORK_META_DIR" == "" ]; then
echo "ERROR: failed to find srpm_work directory for '$name'"
exit 1
fi
echo "$name $old_src_rpm $new_src_rpm"
echo "PKG_DIR=$PKG_DIR"
echo "OLD_BRANCH=$OLD_BRANCH"
echo "NEW_BRANCH=$NEW_BRANCH"
echo "WORK_META_DIR=$WORK_META_DIR"
echo "OLD_WORK_SRC_DIR=$OLD_WORK_SRC_DIR"
echo "NEW_WORK_SRC_DIR=$NEW_WORK_SRC_DIR"
echo ""
(
cd $WORK_META_DIR
if [ $? -ne 0 ]; then
echo "ERROR: failed to cd to WORK_META_DIR=$WORK_META_DIR"
exit 1
fi
echo "--- old meta git log (oldest to newest) ---"
git checkout $OLD_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout OLD_BRANCH=$OLD_BRANCH"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit ; echo "") | sed '/^$/d' | tac
PATCH_COMMIT_LIST=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit ; echo "") | sed '/^$/d' | tac | grep WRS: | grep -v 'WRS: COPY_LIST content' | awk '{ print $2 }')
echo "--- new meta git log (oldest to newest) ---"
git checkout $NEW_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout NEW_BRANCH=$NEW_BRANCH"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit ; echo "") | sed '/^$/d' | tac
REFERENCE_COMMIT=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit ; echo "") | sed '/^$/d' | head -n 1 | awk '{ print $2 }')
echo ""
for COMMIT in ${PATCH_COMMIT_LIST}; do
echo "git cherry-pick $COMMIT"
git --no-pager show "$COMMIT"
git cherry-pick "$COMMIT"
if [ $? -ne 0 ]; then
echo "WARNING: 'git cherry-pick $COMMIT' found merge conflicts. Please fix these files"
git status --porcelain | grep '^UU ' | awk '{ print $2}'
echo "pwd=$(pwd)"
# gitk &
echo "git mergetool --no-prompt"
git mergetool --no-prompt
# for FILE_NAME in $(git status --porcelain | grep '^UU ' | awk '{ print $2}'); do
# xterm -e "vi $FILE_NAME -c '/[<=>][<=>][<=>][<=>]'"
# if [ $? -ne 0 ]; then
# echo "ERROR: problem launching editor on "
# exit 1
# fi
# done
echo "git cherry-pick --continue"
git cherry-pick --continue
fi
done
PATCH_LIST=$(git format-patch -n $REFERENCE_COMMIT)
if [ $? -ne 0 ]; then
echo "ERROR: failed to git format-patch -n REFERENCE_COMMIT=$REFERENCE_COMMIT"
exit 1
fi
for PATCH_FILE in ${PATCH_LIST}; do
PATCH_TARGET=$(echo $PATCH_FILE | sed 's/^[0-9][0-9][0-9][0-9]-WRS-//' | sed 's/.patch$//')
echo "$PATCH_FILE -> $PATCH_TARGET"
N=$(find "$PKG_DIR/centos/meta_patches" -name "$PATCH_TARGET*" | wc -l)
if [ $N -eq 1 ]; then
PATCH_DEST=$(find "$PKG_DIR/centos/meta_patches" -name "$PATCH_TARGET*")
echo "cp -f $PATCH_FILE $PATCH_DEST"
\cp -f $PATCH_FILE $PATCH_DEST
if [ $? -ne 0 ]; then
echo "ERROR: copy failed $WORK_META_DIR/$PATCH_FILE -> $PATCH_DEST"
exit 1
fi
else
echo "ERROR: Don't know what destination file name to use for patch '$WORK_META_DIR/$PATCH_FILE' derived from commit $COMMIT, and to be copied to '$PKG_DIR/centos/meta_patches'"
fi
done
echo ""
echo ""
)
if [ $? -ne 0 ]; then
FAILED=$name
break
fi
(
echo "--- old git log (oldest to newest) ---"
cd $OLD_WORK_SRC_DIR
if [ $? -ne 0 ]; then
echo "ERROR: failed to cd to OLD_WORK_SRC_DIR=$OLD_WORK_SRC_DIR"
exit 1
fi
git checkout $OLD_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout OLD_BRANCH=$OLD_BRANCH in directory '$OLD_WORK_SRC_DIR'"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit; echo "") | sed '/^$/d' | tac
PATCH_COMMIT_LIST=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit; echo "") | sed '/^$/d' | tac | grep WRS: | grep -v 'WRS: COPY_LIST content' | awk '{ print $2 }')
echo "--- new git log (oldest to newest) ---"
cd $NEW_WORK_SRC_DIR
if [ $? -ne 0 ]; then
echo "ERROR: failed to cd to NEW_WORK_SRC_DIR=$NEW_WORK_SRC_DIR"
exit 1
fi
git checkout $NEW_BRANCH
if [ $? -ne 0 ]; then
echo "ERROR: failed to git checkout NEW_BRANCH=$NEW_BRANCH in directory '$NEW_WORK_SRC_DIR'"
exit 1
fi
(git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit; echo "") | sed '/^$/d' | tac
REFERENCE_COMMIT=$((git log --graph --pretty=format:'%h -%d %s (%ci) <%an>' --abbrev-commit ; echo "") | sed '/^$/d' | head -n 1 | awk '{ print $2 }')
echo ""
if [ "$OLD_WORK_SRC_DIR" == "$NEW_WORK_SRC_DIR" ]; then
for COMMIT in ${PATCH_COMMIT_LIST}; do
echo "git cherry-pick $COMMIT"
git --no-pager show "$COMMIT"
git cherry-pick "$COMMIT"
if [ $? -ne 0 ]; then
echo "WARNING: 'git cherry-pick $COMMIT' found merge conflicts. Please fix these files"
git status --porcelain | grep '^UU ' | awk '{ print $2}'
echo "pwd=$(pwd)"
# gitk &
echo "git mergetool --no-prompt"
git mergetool --no-prompt
# for FILE_NAME in $(git status --porcelain | grep '^UU ' | awk '{ print $2}'); do
# xterm -e "vi $FILE_NAME -c '/[<=>][<=>][<=>][<=>]'"
# if [ $? -ne 0 ]; then
# echo "ERROR: problem launching editor on "
# exit 1
# fi
# done
echo "git cherry-pick --continue"
git cherry-pick --continue
fi
done
else
cd $OLD_WORK_SRC_DIR
PATCH_LIST=$(git format-patch -n pre_wrs_$OLD_BRANCH)
if [ $? -ne 0 ]; then
echo "ERROR: failed to git format-patch -n REFERENCE_COMMIT=pre_wrs_$OLD_BRANCH"
exit 1
fi
cd $NEW_WORK_SRC_DIR
for PATCH_FILE in ${PATCH_LIST}; do
echo "=== Apply $PATCH_FILE ==="
cat $OLD_WORK_SRC_DIR/$PATCH_FILE
cat $OLD_WORK_SRC_DIR/$PATCH_FILE | patch -p1
if [ $? -ne 0 ]; then
for REJECT in $(find . -name '*.rej'); do
FILE_NAME=$(echo $REJECT | sed 's#.rej$##')
cd $OLD_WORK_SRC_DIR
gitk $FILE_NAME &
cd $NEW_WORK_SRC_DIR
if [ -f $FILE_NAME ] && [ -f $FILE_NAME.orig ]; then
\cp -f $FILE_NAME.orig $FILE_NAME
xterm -e "vi $FILE_NAME $REJECT"
rm -f $REJECT
rm -f $FILE_NAME.orig
fi
done
fi
git add --all
MSG=$(echo $PATCH_FILE | sed 's/^[0-9][0-9][0-9][0-9]-WRS-//' | sed 's/.patch$//')
git commit -m "WRS: $MSG"
done
fi
PATCH_LIST=$(git format-patch -n $REFERENCE_COMMIT)
if [ $? -ne 0 ]; then
echo "ERROR: failed to git format-patch -n REFERENCE_COMMIT=$REFERENCE_COMMIT"
exit 1
fi
for PATCH_FILE in ${PATCH_LIST}; do
PATCH_TARGET=$(echo $PATCH_FILE | sed 's/^[0-9][0-9][0-9][0-9]-WRS-Patch[0-9]*-//' | sed 's/^[0-9][0-9][0-9][0-9]-WRS-Patch//' | sed 's/.patch$//')
echo "$PATCH_FILE -> $PATCH_TARGET"
PKG_PATCH_DIR="$PKG_DIR/centos/patches"
N=0
if [ -d "$PKG_PATCH_DIR" ]; then
N=$(find "$PKG_PATCH_DIR" -name "$PATCH_TARGET*" | grep -v '[/]meta_patches[/]' | wc -l)
fi
if [ $N -ne 1 ]; then
PKG_PATCH_DIR="$PKG_DIR"
if [ -d "$PKG_PATCH_DIR" ]; then
N=$(find "$PKG_PATCH_DIR" -name "$PATCH_TARGET*" | grep -v '[/]meta_patches[/]' | wc -l)
fi
fi
echo "N=$N"
echo "PKG_PATCH_DIR=$PKG_PATCH_DIR"
if [ $N -eq 1 ]; then
PATCH_DEST=$(find "$PKG_PATCH_DIR" -name "$PATCH_TARGET*" | grep -v '[/]meta_patches[/]')
echo "meld $PATCH_FILE -> $PATCH_DEST"
meld $PATCH_FILE $PATCH_DEST
if [ $? -ne 0 ]; then
echo "ERROR: meld failed $WORK_SRC_DIR/$PATCH_FILE -> $PATCH_DEST"
exit 1
fi
else
echo "ERROR: Don't know what destination file name to use for patch '$OLD_WORK_SRC_DIR/$PATCH_FILE', and to be copied to '$PKG_PATCH_DIR'"
fi
done
echo ""
echo ""
)
if [ $? -ne 0 ]; then
FAILED=$name
break
fi
)
done
if [ "$FAILED" != "" ]; then
echo "Failed for ... $FAILED"
exit 1
fi

View File

@ -13,12 +13,22 @@
LAYER=${2:-$LAYER} LAYER=${2:-$LAYER}
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# Try to find a layer specific mock.cfg.proto # Try to find a layer specific mock.cfg.proto
MOCK_CFG_PROTO="$MY_REPO/cgcs-centos-repo/mock.cfg.${LAYER}.proto" MOCK_CFG_PROTO="${CENTOS_REPO}/mock.cfg.${LAYER}.proto"
echo "==== Try MOCK_CFG_PROTO=$MOCK_CFG_PROTO ====" echo "==== Try MOCK_CFG_PROTO=$MOCK_CFG_PROTO ===="
if [ ! -f "$MOCK_CFG_PROTO" ]; then if [ ! -f "$MOCK_CFG_PROTO" ]; then
# Not present, Use default mock.cfg.proto # Not present, Use default mock.cfg.proto
MOCK_CFG_PROTO="$MY_REPO/cgcs-centos-repo/mock.cfg.proto" MOCK_CFG_PROTO="${CENTOS_REPO}/mock.cfg.proto"
fi fi
echo "==== Use MOCK_CFG_PROTO=$MOCK_CFG_PROTO ====" echo "==== Use MOCK_CFG_PROTO=$MOCK_CFG_PROTO ===="

View File

@ -4,6 +4,16 @@
# Start an edit session for packages to be upgraded - pre upgrade version # Start an edit session for packages to be upgraded - pre upgrade version
# #
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
usage () { usage () {
echo "" echo ""
echo "Step 1: Start an edit session for packages to be upgraded - pre upgrade version" echo "Step 1: Start an edit session for packages to be upgraded - pre upgrade version"
@ -11,7 +21,7 @@ usage () {
echo "Usage: " echo "Usage: "
echo " patch_rebase_1 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]" echo " patch_rebase_1 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]"
echo "" echo ""
echo "Assumes cgcs-centos-repo already has a working_branch commit that sets the new symlinks." echo "Assumes $(basename ${CENTOS_REPO}) already has a working_branch commit that sets the new symlinks."
echo "" echo ""
echo "The upversion_data file has data on all the src.rpm being updated in the format:" echo "The upversion_data file has data on all the src.rpm being updated in the format:"
echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log" echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log"
@ -85,7 +95,7 @@ if [ "$WORKING_BRANCH" == "" ]; then
fi fi
# One step back to see the old symlinks # One step back to see the old symlinks
cd $MY_REPO/cgcs-centos-repo cd ${CENTOS_REPO}
git checkout $WORKING_BRANCH git checkout $WORKING_BRANCH
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$(pwd)'" echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$(pwd)'"
@ -119,7 +129,7 @@ for dat in $(cat $UPVERSION_LOG); do
echo "$? <=<=<=<=<=<=<=<=<=<=<=<=<=<=<=<=" echo "$? <=<=<=<=<=<=<=<=<=<=<=<=<=<=<=<="
done done
cd $MY_REPO/cgcs-centos-repo cd ${CENTOS_REPO}
git checkout $WORKING_BRANCH git checkout $WORKING_BRANCH
if [ "$FAILED" != "" ]; then if [ "$FAILED" != "" ]; then

View File

@ -4,6 +4,16 @@
# Update srpm_path for packages to be upgraded # Update srpm_path for packages to be upgraded
# #
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
usage () { usage () {
echo "" echo ""
echo "Step 2: Update srpm_path for packages to be upgraded" echo "Step 2: Update srpm_path for packages to be upgraded"
@ -11,7 +21,7 @@ usage () {
echo "Usage: " echo "Usage: "
echo " patch_rebase_2 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]" echo " patch_rebase_2 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]"
echo "" echo ""
echo "Assumes cgcs-centos-repo already has a working_branch commit that sets the new symlinks." echo "Assumes $(basename ${CENTOS_REPO}) already has a working_branch commit that sets the new symlinks."
echo "" echo ""
echo "The upversion_data file has data on all the src.rpm being updated in the format:" echo "The upversion_data file has data on all the src.rpm being updated in the format:"
echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log" echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log"

View File

@ -4,6 +4,16 @@
# Start an edit session for packages to be upgraded - post upgrade version # Start an edit session for packages to be upgraded - post upgrade version
# #
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
usage () { usage () {
echo "" echo ""
echo "Step 3: Start an edit session for packages to be upgraded - post upgrade version" echo "Step 3: Start an edit session for packages to be upgraded - post upgrade version"
@ -11,7 +21,7 @@ usage () {
echo "Usage: " echo "Usage: "
echo " patch_rebase_3 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]" echo " patch_rebase_3 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]"
echo "" echo ""
echo "Assumes cgcs-centos-repo already has a working_branch commit that sets the new symlinks." echo "Assumes $(basename ${CENTOS_REPO}) already has a working_branch commit that sets the new symlinks."
echo "" echo ""
echo "The upversion_data file has data on all the src.rpm being updated in the format:" echo "The upversion_data file has data on all the src.rpm being updated in the format:"
echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log" echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log"
@ -86,10 +96,10 @@ if [ "$WORKING_BRANCH" == "" ]; then
fi fi
# One step back to see the old symlinks # One step back to see the old symlinks
cd $MY_REPO/cgcs-centos-repo cd ${CENTOS_REPO}
git checkout $WORKING_BRANCH git checkout $WORKING_BRANCH
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-centos-repo'" echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '${CENTOS_REPO}'"
exit 1 exit 1
fi fi

View File

@ -4,6 +4,16 @@
# Migrate Titanium Cloud patches to the new package version # Migrate Titanium Cloud patches to the new package version
# #
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
usage () { usage () {
echo "" echo ""
echo "Step 4: Migrate Titanium Cloud patches to the new package version" echo "Step 4: Migrate Titanium Cloud patches to the new package version"
@ -11,7 +21,7 @@ usage () {
echo "Usage: " echo "Usage: "
echo " patch_rebase_4 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]" echo " patch_rebase_4 [--origin_branch <branch>] [--working_branch <branch>] [--upversion_data <file>]"
echo "" echo ""
echo "Assumes cgcs-centos-repo already has a working_branch commit that sets the new symlinks." echo "Assumes $(basename ${CENTOS_REPO}) already has a working_branch commit that sets the new symlinks."
echo "" echo ""
echo "The upversion_data file has data on all the src.rpm being updated in the format:" echo "The upversion_data file has data on all the src.rpm being updated in the format:"
echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log" echo " export UPVERSION_DATA=$MY_WORKSPACE/upversion.log"
@ -92,10 +102,10 @@ if [ "$DISPLAY" == "" ]; then
fi fi
# One step back to see the old symlinks # One step back to see the old symlinks
cd $MY_REPO/cgcs-centos-repo cd ${CENTOS_REPO}
git checkout $WORKING_BRANCH git checkout $WORKING_BRANCH
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '$MY_REPO/cgcs-centos-repo'" echo "ERROR: Can't checkout branch '$WORKING_BRANCH' in directory '${CENTOS_REPO}'"
exit 1 exit 1
fi fi

View File

@ -3257,7 +3257,7 @@ srpm_canonical_path_single () {
local path="$1" local path="$1"
local canonical_path local canonical_path
if [[ "${path}" =~ /stx/downloads/|/cgcs-centos-repo/ ]]; then if [[ "${path}" =~ /stx/downloads/|/centos-repo/|/cgcs-centos-repo/ ]]; then
# Expand all but final symlink. # Expand all but final symlink.
# These symlinks often point outside of the source code repository. # These symlinks often point outside of the source code repository.
canonical_path="$(readlink -f "$(dirname "${path}")")" canonical_path="$(readlink -f "$(dirname "${path}")")"
@ -3390,7 +3390,7 @@ srpm_source_file_list () {
local SRPM_OR_SPEC_PATH="$2" local SRPM_OR_SPEC_PATH="$2"
local INPUT_FILES_SORTED="$3" local INPUT_FILES_SORTED="$3"
LINK_FILTER='\([/]stx[/]downloads[/]\|[/]cgcs-centos-repo[/]\)' LINK_FILTER='\([/]stx[/]downloads[/]\|[/]centos-repo[/]\|[/]cgcs-centos-repo[/]\)'
local INPUT_FILES local INPUT_FILES
local INPUT_LINKS local INPUT_LINKS
local INPUT_SOURCES local INPUT_SOURCES

View File

@ -138,9 +138,11 @@ for build_type in std rt; do
sleep 1 sleep 1
rsync -r ${JENKINSURL}/$build_type/rpmbuild/SRPMS/* $MY_WORKSPACE/$build_type/rpmbuild/SRPMS rsync -r ${JENKINSURL}/$build_type/rpmbuild/SRPMS/* $MY_WORKSPACE/$build_type/rpmbuild/SRPMS
sleep 1 sleep 1
rsync ${JENKINSURL}/$build_type/centos-repo.last_head $MY_WORKSPACE/$build_type
rsync ${JENKINSURL}/$build_type/cgcs-centos-repo.last_head $MY_WORKSPACE/$build_type rsync ${JENKINSURL}/$build_type/cgcs-centos-repo.last_head $MY_WORKSPACE/$build_type
rsync ${JENKINSURL}/$build_type/cgcs-3rd-party-repo.last_head $MY_WORKSPACE/$build_type rsync ${JENKINSURL}/$build_type/cgcs-3rd-party-repo.last_head $MY_WORKSPACE/$build_type
if [ "$build_type" == "std" ]; then if [ "$build_type" == "std" ]; then
cp $MY_WORKSPACE/$build_type/centos-repo.last_head $MY_REPO/centos-repo/.last_head
cp $MY_WORKSPACE/$build_type/cgcs-centos-repo.last_head $MY_REPO/cgcs-centos-repo/.last_head cp $MY_WORKSPACE/$build_type/cgcs-centos-repo.last_head $MY_REPO/cgcs-centos-repo/.last_head
cp $MY_WORKSPACE/$build_type/cgcs-3rd-party-repo.last_head $MY_REPO/cgcs-3rd-party-repo/.last_head cp $MY_WORKSPACE/$build_type/cgcs-3rd-party-repo.last_head $MY_REPO/cgcs-3rd-party-repo/.last_head
fi fi

View File

@ -129,7 +129,7 @@ for build_type in std rt; do
sleep 1 sleep 1
rsync -r ${JENKINSURL}/$build_type/rpmbuild/SRPMS/* $MY_WORKSPACE/$build_type/rpmbuild/SRPMS rsync -r ${JENKINSURL}/$build_type/rpmbuild/SRPMS/* $MY_WORKSPACE/$build_type/rpmbuild/SRPMS
sleep 1 sleep 1
for sub_repo in cgcs-centos-repo cgcs-tis-repo cgcs-3rd-party-repo; do for sub_repo in centos-repo cgcs-centos-repo cgcs-tis-repo cgcs-3rd-party-repo; do
rsync ${JENKINSURL}/$build_type/$sub_repo.last_head $MY_WORKSPACE/$build_type rsync ${JENKINSURL}/$build_type/$sub_repo.last_head $MY_WORKSPACE/$build_type
if [ "$build_type" == "std" ]; then if [ "$build_type" == "std" ]; then
cp $MY_WORKSPACE/$build_type/$sub_repo.last_head $MY_REPO/$sub_repo/.last_head cp $MY_WORKSPACE/$build_type/$sub_repo.last_head $MY_REPO/$sub_repo/.last_head

View File

@ -133,23 +133,33 @@ fi
# Update the vanilla UEFI Centos grub.cfg with the Titanium Cloud version # Update the vanilla UEFI Centos grub.cfg with the Titanium Cloud version
${SUDOPREFIX} cp "$BSP_FILES_PATH/grub.cfg" "$EFI_MOUNT/EFI/BOOT/grub.cfg" ${SUDOPREFIX} cp "$BSP_FILES_PATH/grub.cfg" "$EFI_MOUNT/EFI/BOOT/grub.cfg"
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
# Update the grub and shim executables with the Titanium Cloud signed versions # Update the grub and shim executables with the Titanium Cloud signed versions
# #
# To do this, we extract the RPMS, grab the two executables we need, and replace # To do this, we extract the RPMS, grab the two executables we need, and replace
# the ones in the current filesystem # the ones in the current filesystem
TMPDIR=`mktemp -d` TMPDIR=`mktemp -d`
SHIMPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS $MY_REPO/cgcs-centos-repo/Binary -name 'shim-x64-[0-9]*.x86_64.rpm'` SHIMPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS ${CENTOS_REPO}/Binary -name 'shim-x64-[0-9]*.x86_64.rpm'`
if [ -z "$SHIMPKG" ]; then if [ -z "$SHIMPKG" ]; then
SHIMPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS $MY_REPO/cgcs-centos-repo/Binary -name 'shim-[0-9]*.x86_64.rpm'` SHIMPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS ${CENTOS_REPO}/Binary -name 'shim-[0-9]*.x86_64.rpm'`
fi fi
if [ -z "$SHIMPKG" ]; then if [ -z "$SHIMPKG" ]; then
printf " Error -- could not locate shim binary package" printf " Error -- could not locate shim binary package"
exit 1 exit 1
fi fi
GRUBPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS $MY_REPO/cgcs-centos-repo/Binary -name 'grub2-efi-x64-[0-9]*.x86_64.rpm'` GRUBPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS ${CENTOS_REPO}/Binary -name 'grub2-efi-x64-[0-9]*.x86_64.rpm'`
if [ -z "$GRUBPKG" ]; then if [ -z "$GRUBPKG" ]; then
GRUBPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS $MY_REPO/cgcs-centos-repo/Binary -name 'grub2-efi-[0-9]*.x86_64.rpm'` GRUBPKG=`find $MY_WORKSPACE/std/rpmbuild/RPMS ${CENTOS_REPO}/Binary -name 'grub2-efi-[0-9]*.x86_64.rpm'`
fi fi
if [ -z "$GRUBPKG" ]; then if [ -z "$GRUBPKG" ]; then
printf " Error -- could not locate grub binary package" printf " Error -- could not locate grub binary package"

View File

@ -3,6 +3,16 @@
## based on RPMs generated by "build-pkgs" and "build-iso" ## based on RPMs generated by "build-pkgs" and "build-iso"
## created by Yong Hu (yong.hu@intel.com), 05/24/2018 ## created by Yong Hu (yong.hu@intel.com), 05/24/2018
# For backward compatibility. Old repo location or new?
CENTOS_REPO=${MY_REPO}/centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
CENTOS_REPO=${MY_REPO}/cgcs-centos-repo
if [ ! -d ${CENTOS_REPO} ]; then
echo "ERROR: directory ${MY_REPO}/centos-repo not found."
exit 1
fi
fi
find_and_copy_rpm () { find_and_copy_rpm () {
local name="${1}" local name="${1}"
local pattern="${2}" local pattern="${2}"
@ -13,9 +23,9 @@ find_and_copy_rpm () {
found=$(find $MY_BUILD_DIR/${build_type}/rpmbuild/RPMS -type f -name "${pattern}" | head -n 1) found=$(find $MY_BUILD_DIR/${build_type}/rpmbuild/RPMS -type f -name "${pattern}" | head -n 1)
if [ ! -n "${found}" ];then if [ ! -n "${found}" ];then
if [ "${build_type}" != "rt" ]; then if [ "${build_type}" != "rt" ]; then
found=$(find $MY_REPO/cgcs-centos-repo/Binary -type l -name "${pattern}" | head -n 1) found=$(find ${CENTOS_REPO}/Binary -type l -name "${pattern}" | head -n 1)
else else
found=$(find $MY_REPO/cgcs-centos-repo/${build_type}/Binary -type l -name "${pattern}" | head -n 1) found=$(find ${CENTOS_REPO}/${build_type}/Binary -type l -name "${pattern}" | head -n 1)
fi fi
fi fi
@ -40,13 +50,12 @@ fi
cd $pxe_network_installer_dir cd $pxe_network_installer_dir
echo "step 1: copy original images: vmlinuz, initrd.img, squashfs.img" echo "step 1: copy original images: vmlinuz, initrd.img, squashfs.img"
CENTOS_REPO="cgcs-centos-repo"
orig_img_dir="orig" orig_img_dir="orig"
if [ ! -d $orig_img_dir ];then if [ ! -d $orig_img_dir ];then
mkdir -p $orig_img_dir mkdir -p $orig_img_dir
fi fi
orig_initrd_img="$MY_REPO/$CENTOS_REPO/Binary/images/pxeboot/initrd.img" orig_initrd_img="${CENTOS_REPO}/Binary/images/pxeboot/initrd.img"
if [ -f $orig_initrd_img ]; then if [ -f $orig_initrd_img ]; then
cp -f $orig_initrd_img $pxe_network_installer_dir/$orig_img_dir/. cp -f $orig_initrd_img $pxe_network_installer_dir/$orig_img_dir/.
else else
@ -54,7 +63,7 @@ else
exit -1 exit -1
fi fi
orig_squashfs_img="$MY_REPO/$CENTOS_REPO/Binary/LiveOS/squashfs.img" orig_squashfs_img="$i{CENTOS_REPO}/Binary/LiveOS/squashfs.img"
if [ -f $orig_squashfs_img ]; then if [ -f $orig_squashfs_img ]; then
cp -f $orig_squashfs_img $pxe_network_installer_dir/$orig_img_dir/. cp -f $orig_squashfs_img $pxe_network_installer_dir/$orig_img_dir/.
else else