From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.92.44.62]) by mx.groups.io with SMTP id smtpd.web11.25303.1637941957685677645 for ; Fri, 26 Nov 2021 07:52:37 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=usoCMTqt; spf=pass (domain: outlook.com, ip: 40.92.44.62, mailfrom: spbrogan@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RNZqb+HNj5wXrrcZ+e+JSYdeY/j5uoU7I5Dbb/KrGJHUy2dCyE6AbPjGXpQbdyr2DVQmhv3/3cigJ70LEZzX4P1h/fShlwiYt+V1mQhLd/8NQb31Od+alYpkoxhRk98K5qWX0pSiOpKHtd6LKv9zf3BnnOjxLYBmiBFykExN1g+1+bH2iGBV1YrPuGaxhcqcRdGY3iK7EqDtlfI48dSl1e4s2/bbtYJHOk+vZWOelatjRjkiPbHj+gSt3KDIgc1M5r026fo5GX/hQTG6qCscYwZHMKTx8yckfjLB7XCZF4GS9D57VYMlMBMA9gHvXEwKALck6nwPus1Cc24qbwkreg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aQU8nwdaitfrT0I7qUvyzwGxBAPdAD6KsAScclj0hFY=; b=CC1HO71eruOrYJk5wP9eklW0M/iFsFQx6pbRWzu0uWykKOc3lELU/sGW8G12SWCv3Qaor1SKx3bnbj6RbtcoDClTSnDHoSCaMW4xhZWW1pYWH0R73zOe+7rvV8gnCt0p6fPin/LmiF/ea4Ee8K3LZ48C1QLojfpMyuHfcpaDm7m0vW7Z+rumFs9j6Pc/MCzYs6qoYM1YnrvtHSN8Tq8AwXjr3+AJasboBK2gLuaQLLdPpxqgWSOgruNR0C9C1oAwgz4ImKZldpHf+4On8r68S2ULuIPiIeQSHKH48YH3OqTwFRFO2udTeU5cmuVaEBlUvM34XN9zvX+n08hBuCaxCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aQU8nwdaitfrT0I7qUvyzwGxBAPdAD6KsAScclj0hFY=; b=usoCMTqt6rcneQE4XRBZuYgQB2cqJtpu8neyUcPJenfvqPKSrjLddXoHMKTjK77VQEa+Zi4VoHne01nDvQrhino/Gm7kxBqo1H87lp/r2rBpCQdJYlNxAWS8ZAcZCvMCghent6RLZbloRQTz8973vTyMKCANlniQlZdqn5M9P6mIHqBj/vu+koAclWomVKgsDgHsEmSp0LZrqSd9D2Nb7a47hEeszTXoveK/A0jIL9EfIU8u0DOYuxc+ZGAwi0eEE5B+AhYBaQr5KBGvipHwSlPLdbSfGn5Eni5t+Vcg3cLlhykD6H2+015UErz//jdLn4WB2XTeg+3ousA48+j01g== Received: from BY3PR19MB4900.namprd19.prod.outlook.com (2603:10b6:a03:354::11) by BY5PR19MB3763.namprd19.prod.outlook.com (2603:10b6:a03:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Fri, 26 Nov 2021 15:52:36 +0000 Received: from BY3PR19MB4900.namprd19.prod.outlook.com ([fe80::44c5:11a3:13d9:c2fb]) by BY3PR19MB4900.namprd19.prod.outlook.com ([fe80::44c5:11a3:13d9:c2fb%7]) with mapi id 15.20.4713.025; Fri, 26 Nov 2021 15:52:34 +0000 Message-ID: Date: Fri, 26 Nov 2021 07:52:33 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [edk2-devel] [Patch V2 1/1] .pytools/Plugin/LicenseCheck: Use temp directory for git diff output To: devel@edk2.groups.io, michael.d.kinney@intel.com Cc: Sean Brogan , Bret Barkelew , Liming Gao , Michael Kubacki References: <20211123173131.1245-1-michael.d.kinney@intel.com> From: "Sean" In-Reply-To: <20211123173131.1245-1-michael.d.kinney@intel.com> X-TMN: [YJa5zky/iEOFHs4GL0uzqmCexCYtF6QU] X-ClientProxiedBy: MW3PR05CA0020.namprd05.prod.outlook.com (2603:10b6:303:2b::25) To BY3PR19MB4900.namprd19.prod.outlook.com (2603:10b6:a03:354::11) Return-Path: spbrogan@outlook.com X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.2.78] (50.47.113.221) by MW3PR05CA0020.namprd05.prod.outlook.com (2603:10b6:303:2b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.8 via Frontend Transport; Fri, 26 Nov 2021 15:52:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21ada3e1-c76a-45e0-c2ef-08d9b0f4c369 X-MS-TrafficTypeDiagnostic: BY5PR19MB3763: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +BYgSOuJYMQfiJFchYGA9XVG3qXx7XfP92eT/lxmKmyT+qJFiXl1HIOYTTLOXgDwTNLD8NWehkO6rgUqGxclPUVGKEzR2oVSt66vJaZUQKWW1TNQqQ+15l/YeUsbTR8dhFZM0MTQQ+zq/t8nCIP8pSVXacF+9lAZwubWv1KVV17z96DRGkxzv0LPS7/rDKnAbDzMPl5Z3xBNWgVx9k6PB4wS/3Yvet0bfEuY8rAHo1iHNTaFY5n0mCghONU2DROxCOLZv0X1bt9143Yq1rLhltIwFSr5zhxfNNvOkawDL68voTCZnCXcVhYko+tO+0M+g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u0ZJ70ziuiSyqeIOF5C0hhWut66Gk+vBg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21ada3e1-c76a-45e0-c2ef-08d9b0f4c369 X-MS-Exchange-CrossTenant-AuthSource: BY3PR19MB4900.namprd19.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2021 15:52:34.8883 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR19MB3763 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reviewed-by: Sean Brogan On 11/23/2021 9:31 AM, Michael D Kinney wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3746 > > Use --output option in git diff command to remove code diffs > from build log on stdout when LicenseCheck plugin is run. > Instead, create a temp directory for the diff output file and > remove the temp directory after the diff output is processed. > > Cc: Sean Brogan > Cc: Bret Barkelew > Cc: Liming Gao > Cc: Michael Kubacki > Signed-off-by: Michael D Kinney > --- > .pytool/Plugin/LicenseCheck/LicenseCheck.py | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py b/.pytool/Plugin/LicenseCheck/LicenseCheck.py > index 5733f7bf4ec0..7b998daf6f6b 100644 > --- a/.pytool/Plugin/LicenseCheck/LicenseCheck.py > +++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py > @@ -5,6 +5,7 @@ > ## > > import os > +import shutil > import logging > import re > from io import StringIO > @@ -61,12 +62,19 @@ class LicenseCheck(ICiBuildPlugin): > # - Junit Logger > # - output_stream the StringIO output stream from this plugin via logging > def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, PLM, PLMHelper, tc, output_stream=None): > - return_buffer = StringIO() > - params = "diff --unified=0 origin/master HEAD" > - RunCmd("git", params, outstream=return_buffer) > - p = return_buffer.getvalue().strip() > - patch = p.split("\n") > - return_buffer.close() > + # Create temp directory > + temp_path = os.path.join(Edk2pathObj.WorkspacePath, 'Build', '.pytool', 'Plugin', 'LicenseCheck') > + if not os.path.exists(temp_path): > + os.makedirs(temp_path) > + # Output file to use for git diff operations > + temp_diff_output = os.path.join (temp_path, 'diff.txt') > + params = "diff --output={} --unified=0 origin/master HEAD".format(temp_diff_output) > + RunCmd("git", params) > + with open(temp_diff_output) as file: > + patch = file.read().strip().split("\n") > + # Delete temp directory > + if os.path.exists(temp_path): > + shutil.rmtree(temp_path) > > ignore_files = [] > if "IgnoreFiles" in pkgconfig: >