From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.79]) by mx.groups.io with SMTP id smtpd.web10.5508.1578553766128658097 for ; Wed, 08 Jan 2020 23:09:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nxp.com header.s=selector2 header.b=q17HT9HX; spf=pass (domain: nxp.com, ip: 40.107.21.79, mailfrom: pankaj.bansal@nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iRfofCWIEQTQ9aF1TqrdoxCJ17sRSwp4vDiiPkCuLANrM3B8e3rTH/6q/w98fpJAQDP9IyEnWSFCyVlHf7ZdRUvHKw2TUWXbRitXkT83J9uOc9H8AV8VCZ26mpLLPXuJOKqGlYRZzklmtA8AGS3Lilr0hZZUh0CQ3AEnOEewMPXhX7ce9RhtnjSeFxwjf66Ziv4zikJbnx3rw97B2KUkpyaPiyMx6EVVbBtmgpaI2kcD6tqE8MAN/0QPX0zzF8x44nBbrsc7D2l9aj2YxBMtU9AGxhYUDXaxp8b5k9t7JVcpXC/GU6ZSuVo14r/kg1MOLohALGwZOzAnEplXbnmbng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9matF7dw1yie/9Uniefa16/8HRKbq1UBqQy2cKvMMN4=; b=nhn69Q9K7gNEXkXGsfnofsMbBHUFzXUPctpPHBpskEBUtOjfz12o2pJEQz8zBDHAVynC0DBc6yceONcV/hubAPC0CbwOM644Hnqvew2nRG/tm84e3eskAqtDKnidY5j+75kpOGBRQAbHlYS4lOUVsvC5tzxJSEIF2ZeVGE5aOKDI6PrLBrAYU4Y5sLxlbuSs5ChD53GPKsISPWFWGej/8MZYzOKUgQgHKNOl8c7pbyek9Z/011XkRZhDFZAk1n63jTGRie/byaSpwoUE6YTu1Jv5NJHILkyXVt51FsRXlI7LIQIJP+9fIoz/Ol6NHA3j4jArYVm5PDE+GlFh6h2EAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9matF7dw1yie/9Uniefa16/8HRKbq1UBqQy2cKvMMN4=; b=q17HT9HXi5KyAVl1ppBKI97hpEEuPP/8jG1we53Qddwyr5wW5R4P4S7GXFGOAL0uj3ggP9KWdOgmFFXNxxiqX6NWtBwPV5aWiR5AEsTzNAwCKOhsH0pJyEQmIdjxvNvFVxDfj0var1DcCPmOMTbCQuA1n34z6QPzpswGJNJix2E= Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com (10.168.65.10) by VI1PR0401MB2670.eurprd04.prod.outlook.com (10.168.64.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Thu, 9 Jan 2020 07:09:23 +0000 Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::8823:663d:c6ed:cbd6]) by VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::8823:663d:c6ed:cbd6%12]) with mapi id 15.20.2623.010; Thu, 9 Jan 2020 07:09:23 +0000 From: "Pankaj Bansal" To: "Feng, Bob C" , "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: AQHVw8Vzig5G4ZSN1UqM8VvoF9LNoKfh3RvwgAAPk1A= Date: Thu, 9 Jan 2020 07:09:22 +0000 Message-ID: References: <20200105180132.23306-1-pankaj.bansal@nxp.com> <08650203BA1BD64D8AD9B6D5D74A85D1615A0A5C@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <08650203BA1BD64D8AD9B6D5D74A85D1615A0A5C@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@nxp.com; x-originating-ip: [92.120.1.70] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3657e545-79cb-4c79-db8d-08d794d2dad4 x-ms-traffictypediagnostic: VI1PR0401MB2670: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 02778BF158 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(376002)(136003)(366004)(396003)(346002)(189003)(199004)(13464003)(110136005)(26005)(316002)(186003)(81156014)(33656002)(5660300002)(44832011)(53546011)(9686003)(6506007)(7696005)(55016002)(71200400001)(86362001)(66556008)(66446008)(66476007)(66946007)(52536014)(4326008)(966005)(81166006)(64756008)(76116006)(478600001)(2906002)(8936002)(8676002)(45080400002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2670;H:VI1PR0401MB2496.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 00MBd0+COo1b1ZXIO9MLz4N46BdG8mJyB2KkYQ7bU9+7XxOLv126fxXdSoSZXq8nFTLc8q442BUsWAn31RhcrV6TyvRc3rgWeBBHEZDb0G4ddGnKRkCUZZpY4kDt7KT2lbL2hIdaHuOw5Eg1+QY1cCUmsBllxr2znRKQOC16RFhtce1iBJFl45oJEcQAHJRNSblmqDr+REqBJu0LhQEJ5UxL9rbQzyzMcnx1Vt7SYg6csmg/5P3jmuFSXGqZ/3EraH9HyeYM7Q6rog0ax3gfv7k5dMzb/bgPBUj+TCxXhQP/jkiHUaddEdGkYmyRvdN4szU3QOdnHoIH2Ok/mNY1wv1LZHZfhxiz7N1rtFcIioJQupFtzC3CL/EO2tT+Q+nj7Bc5s8aP5XcYs6QJs65cElz97u1CPYHau+SuAm2J330rWEQNpS3fP2KXO/LQ/aw8DKKbWJxeD/aCCWLGlV6qWtaAK95/doSghpRKPUIFQCQVHKXL4WIH0dmsXMWKeBNHmwsqowLVaOQgCnkgPBzNL/eeF/UuNe/wqLgEs6H7l3OnSJ3ZA6LoLV/z+5+K4+Vi x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3657e545-79cb-4c79-db8d-08d794d2dad4 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2020 07:09:23.0361 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5XgtjAJMFnDXm1SSt8EVeb//t9vXG5aUbvoR6tHCLenNl8/B0hD8FzYGwcJ/UPDaF88Rh2Qy+T1yPymNvzqg5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2670 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Bob, Thanks for replying. Please see inline -----Original Message----- From: Feng, Bob C =20 Sent: Thursday, January 9, 2020 11:43 AM To: Pankaj Bansal ; devel@edk2.groups.io Cc: Gao, Liming Subject: RE: [PATCH] BaseTools: Retrieve git version info Hi Pankaj, I would have some questions. Which module or tool will read WORKSPACE_GIT_= VERSION and PACKAGES_PATH_GIT_VERSION? -> Any driver or library can use this. I had tested this patch in Qemu afte= r adding these changes : index 0a1469550d..8e318f776f 100644 --- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c +++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -18,6 +18,9 @@ #include #include +#define XPRINT(x) PRINT(x)^M +#define PRINT(x) #x^M +^M EFI_STATUS EFIAPI PlatformPeim ( @@ -98,6 +101,8 @@ PlatformPeim ( } BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize)); + DEBUG ((EFI_D_ERROR, "Edk2 version is %a\n", XPRINT(WORKSPACE_GIT_VERSIO= N)));^M + DEBUG ((EFI_D_ERROR, "Edk2 platforms version is %a\n", XPRINT(PACKAGES_P= ATH_GIT_VERSION)));^M return EFI_SUCCESS; } diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf b/ArmVirt= Pkg/Library/PlatformPeiLib/PlatformPeiLib.inf index 46db117ac2..992e89b210 100644 --- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf +++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf @@ -15,6 +15,10 @@ VERSION_STRING =3D 1.0 LIBRARY_CLASS =3D PlatformPeiLib +[BuildOptions]^M + GCC:*_*_*_CC_FLAGS =3D -DWORKSPACE_GIT_VERSION=3D"$(WORKSPACE_GIT_VERSIO= N)"^M + GCC:*_*_*_CC_FLAGS =3D -DPACKAGES_PATH_GIT_VERSION=3D"$(PACKAGES_PATH_GI= T_VERSION)"^M +^M [Sources] PlatformPeiLib.c =20 PACKAGES_PATH can include multiple path separated by ";", looks this patch= can't handle such case. -> I did not know this information, maybe we can enhance this function for = handling ";" in PACKAGES_PATH ? I would need some time to work on it. I would really appreciate if any= body can help. Why is this function implemented in build wrapper? -> The purpose of this patch is to provide a user method to determine which= source code was booted? Or if a UEFI driver/application has been loaded in system from shell, = which was the commit version for that? This helps debugging in case we are provided logs of running system or= logs of driver/application.=20 Since a user can make a standalone driver/application using build comm= and, I added this function in build wrapper. Thanks, Bob -----Original Message----- From: Pankaj Bansal [mailto:pankaj.bansal@nxp.com] 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 https://eur01.safeli= nks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fmywiki.wooledge.org%2FBashFA= Q%2F028&data=3D02%7C01%7Cpankaj.bansal%40nxp.com%7Cb4903cf8660c43373b18= 08d794cb0ea0%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63714147215060015= 6&sdata=3DKdr4xWA4gM%2FgttW30aZLn0T%2FUIdCsNcH0ExB0Tx4W1k%3D&reserv= ed=3D0 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