From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.60]) by mx.groups.io with SMTP id smtpd.web10.18381.1578228091648524936 for ; Sun, 05 Jan 2020 04:41:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nxp.com header.s=selector2 header.b=kb9hYIq/; spf=pass (domain: nxp.com, ip: 40.107.4.60, mailfrom: pankaj.bansal@nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cdc2bb9AsYi/JDJzbgmlky+AqVgitaQXuko86kogXSx2HI1cjXlw1K7MMH+sFbu1AFqDvShjgRTShuJpRLbfkzIzJPHjT59KHl3/Mrr+AwU8XHrUQRRLQuo+0gFHe2p5rFaDpn7CTzOWgr9kZpjF9bz4CinZDBWxsnz/8Z3UezIGwfjNWOH87xnpT9i0d1ZL3fhKmvxbug3QoBHSqhaHGfApLWOWv9TOj0sYukVivy+1TeYBbQXG4L04fmV01Jia0kZXD8GtCPAglA5ParbmwfBRsh4bVwnYCzJCKuSCoy1Ncoy44BZ8foKgczF76Lv2IvFxaPQc4KSRWTkafJouVw== 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=e9xyBZo/1T+NxN6n6cQuuPnLbcaucSe0UBkg9cSud50=; b=HoE9BWoXQSFHFwmPndQrKy/sRGEQ+olaVexY063CngkNQcldY+AkRoYl2YF0OYvVNsxiaTaLJiYUgJDsraTnA/h5Qw2aiFdN4+DSp+Ze5moFvpFcZJ06O5Ll0Fk+IBk3s5+foOrTa9Apr21g4uALQeTryvl2IQ344XwTFuKAMspsTe7t2CO1ZizrIWiAoDGhhokcv6pA6z+CrFRcxZfrXqTl6RhiaKPU2XBOa+iTh2e1QfW5sZ8YJTWVVJRqxM7Q0h62MPYOCRv79l5W1+ooMebcOXvT6rRu3h3f/fotqFE/xEt42DuhRYONbs+rcb4M/dvoJJZzyqOtG3J739ZOTg== 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=e9xyBZo/1T+NxN6n6cQuuPnLbcaucSe0UBkg9cSud50=; b=kb9hYIq/KtYCOZB/uW6hy1uGvOwv77ZNRZR4bseO03/ci+nAgiDbIPrFR4LkPThmT2OhITXHcyrxu8ioi5Jnq1OzfmOY1cAgHdqlG3jjCx/x/OrAb3K1nYU6n+Nv0NYCIiAC1G5mYhorafVPEr85nGBYIdLPqJaqN03meqWjlUc= Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com (10.168.65.10) by VI1PR0401MB2574.eurprd04.prod.outlook.com (10.168.65.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.15; Sun, 5 Jan 2020 12:41:29 +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.2602.015; Sun, 5 Jan 2020 12:41:29 +0000 Received: from uefi-workstation.ap.freescale.net (92.120.1.69) by TYCPR01CA0003.jpnprd01.prod.outlook.com (2603:1096:405::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10 via Frontend Transport; Sun, 5 Jan 2020 12:41:26 +0000 From: "Pankaj Bansal" To: "devel@edk2.groups.io" CC: Pankaj Bansal , Bob Feng , Liming Gao Subject: [PATCH] BaseTools: Retrieve git version info Thread-Topic: [PATCH] BaseTools: Retrieve git version info Thread-Index: AQHVw8Vzig5G4ZSN1UqM8VvoF9LNoA== Date: Sun, 5 Jan 2020 12:41:29 +0000 Message-ID: <20200105180132.23306-1-pankaj.bansal@nxp.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TYCPR01CA0003.jpnprd01.prod.outlook.com (2603:1096:405::15) To VI1PR0401MB2496.eurprd04.prod.outlook.com (2603:10a6:800:56::10) x-mailer: git-send-email 2.17.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.120.1.69] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: c14cd645-944a-47f6-1121-08d791dc95d4 x-ms-traffictypediagnostic: VI1PR0401MB2574:|VI1PR0401MB2574: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:626; x-forefront-prvs: 027367F73D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(346002)(366004)(39860400002)(136003)(396003)(189003)(199004)(66946007)(66556008)(66476007)(64756008)(66446008)(2906002)(5660300002)(8936002)(4326008)(6916009)(36756003)(6506007)(26005)(52116002)(16526019)(186003)(6512007)(956004)(2616005)(44832011)(316002)(71200400001)(966005)(6486002)(478600001)(54906003)(81166006)(1076003)(81156014)(86362001)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2574;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: sneBmb1X7J1/j22jVuFpL81N8OT68JpS0g7QmioJC19Q6uBF420yElpB7vAQzlevhNa2dCM64ppXWpcVbGuxdKKc5svLeCsPRw1V46tXfXs6qFJn5k5AenVJqY5d97h9KBEFdYx5RqEsDRbHgcIRpCW5VwKeJwNfmEpMSmPizUXAsHObnq4X/S+fNk8PINS1n+JBzweROXyf4sy0J6HYtf3WkrfaSl8VeDwKYtn4CdxL7y3p2nytn9N9jhKTegB6v55wKbmyOVLLTBR8QgCLk2SIb7wKtc9smzAO07ItvMagxb5FcchpPm8YTMwOKBYIX4H579IybOkeAaoenb81IuSxh0aHsX0dmpfzltPk9YJGIA/ZM7P5LjARYMLP3eUxc5ooX8j9e8rghw17102+iJ/JpsalMYxCE/6iAkfMoqrmXbAMddqrnjLDWHMQTx0Rf3HpQqKkhgLULL50wLs3tLFXO0MO4ahbqA4AS0GnuLg= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c14cd645-944a-47f6-1121-08d791dc95d4 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2020 12:41:29.1569 (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: iEzojXWs5lASe8At2hSct7FHwELqilNie4R1mE1XwZDOT/yN95ccVgl+bUd7sU38HcuGx3VPBxs+hUME103Kow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2574 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 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" "$@" --=20 2.17.1