diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-08-02 10:23:09 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-06 15:29:46 +0100 |
commit | b9fa9d713ba4fbf1c8a71c05f9b3e863e82dea9e (patch) | |
tree | d7c017e8e02e14b58246690c17016586de65f792 /meta/classes/buildhistory.bbclass | |
parent | 4bf1c0a7dced34e67ceabda96012a996e31a4bb5 (diff) | |
download | poky-b9fa9d713ba4fbf1c8a71c05f9b3e863e82dea9e.tar.gz |
classes/buildhistory: save metadata revisions
Always write the metadata revisions for each layer into a machine-
readable "metadata-revs" file so that you can potentially link changes
in the output back to changes in the metadata. (Unlike the existing
similar build-id file, this is not specific to image changes.)
(From OE-Core rev: 45f38d167b523d769c072474b36b3d9b31b4e9d9)
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 | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 76648c9499..e121088d59 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
@@ -354,6 +354,15 @@ def buildhistory_get_layers(d): | |||
354 | layertext = "Configured metadata layers:\n%s\n" % '\n'.join(get_layers_branch_rev(d)) | 354 | layertext = "Configured metadata layers:\n%s\n" % '\n'.join(get_layers_branch_rev(d)) |
355 | return layertext | 355 | return layertext |
356 | 356 | ||
357 | def buildhistory_get_metadata_revs(d): | ||
358 | # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want | ||
359 | layers = (d.getVar("BBLAYERS", True) or "").split() | ||
360 | medadata_revs = ["%-17s = %s:%s" % (os.path.basename(i), \ | ||
361 | base_get_metadata_git_branch(i, None).strip(), \ | ||
362 | base_get_metadata_git_revision(i, None)) \ | ||
363 | for i in layers] | ||
364 | return '\n'.join(medadata_revs) | ||
365 | |||
357 | 366 | ||
358 | def squashspaces(string): | 367 | def squashspaces(string): |
359 | import re | 368 | import re |
@@ -382,19 +391,25 @@ buildhistory_commit() { | |||
382 | return | 391 | return |
383 | fi | 392 | fi |
384 | 393 | ||
394 | # Create a machine-readable list of metadata revisions for each layer | ||
395 | cat > ${BUILDHISTORY_DIR}/metadata-revs <<END | ||
396 | ${@buildhistory_get_metadata_revs(d)} | ||
397 | END | ||
398 | |||
385 | ( cd ${BUILDHISTORY_DIR}/ | 399 | ( cd ${BUILDHISTORY_DIR}/ |
386 | # Initialise the repo if necessary | 400 | # Initialise the repo if necessary |
387 | if [ ! -d .git ] ; then | 401 | if [ ! -d .git ] ; then |
388 | git init -q | 402 | git init -q |
389 | fi | 403 | fi |
390 | # Ensure there are new/changed files to commit | 404 | # Check if there are new/changed files to commit (other than metadata-revs) |
391 | repostatus=`git status --porcelain` | 405 | repostatus=`git status --porcelain | grep -v " metadata-revs$"` |
392 | if [ "$repostatus" != "" ] ; then | 406 | if [ "$repostatus" != "" ] ; then |
393 | git add ${BUILDHISTORY_DIR}/* | 407 | git add . |
394 | HOSTNAME=`hostname 2>/dev/null || echo unknown` | 408 | HOSTNAME=`hostname 2>/dev/null || echo unknown` |
395 | # porcelain output looks like "?? packages/foo/bar" | 409 | # porcelain output looks like "?? packages/foo/bar" |
410 | # Ensure we commit metadata-revs with the first commit | ||
396 | for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do | 411 | for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do |
397 | git commit ${BUILDHISTORY_DIR}/$entry -m "$entry: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null | 412 | git commit $entry metadata-revs -m "$entry: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null |
398 | done | 413 | done |
399 | if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then | 414 | if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then |
400 | git push -q ${BUILDHISTORY_PUSH_REPO} | 415 | git push -q ${BUILDHISTORY_PUSH_REPO} |