diff --git a/bin/shpkg_ci b/bin/shpkg_ci
index ed7476e..f7bfe27 100755
--- a/bin/shpkg_ci
+++ b/bin/shpkg_ci
@@ -14,9 +14,12 @@ verbose 2 shpkg_config
verbose 2 shpkg_lock shpkg_ci.lock
+verbose 2 shpkg_upgrade
+
# Configuration
-: ${SHPKG_CI_DIR:=~/shpkg_ci}
+: ${SHPKG_CI_DIR:=${SHPKG_DIR}/ci}
+SHPKG_CI_BUILD_DIR="${SHPKG_CI_DIR}/build"
SHPKG_CI_LOG_DIR="${SHPKG_CI_DIR}/log/${SHPKG_OS_}/${SHPKG_TARGET}"
SHPKG_CI_STATUS_DIR="${SHPKG_CI_DIR}/status/${SHPKG_OS_}/${SHPKG_TARGET}"
@@ -101,16 +104,27 @@ main () {
if [ "x${SHPKG_REPO_DIR}" = "x" ]; then
err 1 "shpkg_ci: unknown repo: $SHPKG_REPO"
fi
+ SHPKG_REPO_SRC_DIR="${SHPKG_SRC_DIR}/${SHPKG_REPO_DIR}"
+ if ! [ -d "${SHPKG_REPO_SRC_DIR}" ]; then
+ verbose 2 shpkg_clone "${SHPKG_REPO}"
+ else
+ verbose 2 shpkg_pull "${SHPKG_REPO}"
+ fi
SHPKG_REPO_GIT_BRANCH="$(shpkg_git_branch "${SHPKG_REPO}")"
+ SHPKG_REPO_HASH="$(shpkg_hash "${SHPKG_REPO}")"
verbose 2 shpkg_tag_log "${SHPKG_REPO}.ci.log"
+ verbose 2 shpkg_tag_log "${SHPKG_REPO}.ci.branch_${SHPKG_REPO_GIT_BRANCH}.log"
+ verbose 2 shpkg_tag_log "${SHPKG_REPO}.ci.commit_${SHPKG_REPO_HASH}.log"
verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.status" running
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_${SHPKG_REPO}" ]; then
- ( verbose 2 shpkg_bootstrap ~/"shpkg_${SHPKG_REPO}"; )
+ if ! [ -d "${SHPKG_REPO_BUILD_DIR}" ]; then
+ ( verbose 2 shpkg_bootstrap "${SHPKG_REPO_BUILD_DIR}"; )
else
# check upgrade
- ( . ~/"shpkg_${SHPKG_REPO}/etc/shpkg/profile"
+ ( . "${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
verbose 2 shpkg_ci_status "${SHPKG_REPO}.upgrade.status" ok
@@ -118,31 +132,27 @@ main () {
verbose 2 shpkg_ci_status "${SHPKG_REPO}.upgrade.status" ko
verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.status" ko
verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.branch_${SHPKG_REPO_GIT_BRANCH}.status" ko
+ verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.commit_${SHPKG_REPO_HASH}.status" ko
+ verbose 2 shpkg_ci_status "shpkg_ci.status" ko
fi; )
- if verbose 1 cp -p ~/"shpkg_${SHPKG_REPO}/var/log/shpkg/tags/${SHPKG_REPO}".*.log "${SHPKG_CI_LOG_DIR}"; then
+ if verbose 1 cp -p "${SHPKG_REPO_BUILD_DIR}/var/log/shpkg/tags/${SHPKG_REPO}".*.log "${SHPKG_CI_LOG_DIR}"; then
verbose 2 logs2html
fi
fi
- ( verbose 2 shpkg_bootstrap -f ~/"shpkg_${SHPKG_REPO}"; )
- ( . ~/"shpkg_${SHPKG_REPO}/etc/shpkg/profile"
+ ( verbose 2 shpkg_bootstrap -f "${SHPKG_REPO_BUILD_DIR}"; )
+ ( . "${SHPKG_REPO_BUILD_DIR}/etc/shpkg/profile"
verbose 2 shpkg_ci_status "${SHPKG_REPO}.install.status" running
if verbose 2 shpkg install "${SHPKG_REPO}"; then
verbose 2 shpkg_ci_status "${SHPKG_REPO}.install.status" ok
else
verbose 2 shpkg_ci_status "${SHPKG_REPO}.install.status" ko
verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.status" ko
- verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.branch_${SHPKG_REPO_GIT_BRANCH}.status" running
+ verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.branch_${SHPKG_REPO_GIT_BRANCH}.status" ko
+ verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.commit_${SHPKG_REPO_HASH}.status" ko
+ verbose 2 shpkg_ci_status "shpkg_ci.status" ko
fi; )
- SHPKG_REPO_HASH="$(shpkg_hash "${SHPKG_REPO}")"
- verbose 1 cp "${SHPKG_CI_STATUS_DIR}/${SHPKG_REPO}.ci.status" "${SHPKG_CI_STATUS_DIR}/${SHPKG_REPO}.ci.commit_${SHPKG_REPO_HASH}.status"
- SHPKG_CI_COPY=No
- if verbose 1 cp -p ~/"shpkg_${SHPKG_REPO}/var/log/shpkg/tags/${SHPKG_REPO}".*.log "${SHPKG_CI_LOG_DIR}"; then
- SHPKG_CI_COPY=Yes
- fi
- if verbose 1 cp -p ~/"shpkg/var/log/shpkg/tags/${SHPKG_REPO}.ci.log" "${SHPKG_CI_LOG_DIR}"; then
- SHPKG_CI_COPY=Yes
- fi
- if [ "x${SHPKG_CI_COPY}" = "xYes" ]; then
+ if verbose 1 cp -p "${SHPKG_REPO_BUILD_DIR}/var/log/shpkg/tags/${SHPKG_REPO}".*.log "${SHPKG_CI_LOG_DIR}" ||
+ verbose 1 cp -p "${SHPKG_DIR}/var/log/shpkg/tags/${SHPKG_REPO}.ci.log" "${SHPKG_CI_LOG_DIR}"; then
verbose 2 logs2html
fi
verbose 2 shpkg_ci_status "${SHPKG_REPO}.ci.status" ok
diff --git a/share/shpkg/shpkg.subr b/share/shpkg/shpkg.subr
index 86c3c26..6b5c849 100644
--- a/share/shpkg/shpkg.subr
+++ b/share/shpkg/shpkg.subr
@@ -83,8 +83,9 @@ shpkg_redirect_err () {
shpkg_start_logging () {
SHPKG_LOG_ALL_DIR="${SHPKG_LOG_DIR}/all"
- SHPKG_LOG="${SHPKG_LOG_ALL_DIR}/$1_${SHPKG_DATE}_$$.log"
- SHPKG_LOG_RELATIVE="../all/$(basename "${SHPKG_LOG}")"
+ SHPKG_LOG_NAME="$1_${SHPKG_DATE}_$$.log"
+ SHPKG_LOG="${SHPKG_LOG_ALL_DIR}/${SHPKG_LOG_NAME}"
+ SHPKG_LOG_RELATIVE="../all/${SHPKG_LOG_NAME}"
SHPKG_LOG_TAGS_DIR="${SHPKG_LOG_DIR}/tags"
SHPKG_LOG_TMP_DIR="${SHPKG_LOG_DIR}/tmp"
if [ -f "${SHPKG_LOG}" ]; then
@@ -347,7 +348,7 @@ shpkg_clean_sources () {
shpkg_hash () {
SHPKG_REPO_DIR="$(shpkg_dir "$1")"
if [ "x${SHPKG_REPO_DIR}" = "x" ]; then
- err 1 "shpkg_version: unknown repo: $SHPKG_REPO"
+ err 1 "shpkg_hash: unknown repo: $1"
fi
SHPKG_REPO_SRC_DIR="${SHPKG_SRC_DIR}/${SHPKG_REPO_DIR}"
if [ -d "${SHPKG_REPO_SRC_DIR}/.git" ]; then