diff --git a/build-tools/build-pkgs b/build-tools/build-pkgs index 21a98db0..edd980f8 100755 --- a/build-tools/build-pkgs +++ b/build-tools/build-pkgs @@ -39,8 +39,18 @@ fi export TMPDIR=$MY_WORKSPACE/tmp 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 -DEP_CACHE="$MY_REPO/cgcs-tis-repo/dependancy-cache" +DEP_CACHE="${LOCAL_REPO}/dependancy-cache" BUILD_TYPES=(" std rt installer containers") DEP_RPM_TYPE=(" RPMS SRPMS ") diff --git a/build-tools/build-rpms-parallel b/build-tools/build-rpms-parallel index d040e051..f9728acc 100755 --- a/build-tools/build-rpms-parallel +++ b/build-tools/build-rpms-parallel @@ -68,7 +68,18 @@ if [ $? -ne 0 ]; then CREATEREPO="createrepo" 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_TRANSITIVE_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-transitive-requires" SRPM_TRANSITIVE_DESCENDANTS_FILE="$DEPENDANCY_DIR/SRPM-transitive-descendants" diff --git a/build-tools/build-rpms-serial b/build-tools/build-rpms-serial index acc3d9e4..f2d1acc6 100755 --- a/build-tools/build-rpms-serial +++ b/build-tools/build-rpms-serial @@ -32,7 +32,17 @@ if [ $? -ne 0 ]; then CREATEREPO="createrepo" 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_TRANSITIVE_REQUIRES_FILE="$DEPENDANCY_DIR/SRPM-transitive-requires" SRPM_TRANSITIVE_DESCENDANTS_FILE="$DEPENDANCY_DIR/SRPM-transitive-descendants" diff --git a/build-tools/build_minimal_iso/build.sh b/build-tools/build_minimal_iso/build.sh index f8e0ce5e..7bf9e7a5 100755 --- a/build-tools/build_minimal_iso/build.sh +++ b/build-tools/build_minimal_iso/build.sh @@ -15,13 +15,22 @@ if [ ! -d ${CENTOS_REPO} ]; then 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 # RPM and copy it to the local directory. This should not be required normally # and is only used when collecting the source RPMs initially. function findSrc { local lookingFor=$1 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 '{}' . } diff --git a/build-tools/create-cgcs-tis-repo b/build-tools/create-cgcs-tis-repo deleted file mode 100755 index b9858cd5..00000000 --- a/build-tools/create-cgcs-tis-repo +++ /dev/null @@ -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 - diff --git a/build-tools/create_dependancy_cache.py b/build-tools/create_dependancy_cache.py index 3518d8ba..0226bb31 100755 --- a/build-tools/create_dependancy_cache.py +++ b/build-tools/create_dependancy_cache.py @@ -11,7 +11,7 @@ # 1) $MY_REPO/centos-repo # 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. # # The cache is a set of files that are easily digested by @@ -41,6 +41,7 @@ import xml.etree.ElementTree as ET import fnmatch import os +import shutil import gzip import sys import string @@ -65,7 +66,8 @@ if not os.path.isdir(repodata_dir): print("ERROR: directory not found %s" % repodata_dir) 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={} for rt in rpm_types: @@ -115,8 +117,13 @@ if options.third_party_repo_dir: # Create directory if required if not os.path.isdir(publish_cache_dir): - print("Creating directory: %s" % publish_cache_dir) - os.makedirs(publish_cache_dir, 0o755) + if os.path.isdir(old_cache_dir): + 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 pkg_data={} diff --git a/build-tools/sync_jenkins.sh b/build-tools/sync_jenkins.sh index 5bef23d9..96e50ce2 100755 --- a/build-tools/sync_jenkins.sh +++ b/build-tools/sync_jenkins.sh @@ -129,9 +129,10 @@ for build_type in std rt; do sleep 1 rsync -r ${JENKINSURL}/$build_type/rpmbuild/SRPMS/* $MY_WORKSPACE/$build_type/rpmbuild/SRPMS 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 - 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 fi done