diff options
| -rw-r--r-- | meta/classes/buildhistory.bbclass | 25 |
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 | ||
| 588 | buildhistory_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 | |||
| 600 | cmd: $1 | ||
| 601 | |||
| 602 | metadata revisions: | ||
| 603 | END | ||
| 604 | cat ${BUILDHISTORY_DIR}/metadata-revs >> $commitmsgfile | ||
| 605 | git commit $commitopts -F $commitmsgfile --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null | ||
| 606 | rm $commitmsgfile | ||
| 607 | } | ||
| 608 | |||
| 588 | buildhistory_commit() { | 609 | buildhistory_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} |
