From bac6e3a2d70d1c757f4ee3a51dcad1ef89cca922 Mon Sep 17 00:00:00 2001 From: "Jorge Manuel B. S. Vicetto (jmbsvicetto)" Date: Thu, 5 May 2016 10:07:20 +0000 Subject: [PATCH] Move the code to update symlinks to a separate function, call it from pre_build and after each set build. Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) --- tools/catalyst-auto | 10 +++++++++- tools/catalyst-auto-amd64.conf | 13 ++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/catalyst-auto b/tools/catalyst-auto index b928ac98..cc4da35e 100755 --- a/tools/catalyst-auto +++ b/tools/catalyst-auto @@ -81,6 +81,13 @@ run_cmd() { fi } +update_symlinks() { + # This is a skeleton function that you can override from the config file. + # It will be called by pre_build and after completing the build of a set + # to ensure the symlinks point to the latest built stages. + local foo=bar +} + 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 @@ -246,7 +253,7 @@ for i in $(find -name '*.spec'); do sed -i 's|^snapshot:.*$|snapshot: '${DATESTAMP}'|' ${i} # We don't want to mangle the source_subpath for our stage1 spec - if ! grep -q '^target: *stage1$' ${i}; then + if ! [[grep -q '^target: *stage1$' ${i} || grep -q '^target: *stage4$' ${i} ]]; then sed -i 's|^source_subpath:.*$|source_subpath: '${new_source_subpath}'|' ${i} fi @@ -329,6 +336,7 @@ for a in "" ${SETS}; do run_cmd "time catalyst -P -c ${CATALYST_CONFIG} -f ${i}" "${LOGFILE}" done + update_symlinks done if ! run_cmd "post_build" "${TMPDIR}/log/post_build.log"; then diff --git a/tools/catalyst-auto-amd64.conf b/tools/catalyst-auto-amd64.conf index 48dd9cfe..80bf8b78 100644 --- a/tools/catalyst-auto-amd64.conf +++ b/tools/catalyst-auto-amd64.conf @@ -59,11 +59,7 @@ give_latest_from_dates() { tr '~' '-' } -pre_build() { - pushd ${REPO_DIR} - git pull - popd - +update_symlinks() { # Symlink the latest stages3 to build from for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do pushd $d @@ -76,6 +72,13 @@ pre_build() { done } +pre_build() { + pushd ${REPO_DIR} + git pull + popd + update_symlinks +} + post_build() { pushd ${BUILD_SRCDIR_BASE}/default mkdir -p ${BUILD_DESTDIR_BASE}