summaryrefslogtreecommitdiff
path: root/meta/classes/buildhistory.bbclass
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:34:39 +0100
commitc77a068e534b274dee7fb8a2399ecafd33da0587 (patch)
tree3af4f5a680faf1ad6885d9d3e157316643954765 /meta/classes/buildhistory.bbclass
parentb018a046a578e41b105cf72b9fdeed0220ae3046 (diff)
downloadopenembedded-core-c77a068e534b274dee7fb8a2399ecafd33da0587.tar.gz
openembedded-core-c77a068e534b274dee7fb8a2399ecafd33da0587.tar.bz2
openembedded-core-c77a068e534b274dee7fb8a2399ecafd33da0587.zip
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]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-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):
return '%s %s' % (bincmd, ' '.join(sys.argv[1:]))
+buildhistory_single_commit() {
+ if [ "$3" = "" ] ; then
+ commitopts="${BUILDHISTORY_DIR}/ --allow-empty"
+ item="No changes"
+ else
+ commitopts="$3 metadata-revs"
+ item="$3"
+ fi
+ commitmsgfile=`mktemp`
+ cat > $commitmsgfile << END
+$item: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $2
+
+cmd: $1
+
+metadata revisions:
+END
+ cat ${BUILDHISTORY_DIR}/metadata-revs >> $commitmsgfile
+ git commit $commitopts -F $commitmsgfile --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null
+ rm $commitmsgfile
+}
+
buildhistory_commit() {
if [ ! -d ${BUILDHISTORY_DIR} ] ; then
# Code above that creates this dir never executed, so there can't be anything to commit
@@ -623,11 +644,11 @@ END
# porcelain output looks like "?? packages/foo/bar"
# Ensure we commit metadata-revs with the first commit
for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do
- 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
+ buildhistory_single_commit "$CMDLINE" "$HOSTNAME" "$entry"
done
git gc --auto --quiet
else
- 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
+ buildhistory_single_commit "$CMDLINE" "$HOSTNAME"
fi
if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
git push -q ${BUILDHISTORY_PUSH_REPO}