commit:     bac6e3a2d70d1c757f4ee3a51dcad1ef89cca922
Author:     Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo 
<DOT> org>
AuthorDate: Thu May  5 10:07:20 2016 +0000
Commit:     Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org>
CommitDate: Thu May  5 10:07:20 2016 +0000
URL:        https://gitweb.gentoo.org/proj/releng.git/commit/?id=bac6e3a2

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) <jmbsvicetto <AT> 
gentoo.org>

 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 b928ac9..cc4da35 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 48dd9cf..80bf8b7 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}

Reply via email to