summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-08-26 10:54:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-30 12:36:12 +0100
commit734411a9e633f5b1459216e4cc5175f267d8a668 (patch)
treedb4407ed04f46a3cbd2b350bc76e1a33511baa11
parent2a08f4a0e5dbd15a23c2dba21c0d26799eb00722 (diff)
downloadpoky-734411a9e633f5b1459216e4cc5175f267d8a668.tar.gz
classes/buildhistory: include metadata revisions in commit message
We do already commit these into the repository itself, but have them in the commit message as well as a reference. As part of this, refactor out running "git commit" into a separate function so we don't have to duplicate the code in the two places we call it. Implements [YOCTO #7966]. (From OE-Core rev: c77a068e534b274dee7fb8a2399ecafd33da0587) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/buildhistory.bbclass25
1 files changed, 23 insertions, 2 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 57dc1e9336..135d17a837 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -585,6 +585,27 @@ def buildhistory_get_cmdline(d):
585 return '%s %s' % (bincmd, ' '.join(sys.argv[1:])) 585 return '%s %s' % (bincmd, ' '.join(sys.argv[1:]))
586 586
587 587
588buildhistory_single_commit() {
589 if [ "$3" = "" ] ; then
590 commitopts="${BUILDHISTORY_DIR}/ --allow-empty"
591 item="No changes"
592 else
593 commitopts="$3 metadata-revs"
594 item="$3"
595 fi
596 commitmsgfile=`mktemp`
597 cat > $commitmsgfile << END
598$item: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $2
599
600cmd: $1
601
602metadata revisions:
603END
604 cat ${BUILDHISTORY_DIR}/metadata-revs >> $commitmsgfile
605 git commit $commitopts -F $commitmsgfile --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null
606 rm $commitmsgfile
607}
608
588buildhistory_commit() { 609buildhistory_commit() {
589 if [ ! -d ${BUILDHISTORY_DIR} ] ; then 610 if [ ! -d ${BUILDHISTORY_DIR} ] ; then
590 # Code above that creates this dir never executed, so there can't be anything to commit 611 # Code above that creates this dir never executed, so there can't be anything to commit
@@ -623,11 +644,11 @@ END
623 # porcelain output looks like "?? packages/foo/bar" 644 # porcelain output looks like "?? packages/foo/bar"
624 # Ensure we commit metadata-revs with the first commit 645 # Ensure we commit metadata-revs with the first commit
625 for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do 646 for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do
626 git commit $entry metadata-revs -m "$entry: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" -m "cmd: $CMDLINE" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null 647 buildhistory_single_commit "$CMDLINE" "$HOSTNAME" "$entry"
627 done 648 done
628 git gc --auto --quiet 649 git gc --auto --quiet
629 else 650 else
630 git commit ${BUILDHISTORY_DIR}/ --allow-empty -m "No changes: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" -m "cmd: $CMDLINE" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null 651 buildhistory_single_commit "$CMDLINE" "$HOSTNAME"
631 fi 652 fi
632 if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then 653 if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
633 git push -q ${BUILDHISTORY_PUSH_REPO} 654 git push -q ${BUILDHISTORY_PUSH_REPO}