diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2013-08-15 18:04:36 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-16 11:44:16 +0100 |
commit | 742266d66023a6f6fe47396dcaf5bc9ee7e65f80 (patch) | |
tree | c7d5a12a875af6b88cd09fe62fc96fffddc88d97 /meta/classes/buildhistory.bbclass | |
parent | 855b3252d968e7bb93b4b318b7a26336dd8ea375 (diff) | |
download | poky-742266d66023a6f6fe47396dcaf5bc9ee7e65f80.tar.gz |
classes/buildhistory: show command line in commit message
Record the bitbake command line in the commit message as a further
context indication.
(From OE-Core rev: 34fb802b2170f0fe208e54e7a4d18f663db72f90)
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.bbclass | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index b2e5cc50e8..6fb1ba646d 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
@@ -495,6 +495,14 @@ def buildhistory_get_sdkvars(d): | |||
495 | return outputvars(sdkvars, listvars, d) | 495 | return outputvars(sdkvars, listvars, d) |
496 | 496 | ||
497 | 497 | ||
498 | def buildhistory_get_cmdline(d): | ||
499 | if sys.argv[0].endswith('bin/bitbake'): | ||
500 | bincmd = 'bitbake' | ||
501 | else: | ||
502 | bincmd = sys.argv[0] | ||
503 | return '%s %s' % (bincmd, ' '.join(sys.argv[1:])) | ||
504 | |||
505 | |||
498 | buildhistory_commit() { | 506 | buildhistory_commit() { |
499 | if [ ! -d ${BUILDHISTORY_DIR} ] ; then | 507 | if [ ! -d ${BUILDHISTORY_DIR} ] ; then |
500 | # Code above that creates this dir never executed, so there can't be anything to commit | 508 | # Code above that creates this dir never executed, so there can't be anything to commit |
@@ -514,18 +522,19 @@ END | |||
514 | # Check if there are new/changed files to commit (other than metadata-revs) | 522 | # Check if there are new/changed files to commit (other than metadata-revs) |
515 | repostatus=`git status --porcelain | grep -v " metadata-revs$"` | 523 | repostatus=`git status --porcelain | grep -v " metadata-revs$"` |
516 | HOSTNAME=`hostname 2>/dev/null || echo unknown` | 524 | HOSTNAME=`hostname 2>/dev/null || echo unknown` |
525 | CMDLINE="${@buildhistory_get_cmdline(d)}" | ||
517 | if [ "$repostatus" != "" ] ; then | 526 | if [ "$repostatus" != "" ] ; then |
518 | git add -A . | 527 | git add -A . |
519 | # porcelain output looks like "?? packages/foo/bar" | 528 | # porcelain output looks like "?? packages/foo/bar" |
520 | # Ensure we commit metadata-revs with the first commit | 529 | # Ensure we commit metadata-revs with the first commit |
521 | for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do | 530 | for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do |
522 | git commit $entry metadata-revs -m "$entry: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null | 531 | 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 |
523 | done | 532 | done |
524 | if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then | 533 | if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then |
525 | git push -q ${BUILDHISTORY_PUSH_REPO} | 534 | git push -q ${BUILDHISTORY_PUSH_REPO} |
526 | fi | 535 | fi |
527 | else | 536 | else |
528 | git commit ${BUILDHISTORY_DIR}/ --allow-empty -m "No changes: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null | 537 | 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 |
529 | fi) || true | 538 | fi) || true |
530 | } | 539 | } |
531 | 540 | ||