summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildhistory.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2011-12-30 13:08:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-03 12:14:36 +0000
commita57cda0f8025d466662bfd0ff3de1984ff01486f (patch)
tree690c0747141dcc9e75985e86b9a673c5c0fef5a7 /meta/classes/buildhistory.bbclass
parentf724b7bc2e90262c96b07873d6675f60e593246b (diff)
downloadpoky-a57cda0f8025d466662bfd0ff3de1984ff01486f.tar.gz
buildhistory: improve git commit robustness
* Check if BUILDHISTORY_DIR exists before doing anything with it, in case no tasks that would have created it have executed * Ensure the git repo in BUILDHISTORY_DIR is initialised with "git init" before attempting to do anything with it * Check if any files have been added or changed before adding and committing, to avoid an error from "git commit" (From OE-Core rev: 8eff4fea13317a741114f2a2e8e228d0155ba64c) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r--meta/classes/buildhistory.bbclass21
1 files changed, 17 insertions, 4 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 6a08db467e..06d3510ddc 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -342,11 +342,24 @@ def buildhistory_get_layers(d):
342 342
343 343
344buildhistory_commit() { 344buildhistory_commit() {
345 if [ ! -d ${BUILDHISTORY_DIR} ] ; then
346 # Code above that creates this dir never executed, so there can't be anything to commit
347 exit
348 fi
349
345 ( cd ${BUILDHISTORY_DIR}/ 350 ( cd ${BUILDHISTORY_DIR}/
346 git add ${BUILDHISTORY_DIR}/* 351 # Initialise the repo if necessary
347 git commit ${BUILDHISTORY_DIR}/ -m "Build ${BUILDNAME} for machine ${MACHINE} configured for ${DISTRO} ${DISTRO_VERSION}" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null 352 if [ ! -d .git ] ; then
348 if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then 353 git init -q
349 git push -q ${BUILDHISTORY_PUSH_REPO} 354 fi
355 # Ensure there are new/changed files to commit
356 repostatus=`git status --porcelain`
357 if [ "$repostatus" != "" ] ; then
358 git add ${BUILDHISTORY_DIR}/*
359 git commit ${BUILDHISTORY_DIR}/ -m "Build ${BUILDNAME} for machine ${MACHINE} configured for ${DISTRO} ${DISTRO_VERSION}" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null
360 if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
361 git push -q ${BUILDHISTORY_PUSH_REPO}
362 fi
350 fi) || true 363 fi) || true
351} 364}
352 365