diff options
author | Mike Frysinger <vapier@gentoo.org> | 2018-01-15 20:17:43 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2018-01-15 20:17:43 -0500 |
commit | a8e70e197696b8feee4dd8aa2c785770113bb5c3 (patch) | |
tree | 68e64d019f9adea2a3ed2906e7e0a873e9a3d1e5 /tools | |
parent | catalyst-auto: move container logic into a func too (diff) | |
download | releng-a8e70e197696b8feee4dd8aa2c785770113bb5c3.tar.gz releng-a8e70e197696b8feee4dd8aa2c785770113bb5c3.tar.bz2 releng-a8e70e197696b8feee4dd8aa2c785770113bb5c3.zip |
catalyst-auto: move git update into main script
All of our config files are doing this already, so move it into the
common code.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/catalyst-auto | 31 | ||||
-rw-r--r-- | tools/catalyst-auto-alpha.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-amd64-experimental.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-amd64.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-arm64.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-armv4tl.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-armv5tel.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-armv6j.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-armv6j_hardfp.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-armv7a.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-armv7a_hardfp.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-hppa.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-ia64.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-ppc.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-ppc64.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-s390.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-s390x.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-sparc64.conf | 3 | ||||
-rw-r--r-- | tools/catalyst-auto-x86-experimental.conf | 4 | ||||
-rw-r--r-- | tools/catalyst-auto-x86.conf | 4 |
20 files changed, 29 insertions, 61 deletions
diff --git a/tools/catalyst-auto b/tools/catalyst-auto index c06a42bf..cd23d159 100755 --- a/tools/catalyst-auto +++ b/tools/catalyst-auto @@ -93,8 +93,7 @@ update_symlinks() { pre_build() { # This is a skeleton function that you can override from the config file. - # It will be executed before the build is started. You can use this to - # update the checkout of the releng repo + # It will be executed before the build is started. : } @@ -184,6 +183,31 @@ containerize() { fi } +# Update the git repo if possible. It might modify this script which will probably +# make bash fail (since bash parses as it executes). So we have to safely re-exec +# the script whenever there's an update. +git_update() { + # If we've already relaunched, nothing to do. + if [[ ${GIT_UPDATE} == "true" ]] ; then + return + fi + + pushd "${REPO_DIR}" >/dev/null + git fetch -q + revs=$(git rev-list HEAD..FETCH_HEAD) + popd >/dev/null + if [[ -n ${revs} ]] ; then + GIT_UPDATE=true exec bash -c ' + repo_dir=$1 script=$2 + shift 2 + pushd "${repo_dir}" >/dev/null + git merge FETCH_HEAD || echo "${script}: WARNING: git repo is dirty" + popd >/dev/null + exec "${script}" "$@" + ' -- "${REPO_DIR}" "$0" "$@" + fi +} + run_catalyst_commands() { doneconfig=0 for config_file in "${config_files[@]}"; do @@ -393,6 +417,9 @@ main() { # Parse user arguments before we try doing container logic. parse_args "$@" + # Update the release git dir if possible. + git_update "$@" + # Try to isolate ourselves from the rest of the system. containerize "$@" diff --git a/tools/catalyst-auto-alpha.conf b/tools/catalyst-auto-alpha.conf index 8edbaf5d..f72747ab 100644 --- a/tools/catalyst-auto-alpha.conf +++ b/tools/catalyst-auto-alpha.conf @@ -24,9 +24,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-amd64-experimental.conf b/tools/catalyst-auto-amd64-experimental.conf index 535f4fb5..e4766949 100644 --- a/tools/catalyst-auto-amd64-experimental.conf +++ b/tools/catalyst-auto-amd64-experimental.conf @@ -72,9 +72,6 @@ update_symlinks() { } pre_build() { - pushd ${REPO_DIR} >/dev/null - git pull - popd >/dev/null update_symlinks } diff --git a/tools/catalyst-auto-amd64.conf b/tools/catalyst-auto-amd64.conf index b92f8314..a2a0abdc 100644 --- a/tools/catalyst-auto-amd64.conf +++ b/tools/catalyst-auto-amd64.conf @@ -76,9 +76,6 @@ update_symlinks() { } pre_build() { - pushd ${REPO_DIR} >/dev/null - git pull - popd >/dev/null update_symlinks } diff --git a/tools/catalyst-auto-arm64.conf b/tools/catalyst-auto-arm64.conf index bede1247..f987eb9f 100644 --- a/tools/catalyst-auto-arm64.conf +++ b/tools/catalyst-auto-arm64.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d diff --git a/tools/catalyst-auto-armv4tl.conf b/tools/catalyst-auto-armv4tl.conf index 75fda247..dfa65886 100644 --- a/tools/catalyst-auto-armv4tl.conf +++ b/tools/catalyst-auto-armv4tl.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-armv5tel.conf b/tools/catalyst-auto-armv5tel.conf index 2a02f117..7ae17c0e 100644 --- a/tools/catalyst-auto-armv5tel.conf +++ b/tools/catalyst-auto-armv5tel.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-armv6j.conf b/tools/catalyst-auto-armv6j.conf index bf5c3aa0..950b7f03 100644 --- a/tools/catalyst-auto-armv6j.conf +++ b/tools/catalyst-auto-armv6j.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-armv6j_hardfp.conf b/tools/catalyst-auto-armv6j_hardfp.conf index 771f4454..86ae9ddb 100644 --- a/tools/catalyst-auto-armv6j_hardfp.conf +++ b/tools/catalyst-auto-armv6j_hardfp.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-armv7a.conf b/tools/catalyst-auto-armv7a.conf index 363188b3..33138ce6 100644 --- a/tools/catalyst-auto-armv7a.conf +++ b/tools/catalyst-auto-armv7a.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-armv7a_hardfp.conf b/tools/catalyst-auto-armv7a_hardfp.conf index e85ca6c0..55dae2e1 100644 --- a/tools/catalyst-auto-armv7a_hardfp.conf +++ b/tools/catalyst-auto-armv7a_hardfp.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-hppa.conf b/tools/catalyst-auto-hppa.conf index aa5fdde2..18ca85ff 100644 --- a/tools/catalyst-auto-hppa.conf +++ b/tools/catalyst-auto-hppa.conf @@ -29,9 +29,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-ia64.conf b/tools/catalyst-auto-ia64.conf index fc53d33e..9f059ee3 100644 --- a/tools/catalyst-auto-ia64.conf +++ b/tools/catalyst-auto-ia64.conf @@ -24,9 +24,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-ppc.conf b/tools/catalyst-auto-ppc.conf index 2a20e4c1..43d9809f 100644 --- a/tools/catalyst-auto-ppc.conf +++ b/tools/catalyst-auto-ppc.conf @@ -25,9 +25,6 @@ give_latest_from_dates() { } pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-ppc64.conf b/tools/catalyst-auto-ppc64.conf index fd169306..1dfe64a9 100644 --- a/tools/catalyst-auto-ppc64.conf +++ b/tools/catalyst-auto-ppc64.conf @@ -27,9 +27,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-s390.conf b/tools/catalyst-auto-s390.conf index 1f766eeb..e580032a 100644 --- a/tools/catalyst-auto-s390.conf +++ b/tools/catalyst-auto-s390.conf @@ -24,9 +24,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-s390x.conf b/tools/catalyst-auto-s390x.conf index a97a3f79..37e543f5 100644 --- a/tools/catalyst-auto-s390x.conf +++ b/tools/catalyst-auto-s390x.conf @@ -24,9 +24,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/default ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-sparc64.conf b/tools/catalyst-auto-sparc64.conf index f93796f0..cca8dd58 100644 --- a/tools/catalyst-auto-sparc64.conf +++ b/tools/catalyst-auto-sparc64.conf @@ -24,9 +24,6 @@ give_latest_from_dates() { pre_build() { - cd ${REPO_DIR} - git pull - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/builds/{default,multilib} ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-x86-experimental.conf b/tools/catalyst-auto-x86-experimental.conf index dd0c180d..e2c19761 100644 --- a/tools/catalyst-auto-x86-experimental.conf +++ b/tools/catalyst-auto-x86-experimental.conf @@ -38,10 +38,6 @@ give_latest_from_dates() { } pre_build() { - pushd ${REPO_DIR} >/dev/null - git pull - popd >/dev/null - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do pushd $d >/dev/null diff --git a/tools/catalyst-auto-x86.conf b/tools/catalyst-auto-x86.conf index deca9d07..286a9304 100644 --- a/tools/catalyst-auto-x86.conf +++ b/tools/catalyst-auto-x86.conf @@ -38,10 +38,6 @@ give_latest_from_dates() { } pre_build() { - pushd ${REPO_DIR} >/dev/null - git pull - popd >/dev/null - # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do pushd $d >/dev/null |