Build script readiness for renaming cgcs-tis-repo to local-repo
I want the build to work with either local-repo or cgcs-tis-repo. In many places we will be testing for the existance local-repo as the prefered path, then fall back to cgcs-tis-repo as an alternative. If neither are present, either exit or continue but assuming the new path is intended. Story: 2006387 Task: 36910 Change-Id: I2e97dc8cd5d4a54158d4b1cefeecd2000ec11cf2 Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
parent
01c5009d7d
commit
d81920c349
@ -39,8 +39,18 @@ fi
|
|||||||
export TMPDIR=$MY_WORKSPACE/tmp
|
export TMPDIR=$MY_WORKSPACE/tmp
|
||||||
mkdir -p $TMPDIR
|
mkdir -p $TMPDIR
|
||||||
|
|
||||||
|
# Old repo path or new?
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
LOCAL_REPO=${MY_REPO}/cgcs-tis-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
# This one isn't fatal, LOCAL_REPO is not required
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Make sure we have a dependency cache
|
# Make sure we have a dependency cache
|
||||||
DEP_CACHE="$MY_REPO/cgcs-tis-repo/dependancy-cache"
|
DEP_CACHE="${LOCAL_REPO}/dependancy-cache"
|
||||||
|
|
||||||
BUILD_TYPES=(" std rt installer containers")
|
BUILD_TYPES=(" std rt installer containers")
|
||||||
DEP_RPM_TYPE=(" RPMS SRPMS ")
|
DEP_RPM_TYPE=(" RPMS SRPMS ")
|
||||||
|
@ -68,7 +68,18 @@ if [ $? -ne 0 ]; then
|
|||||||
CREATEREPO="createrepo"
|
CREATEREPO="createrepo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEPENDANCY_DIR="$MY_REPO/cgcs-tis-repo/dependancy-cache"
|
# Old repo path or new?
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
LOCAL_REPO=${MY_REPO}/cgcs-tis-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
# This one isn't fatal, LOCAL_REPO is not required
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure we have a dependency cache
|
||||||
|
DEPENDANCY_DIR="${LOCAL_REPO}/dependancy-cache"
|
||||||
SRPM_DIRECT_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-direct-requires"
|
SRPM_DIRECT_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-direct-requires"
|
||||||
SRPM_TRANSITIVE_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-transitive-requires"
|
SRPM_TRANSITIVE_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-transitive-requires"
|
||||||
SRPM_TRANSITIVE_DESCENDANTS_FILE="$DEPENDANCY_DIR/SRPM-transitive-descendants"
|
SRPM_TRANSITIVE_DESCENDANTS_FILE="$DEPENDANCY_DIR/SRPM-transitive-descendants"
|
||||||
|
@ -32,7 +32,17 @@ if [ $? -ne 0 ]; then
|
|||||||
CREATEREPO="createrepo"
|
CREATEREPO="createrepo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEPENDANCY_DIR="$MY_REPO/cgcs-tis-repo/dependancy-cache"
|
# Old repo path or new?
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
LOCAL_REPO=${MY_REPO}/cgcs-tis-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
# This one isn't fatal, LOCAL_REPO is not required
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEPENDANCY_DIR="${LOCAL_REPO}/dependancy-cache"
|
||||||
SRPM_DIRECT_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-direct-requires"
|
SRPM_DIRECT_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-direct-requires"
|
||||||
SRPM_TRANSITIVE_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-transitive-requires"
|
SRPM_TRANSITIVE_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-transitive-requires"
|
||||||
SRPM_TRANSITIVE_DESCENDANTS_FILE="$DEPENDANCY_DIR/SRPM-transitive-descendants"
|
SRPM_TRANSITIVE_DESCENDANTS_FILE="$DEPENDANCY_DIR/SRPM-transitive-descendants"
|
||||||
|
@ -15,13 +15,22 @@ if [ ! -d ${CENTOS_REPO} ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
LOCAL_REPO=${MY_REPO}/cgcs-tis-repo
|
||||||
|
if [ ! -d ${LOCAL_REPO} ]; then
|
||||||
|
# This one isn't fatal, LOCAL_REPO is not required
|
||||||
|
LOCAL_REPO=${MY_REPO}/local-repo
|
||||||
|
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 ${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 ${LOCAL_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 '{}' .
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DEST_DIR="$MY_REPO/cgcs-tis-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-tis-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
|
|
||||||
echo "mkdir -p $RELATIVE_DIR"
|
|
||||||
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/..
|
|
||||||
rm -rf repodata
|
|
||||||
if [ -f comps.xml ]; then
|
|
||||||
$CREATEREPO -g comps.xml `pwd`
|
|
||||||
else
|
|
||||||
$CREATEREPO `pwd`
|
|
||||||
fi
|
|
||||||
)
|
|
||||||
done
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
|||||||
# 1) $MY_REPO/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/local-repo/dependancy-cache
|
||||||
# unless an alternate path is supplied.
|
# unless an alternate path is supplied.
|
||||||
#
|
#
|
||||||
# The cache is a set of files that are easily digested by
|
# The cache is a set of files that are easily digested by
|
||||||
@ -41,6 +41,7 @@
|
|||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import gzip
|
import gzip
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
@ -65,7 +66,8 @@ if not os.path.isdir(repodata_dir):
|
|||||||
print("ERROR: directory not found %s" % repodata_dir)
|
print("ERROR: directory not found %s" % repodata_dir)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
publish_cache_dir="%s/cgcs-tis-repo/dependancy-cache" % os.environ['MY_REPO']
|
old_cache_dir="%s/cgcs-tis-repo/dependancy-cache" % os.environ['MY_REPO']
|
||||||
|
publish_cache_dir="%s/local-repo/dependancy-cache" % os.environ['MY_REPO']
|
||||||
|
|
||||||
workspace_repo_dirs={}
|
workspace_repo_dirs={}
|
||||||
for rt in rpm_types:
|
for rt in rpm_types:
|
||||||
@ -115,8 +117,13 @@ if options.third_party_repo_dir:
|
|||||||
|
|
||||||
# Create directory if required
|
# Create directory if required
|
||||||
if not os.path.isdir(publish_cache_dir):
|
if not os.path.isdir(publish_cache_dir):
|
||||||
print("Creating directory: %s" % publish_cache_dir)
|
if os.path.isdir(old_cache_dir):
|
||||||
os.makedirs(publish_cache_dir, 0o755)
|
print("Relocating old dependency directory: %s -> %s" % (old_cache_dir, publish_cache_dir))
|
||||||
|
os.makedirs(os.path.abspath(os.path.join(publish_cache_dir, os.pardir)))
|
||||||
|
shutil.move(old_cache_dir, publish_cache_dir)
|
||||||
|
else:
|
||||||
|
print("Creating directory: %s" % publish_cache_dir)
|
||||||
|
os.makedirs(publish_cache_dir, 0o755)
|
||||||
|
|
||||||
# The Main data structure
|
# The Main data structure
|
||||||
pkg_data={}
|
pkg_data={}
|
||||||
|
@ -129,9 +129,10 @@ 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 centos-repo cgcs-centos-repo cgcs-tis-repo cgcs-3rd-party-repo; do
|
# Some of there directories might not exist (obsolete). Just do our best and ignore errors
|
||||||
|
for sub_repo in centos-repo cgcs-centos-repo local-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 [ $? -eq 0 ] && [ "$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
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user