From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.5217.1578550412364302622 for ; Wed, 08 Jan 2020 22:13:32 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: bob.c.feng@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 22:13:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,412,1571727600"; d="scan'208";a="217708660" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga007.fm.intel.com with ESMTP; 08 Jan 2020 22:13:31 -0800 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 8 Jan 2020 22:13:30 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 8 Jan 2020 22:13:30 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.197]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.89]) with mapi id 14.03.0439.000; Thu, 9 Jan 2020 14:13:28 +0800 From: "Bob Feng" To: Pankaj Bansal , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH] BaseTools: Retrieve git version info Thread-Topic: [PATCH] BaseTools: Retrieve git version info Thread-Index: AQHVw8Vzig5G4ZSN1UqM8VvoF9LNoKfh3Rvw Date: Thu, 9 Jan 2020 06:13:26 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D1615A0A5C@SHSMSX104.ccr.corp.intel.com> References: <20200105180132.23306-1-pankaj.bansal@nxp.com> In-Reply-To: <20200105180132.23306-1-pankaj.bansal@nxp.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Pankaj, I would have some questions. Which module or tool will read WORKSPACE_GIT_= VERSION and PACKAGES_PATH_GIT_VERSION? PACKAGES_PATH can include multiple path separated by ";", looks this patch= can't handle such case. Why is this function implemented in build wrapper? Thanks, Bob -----Original Message----- From: Pankaj Bansal [mailto:pankaj.bansal@nxp.com]=20 Sent: Sunday, January 5, 2020 8:41 PM To: devel@edk2.groups.io Cc: Pankaj Bansal ; Feng, Bob C ; Gao, Liming Subject: [PATCH] BaseTools: Retrieve git version info Retrieve git version info and save as environment variable These variables = can be used in modules to print the vesrion info when uefi boots. This helps in identifying the codebase from logs. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Pankaj Bansal --- Notes: When i ran PatchCheck.py script on this patch i received two errors: 1. Line ending ('\n') is not CRLF 2. The commit message format is not valid: * Contributed-under! (Note: this must be removed by the code contribut= or!) =20 I have fixed the [2] but i have not fixed [1], as this file's line endi= ngs are already unix like. Please suggest if i need to change these to wind= ows like? BaseTools/BinWrappers/PosixLike/build | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/BaseTools/BinWrappers/PosixLike/build b/BaseTools/BinWrappers/= PosixLike/build index f3770eed42..f32796db5d 100755 --- a/BaseTools/BinWrappers/PosixLike/build +++ b/BaseTools/BinWrappers/PosixLike/build @@ -10,5 +10,23 @@ full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooled= ge.org/BashFAQ/028 for a d dir=3D$(dirname "$full_cmd") cmd=3D${full_cmd#= #*/} =20 +git_version() +{ + command -v git>/dev/null 2>&1 + if [ $? -eq 0 ] && [ -n "$1" ] + then + head_or_tag=3D`git -C $1 describe --always 2>/dev/null` + printf $head_or_tag + git -C $1 diff-index --ignore-submodules --exit-code HEAD>/dev/null + if [ $? -eq 1 ]; then + printf '%s' -dirty + fi + else + printf "unknown" + fi +} + +export WORKSPACE_GIT_VERSION=3D$(git_version $WORKSPACE) export=20 +PACKAGES_PATH_GIT_VERSION=3D$(git_version $PACKAGES_PATH) export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}= " exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@" -- 2.17.1