From patchwork Thu Feb 2 17:05:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Mostafa X-Patchwork-Id: 723209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3vDmb54gDSz9s0g; Fri, 3 Feb 2017 04:05:21 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1cZKow-0002ZP-4h; Thu, 02 Feb 2017 17:05:18 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1cZKor-0002ZB-Cy for kernel-team@lists.ubuntu.com; Thu, 02 Feb 2017 17:05:13 +0000 Received: from 1.general.kamal.us.vpn ([10.172.68.52] helo=fourier) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1cZKoq-00037s-W6 for kernel-team@lists.ubuntu.com; Thu, 02 Feb 2017 17:05:13 +0000 Received: from kamal by fourier with local (Exim 4.86_2) (envelope-from ) id 1cZKoo-00053z-Vv for kernel-team@lists.ubuntu.com; Thu, 02 Feb 2017 09:05:10 -0800 From: Kamal Mostafa To: kernel-team@lists.ubuntu.com Subject: [kteam-tools][PATCHv2] git-build-kernel: embed sha in the /tmp/kernel-user-xxxxxxx build dir name Date: Thu, 2 Feb 2017 09:05:10 -0800 Message-Id: <1486055110-19425-1-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485903542-17611-1-git-send-email-kamal@canonical.com> References: <1485903542-17611-1-git-send-email-kamal@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com 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 --- 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"