[kteam-tools][PATCHv2] git-build-kernel: embed sha in the /tmp/kernel-user-xxxxxxx build dir name
Kamal Mostafa
kamal at canonical.com
Thu Feb 2 17:05:10 UTC 2017
Instead of using just random digits in the /tmp/kernel-user-xxxxxxxx
build dir name, embed the commit sha of the pushed branch head as well.
This makes it easy to associate a bunch of built /tmp/kernel-user-sha-xxxx
dirs with the exact commits that were used to build them.
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
git-build-kernel/git-build-kernel | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
index c1e885a..4b0b099 100755
--- a/git-build-kernel/git-build-kernel
+++ b/git-build-kernel/git-build-kernel
@@ -61,6 +61,11 @@ GITREPO="${GITREPO%/.git}"
exit 1
}
+GITSHASHORT="`git log -1 --pretty=%h ${GITBRANCH%%refs/heads/} --`"
+[ -z "$GITSHASHORT" ] && { # (this can probably never happen)
+ echo "warning: Can't determine GITSHASHORT from GITBRANCH=$GITBRANCH" 1>&2
+ GITSHASHORT="UNKNOWN-XXXX"
+}
### Get the var "DEBIAN=debian.master" from debian/debian.env
eval `git show $GITBRANCH:debian/debian.env | grep DEBIAN=`
@@ -97,7 +102,8 @@ VERSION=`echo "$chg" | sed -n -e '1s/^.*(\([^)]*\)).*$/\1/p'`
### Set up the /tmp work directory
-WORKDIR="`mktemp -u -d -t kernel-$LOGNAME-XXXXXXXX`"
+WORKDIR="kernel-$LOGNAME-$GITSHASHORT-XXXX"
+WORKDIR="`mktemp -u -d -t $WORKDIR`"
mkdir "$WORKDIR" || exit
BUILDDIR="$WORKDIR/build"
--
2.7.4
More information about the kernel-team
mailing list