Commit fa47db5ccc8cf638b1cb20edf2de93903beedf23

Thomas de Grivel 2023-02-15T02:55:41

wip shpkg_ci

diff --git a/bin/shpkg_ci b/bin/shpkg_ci
index 38317c0..51ee946 100755
--- a/bin/shpkg_ci
+++ b/bin/shpkg_ci
@@ -10,14 +10,12 @@ set -e
 
 . "${SHPKG_DIR}/share/shpkg/shpkg.subr"
 
-verbose 2 shpkg_config
+shpkg_config
 
 verbose 2 shpkg_lock shpkg_ci.lock
 
 verbose 2 shpkg_upgrade
 
-# Configuration
-
 log_status () {
     STATUS_FILE="${SHPKG_CI_STATUS_DIR}/$(basename "$1" .log).status"
     if [ -f "${STATUS_FILE}" ]; then
@@ -75,12 +73,6 @@ logs2html () {
 }
 
 main () {
-    if ! [ -d "${SHPKG_CI_LOG_DIR}" ]; then
-        verbose 1 mkdir -p "${SHPKG_CI_LOG_DIR}"
-    fi
-    if ! [ -d "${SHPKG_CI_STATUS_DIR}" ]; then
-        verbose 1 mkdir -p "${SHPKG_CI_STATUS_DIR}"
-    fi
     verbose 2 shpkg_ci_status "shpkg_ci.status" running
     for SHPKG_REPO; do
         SHPKG_REPO_DIR="$(shpkg_dir "${SHPKG_REPO}")"
@@ -102,11 +94,11 @@ main () {
         verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.branch_${SHPKG_REPO_GIT_BRANCH}.status" running
         verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.commit_${SHPKG_REPO_HASH}.status" running
         SHPKG_REPO_BUILD_DIR="${SHPKG_CI_BUILD_DIR}/${SHPKG_REPO}"
-        # first bootstrap
         if ! [ -d "${SHPKG_REPO_BUILD_DIR}" ]; then
+            # first bootstrap
             ( verbose 2 shpkg_bootstrap "${SHPKG_REPO_BUILD_DIR}"; )
         else
-            # check upgrade
+            # run shpkg upgrade
             ( . "${SHPKG_REPO_BUILD_DIR}/etc/shpkg/profile"
               verbose 2 shpkg_ci_status "${SHPKG_REPO}.upgrade.status" running
               if verbose 2 shpkg upgrade "${SHPKG_REPO}"; then
diff --git a/share/shpkg/shpkg.subr b/share/shpkg/shpkg.subr
index 0f5af65..98a9895 100644
--- a/share/shpkg/shpkg.subr
+++ b/share/shpkg/shpkg.subr
@@ -177,7 +177,7 @@ shpkg_config () {
     else
         SHPKG_NCPU=1
     fi
-    verbose -n 2 "Detected ${SHPKG_NCPU} CPU cores."
+    verbose -n 2 "${SHPKG_NCPU} CPU cores."
     # SHA256
     if which sha256 >/dev/null 2>&1; then
         SHPKG_SHA256=sha256
@@ -192,6 +192,12 @@ shpkg_config () {
     SHPKG_CI_LOG_DIR="${SHPKG_CI_DIR}/log/${SHPKG_OS_}/${SHPKG_TARGET}"
     SHPKG_CI_STATUS_DIR="${SHPKG_CI_DIR}/status/${SHPKG_OS_}/${SHPKG_TARGET}"
     # Directories
+    if ! [ -d "${SHPKG_CI_LOG_DIR}" ]; then
+        verbose 1 mkdir -p "${SHPKG_CI_LOG_DIR}"
+    fi
+    if ! [ -d "${SHPKG_CI_STATUS_DIR}" ]; then
+        verbose 1 mkdir -p "${SHPKG_CI_STATUS_DIR}"
+    fi
     if ! [ -d "${SHPKG_FAKE_DIR}" ]; then
         verbose 1 mkdir -p "${SHPKG_FAKE_DIR}"
     fi