[kteam-tools][PATCH] git-build-kernel: embed sha in the /tmp/kernel-user-xxxxxxx build dir name
Stefan Bader
stefan.bader at canonical.com
Wed Feb 1 10:06:40 UTC 2017
On 31.01.2017 23:59, Kamal Mostafa wrote:
> 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 | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
> index c1e885a..a0eec96 100755
> --- a/git-build-kernel/git-build-kernel
> +++ b/git-build-kernel/git-build-kernel
> @@ -61,6 +61,10 @@ GITREPO="${GITREPO%/.git}"
> exit 1
> }
>
> +GITSHASHORT="`git log -1 --pretty=%h ${GITBRANCH%%refs/heads/} --`"
> +[ -z "$GITSHASHORT" ] && {
> + echo "warning: Can't determine GITSHASHORT from GITBRANCH=$GITBRANCH" 1>&2
> +}
>
> ### Get the var "DEBIAN=debian.master" from debian/debian.env
> eval `git show $GITBRANCH:debian/debian.env | grep DEBIAN=`
> @@ -97,7 +101,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`"
Maybe it would be better to just fallback to the old naming when GITSHASHORT
happens to be ""...
> mkdir "$WORKDIR" || exit
>
> BUILDDIR="$WORKDIR/build"
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20170201/a30dba83/attachment.sig>
More information about the kernel-team
mailing list