catalyst-auto: move git update into main script

All of our config files are doing this already, so move it into the
common code.
This commit is contained in:
Mike Frysinger 2018-01-15 20:17:43 -05:00
parent 04b56eaab3
commit a8e70e1976
20 changed files with 29 additions and 61 deletions

View file

@ -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 "$@"

View file

@ -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

View file

@ -72,9 +72,6 @@ update_symlinks() {
}
pre_build() {
pushd ${REPO_DIR} >/dev/null
git pull
popd >/dev/null
update_symlinks
}

View file

@ -76,9 +76,6 @@ update_symlinks() {
}
pre_build() {
pushd ${REPO_DIR} >/dev/null
git pull
popd >/dev/null
update_symlinks
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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