From patchwork Wed Sep 12 09:28:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 1441631 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1D445DF28C for ; Wed, 12 Sep 2012 09:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754990Ab2ILJbg (ORCPT ); Wed, 12 Sep 2012 05:31:36 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:35968 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754430Ab2ILJbf (ORCPT ); Wed, 12 Sep 2012 05:31:35 -0400 Received: by pbbrr13 with SMTP id rr13so2002520pbb.19 for ; Wed, 12 Sep 2012 02:31:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Ty/ie8zQWVij11J2Q547DraQIjcUbcVm4EY6MD8cAa4=; b=gbJBg8lSMSAg5s91LjH2n+dwMxtGeeerP0iJNromszgfV7rRvaGgghR8CS5W+UFMsq QnjGFt9ym4uNubcJzLhQBAchoeUoZmBUPML52eX/KcB0LD7VJh5MpauxC63ioynhC3yC kNLvva+mf4S2KZ+LZJ3YeTYNoc6NccNaWevouQ6sLP38GbrnhxhZGZcEJ3P/mDuO1k35 5EVH6/tXYoCGkJzJ+0NgNrN5EqP48c98Ty+7DlBGD1EFZMhzJnFYQaYRh4DgBremXyX8 jFc6l7FALgm+kUewqF+pe4gb+pVpzjS8J+oF9piBLdRcg1MpUWbksiIZC7B+NGwJreTQ lz2w== Received: by 10.66.75.73 with SMTP id a9mr31220284paw.43.1347442294193; Wed, 12 Sep 2012 02:31:34 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id jz10sm11137454pbc.8.2012.09.12.02.31.31 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 02:31:32 -0700 (PDT) From: Tushar Behera To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mmarek@suse.cz, patches@linaro.org Subject: [PATCH v2] kbuild: setlocalversion: ignore private tags while reporting local version Date: Wed, 12 Sep 2012 14:58:30 +0530 Message-Id: <1347442110-26569-1-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1347424996-15569-1-git-send-email-tushar.behera@linaro.org> References: <1347424996-15569-1-git-send-email-tushar.behera@linaro.org> X-Gm-Message-State: ALoCoQmkAzknFeTwGWKPRRAJXEL9Dffee2SzVoyaFBVSy7+hury1hBeEr6/tefGDtjKUFdD9W4iY Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The output of 'git describe' is relative to the immediate preceding tag. When the immediate tag preceding or at the HEAD is a private tag, setlocalversion extracts information with respect to the private tag and wrongly reports them with respect to Linux tag. Fixing this to extract information with respect to Linux tags. CC: Michal Marek Signed-off-by: Tushar Behera --- Changes since v1: * Extend the fix when the HEAD is a private tagged commit scripts/setlocalversion | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index bd6dca8..b65e8a9 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -47,7 +47,7 @@ scm_version() # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore # it, because this version is defined in the top level Makefile. - if [ -z "`git describe --exact-match 2>/dev/null`" ]; then + if [ -z "`git describe --exact-match --match v[2-9].* 2>/dev/null`" ]; then # If only the short version is requested, don't bother # running further git commands @@ -57,7 +57,8 @@ scm_version() fi # If we are past a tagged commit (like # "v2.6.30-rc5-302-g72357d5"), we pretty print it. - if atag="`git describe 2>/dev/null`"; then + # Also match linux tags pattern to discard private tags + if atag="`git describe --match v[2-9].* 2>/dev/null`"; then echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' # If we don't have a tag at all we print -g{commitish}.