diff mbox

[kteam-tools,PATCHv2] git-build-kernel: embed sha in the /tmp/kernel-user-xxxxxxx build dir name

Message ID 1486055110-19425-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa Feb. 2, 2017, 5:05 p.m. UTC
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@canonical.com>
---
 git-build-kernel/git-build-kernel | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Stefan Bader Feb. 3, 2017, 9:08 a.m. UTC | #1

Tim Gardner Feb. 14, 2017, 3:13 p.m. UTC | #2

diff mbox

Patch

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"