summaryrefslogtreecommitdiffstats
path: root/tools/build_snapshots.sh
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-08-25 09:03:00 -0300
committerRenato Botelho <renato@netgate.com>2015-08-25 14:49:54 -0300
commit78b0f246af03e56a4a8c244c7f2dde574d0ee250 (patch)
tree6e3d31f2eb3a51c615274772dac4d68489ee03df /tools/build_snapshots.sh
parent4a6ea7b2745f25d92024b32571b783b13198818d (diff)
downloadpfsense-78b0f246af03e56a4a8c244c7f2dde574d0ee250.zip
pfsense-78b0f246af03e56a4a8c244c7f2dde574d0ee250.tar.gz
Adapt tools scripts for pfSense main repo (round #1):
- Move SCRATCHDIR to ./tmp and add it to .gitignore - Move logs to ./logs and add it to .gitignore - Add build.conf to .gitignore - Rename BUILDER_TOOLS to BUILDER_ROOT that makes more sense in new infrastructure - Change some (cd DIR && git) to git -C DIR - Remove BASE_DIR - Remove TOOLS_DIR - Remove update_product_repository() - Remove TOOLS_*_COMMIT variables - Rename PRODUCT_CURRENT_COMMIT and PRODUCT_LAST_COMMIT to simply CURRENT_COMMIT and LAST_COMMIT - Remove all use of GIT_REPO_DIR, GIT_REPO_UTL and GIT_REPO_TOOLS - Change clone_to_staging_area() to clone ./src instad of ./ - Detect if script was called from / or /tools and set BUILDER_ROOT and BUILDER_SCRIPTS properly - Create SCRATCHDIR if it doesn't exist
Diffstat (limited to 'tools/build_snapshots.sh')
-rwxr-xr-xtools/build_snapshots.sh27
1 files changed, 9 insertions, 18 deletions
diff --git a/tools/build_snapshots.sh b/tools/build_snapshots.sh
index e1fe313..7e1c1e1 100755
--- a/tools/build_snapshots.sh
+++ b/tools/build_snapshots.sh
@@ -78,9 +78,8 @@ echo "" > $SNAPSHOTSLASTUPDATE
git_last_commit() {
if [ -d "${1}/.git" ]; then
- (cd ${1} && git fetch origin && git rebase) >/dev/null
- CURRENT_COMMIT=$(cd ${1} && git log -1 --format='%H')
- echo "$CURRENT_COMMIT"
+ git -C "${1}" pull -q
+ git -C "${1}" log -1 --format='%H'
fi
}
@@ -91,17 +90,11 @@ sleep_between_runs() {
COUNTER=0
while [ $COUNTER -lt $maxsleepvalue ]; do
sleep 60
- PRODUCT_CURRENT_COMMIT=$(git_last_commit "${GIT_REPO_DIR}/${GIT_REPO_BRANCH_OR_TAG}")
- if [ "${PRODUCT_LAST_COMMIT}" != "${PRODUCT_CURRENT_COMMIT}" ]; then
- update_status ">>> New commit: $CURRENT_AUTHOR - $PRODUCT_CURRENT_COMMIT .. No longer sleepy."
+ CURRENT_COMMIT=$(git_last_commit "${BUILDER_ROOT}")
+ if [ "${LAST_COMMIT}" != "${CURRENT_COMMIT}" ]; then
+ update_status ">>> New commit: $CURRENT_AUTHOR - $CURRENT_COMMIT .. No longer sleepy."
COUNTER=$(($maxsleepvalue + 60))
- export PRODUCT_LAST_COMMIT="${PRODUCT_CURRENT_COMMIT}"
- fi
- TOOLS_CURRENT_COMMIT=$(git_last_commit "${BUILDER_TOOLS}")
- if [ "${TOOLS_LAST_COMMIT}" != "${TOOLS_CURRENT_COMMIT}" ]; then
- update_status ">>> New commit: $CURRENT_AUTHOR - $TOOLS_CURRENT_COMMIT .. No longer sleepy."
- COUNTER=$(($maxsleepvalue + 60))
- export TOOLS_LAST_COMMIT="${TOOLS_CURRENT_COMMIT}"
+ export LAST_COMMIT="${CURRENT_COMMIT}"
fi
COUNTER=$(($COUNTER + 60))
done
@@ -345,12 +338,10 @@ else
export maxsleepvalue=86400
# Initialize variables that keep track of last commit
- [ -z "${PRODUCT_LAST_COMMIT}" ] \
- && export PRODUCT_LAST_COMMIT="$(cd "${GIT_REPO_DIR}/${GIT_REPO_BRANCH_OR_TAG}" && git log | head -n1 | cut -d' ' -f2)"
- [ -z "${TOOLS_LAST_COMMIT}" ] \
- && export TOOLS_LAST_COMMIT="$(cd "${BUILDER_SCRIPTS}" && git log | head -n1 | cut -d' ' -f2)"
+ [ -z "${LAST_COMMIT}" ] \
+ && export LAST_COMMIT="$(git -C ${BUILDER_ROOT} log | head -n1 | cut -d' ' -f2)"
- update_status ">>> Sleeping for at least $minsleepvalue, at most $maxsleepvalue in between snapshot builder runs. Last known commit ${PRODUCT_LAST_COMMIT}/${TOOLS_LAST_COMMIT}"
+ update_status ">>> Sleeping for at least $minsleepvalue, at most $maxsleepvalue in between snapshot builder runs. Last known commit ${LAST_COMMIT}"
update_status ">>> Freezing build process at `date`."
sleep $minsleepvalue
update_status ">>> Thawing build process and resuming checks for pending commits at `date`."
OpenPOWER on IntegriCloud