mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
4bf1c0a7dc
commit
b9fa9d713b
@@ -354,6 +354,15 @@ def buildhistory_get_layers(d):
|
|||||||
layertext = "Configured metadata layers:\n%s\n" % '\n'.join(get_layers_branch_rev(d))
|
layertext = "Configured metadata layers:\n%s\n" % '\n'.join(get_layers_branch_rev(d))
|
||||||
return layertext
|
return layertext
|
||||||
|
|
||||||
|
def buildhistory_get_metadata_revs(d):
|
||||||
|
# We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want
|
||||||
|
layers = (d.getVar("BBLAYERS", True) or "").split()
|
||||||
|
medadata_revs = ["%-17s = %s:%s" % (os.path.basename(i), \
|
||||||
|
base_get_metadata_git_branch(i, None).strip(), \
|
||||||
|
base_get_metadata_git_revision(i, None)) \
|
||||||
|
for i in layers]
|
||||||
|
return '\n'.join(medadata_revs)
|
||||||
|
|
||||||
|
|
||||||
def squashspaces(string):
|
def squashspaces(string):
|
||||||
import re
|
import re
|
||||||
@@ -382,19 +391,25 @@ buildhistory_commit() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create a machine-readable list of metadata revisions for each layer
|
||||||
|
cat > ${BUILDHISTORY_DIR}/metadata-revs <<END
|
||||||
|
${@buildhistory_get_metadata_revs(d)}
|
||||||
|
END
|
||||||
|
|
||||||
( cd ${BUILDHISTORY_DIR}/
|
( cd ${BUILDHISTORY_DIR}/
|
||||||
# Initialise the repo if necessary
|
# Initialise the repo if necessary
|
||||||
if [ ! -d .git ] ; then
|
if [ ! -d .git ] ; then
|
||||||
git init -q
|
git init -q
|
||||||
fi
|
fi
|
||||||
# Ensure there are new/changed files to commit
|
# Check if there are new/changed files to commit (other than metadata-revs)
|
||||||
repostatus=`git status --porcelain`
|
repostatus=`git status --porcelain | grep -v " metadata-revs$"`
|
||||||
if [ "$repostatus" != "" ] ; then
|
if [ "$repostatus" != "" ] ; then
|
||||||
git add ${BUILDHISTORY_DIR}/*
|
git add .
|
||||||
HOSTNAME=`hostname 2>/dev/null || echo unknown`
|
HOSTNAME=`hostname 2>/dev/null || echo unknown`
|
||||||
# porcelain output looks like "?? packages/foo/bar"
|
# 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
|
for entry in `echo "$repostatus" | awk '{print $2}' | awk -F/ '{print $1}' | sort | uniq` ; do
|
||||||
git commit ${BUILDHISTORY_DIR}/$entry -m "$entry: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null
|
git commit $entry metadata-revs -m "$entry: Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $HOSTNAME" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null
|
||||||
done
|
done
|
||||||
if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
|
if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then
|
||||||
git push -q ${BUILDHISTORY_PUSH_REPO}
|
git push -q ${BUILDHISTORY_PUSH_REPO}
|
||||||
|
|||||||
Reference in New Issue
Block a user