From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 55F002217CE55 for ; Fri, 8 Dec 2017 08:06:35 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Dec 2017 08:11:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,378,1508828400"; d="scan'208";a="182514015" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 08 Dec 2017 08:11:09 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 8 Dec 2017 08:11:01 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 8 Dec 2017 08:11:01 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Sat, 9 Dec 2017 00:10:59 +0800 From: "Zhu, Yonghong" To: "Gao, Liming" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools: Update BrotliCompress script to handle the different input format Thread-Index: AQHTb96JUq+jRonwr02dKB2qKZ+TIaM5nI6Q Date: Fri, 8 Dec 2017 16:10:58 +0000 Message-ID: References: <1512707953-13216-1-git-send-email-liming.gao@intel.com> In-Reply-To: <1512707953-13216-1-git-send-email-liming.gao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjYwYTU1NmMtNzY3NS00OGU4LTg4NzUtNTg4Y2MyYzBlOTUyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImIyOEVPOGQ4K1ArXC9GNzViWGN5YmVzSnpURzF3NUk2ck1iTWxpMEM0cVNjPSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Update BrotliCompress script to handle the different input format X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2017 16:06:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu Best Regards, Zhu Yonghong -----Original Message----- From: Gao, Liming=20 Sent: Friday, December 8, 2017 12:39 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: [Patch] BaseTools: Update BrotliCompress script to handle the diff= erent input format After this update, BrotliCompress can support below styles. BrotliCompress -e InputFile -o OutputFile BrotliCompress -e -o OutputFile I= nputFile Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao --- BaseTools/BinWrappers/PosixLike/BrotliCompress | 61 +++++++++---------= ---- .../Source/C/BrotliCompress/BrotliCompress.bat | 18 ++++--- 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/BaseTools/BinWrappers/PosixLike/BrotliCompress b/BaseTools/Bin= Wrappers/PosixLike/BrotliCompress index ca32d6a..6e4c8c9 100755 --- a/BaseTools/BinWrappers/PosixLike/BrotliCompress +++ b/BaseTools/BinWrappers/PosixLike/BrotliCompress @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# This script will exec Brotli tool. +# This script will exec Brotli tool with -e/-d options. # # Copyright (c) 2017, Intel Corporation. All rights reserved.
# This = program and the accompanying materials @@ -13,50 +13,37 @@ # QLT=3D"-q 9" INPUTFLAG=3D0 +ARGS=3D =20 -for arg; do - if [ $1 =3D -d ] - then +while test $# -gt 0 +do + case $1 in + -e) INPUTFLAG=3D1 - fi - if [ $1 =3D -e ] - then + ;; + -d) INPUTFLAG=3D1 - shift - continue; - fi - if [ $1 =3D -g ] - then - ARGS+=3D"$1 $2 " - shift - shift - continue; - fi - if [ $1 =3D -o ] - then + ARGS+=3D"$1 " + ;; + -o|-g) ARGS+=3D"$1 $2 " shift - shift - continue; - fi - if [ $1 =3D -q ] - then + ;; + -q) QLT=3D"$1 $2 " shift - shift - continue; - fi - if [ $INPUTFLAG -eq 1 ] - then - if [ -z $2 ] + ;; + *) + if [ $INPUTFLAG -eq 1 ] then - ARGS+=3D"$QLT -i $1 " - break; + ARGS+=3D"-i $1 " + INPUTFLAG=3D0 + else + ARGS+=3D"$1 " fi - fi - -ARGS+=3D"$1 " -shift + ;; + esac + shift done =20 -exec Brotli $ARGS +exec Brotli $ARGS $QLT diff --git a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat b/BaseToo= ls/Source/C/BrotliCompress/BrotliCompress.bat index b291ff0..b1b4985 100644 --- a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat +++ b/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat @@ -16,12 +16,16 @@ =20 set QLT=3D-q 9 set INPUTFLAG=3D0 +set ARGS=3D =20 :Begin if "%1"=3D=3D"" goto End =20 if "%1"=3D=3D"-d" ( set INPUTFLAG=3D1 + set ARGS=3D%ARGS% %1 + shift + goto Begin ) =20 if "%1"=3D=3D"-e" ( @@ -51,17 +55,15 @@ if "%1"=3D=3D"-q" ( goto Begin ) =20 -if %INPUTFLAG%=3D=3D1 ( - if "%2"=3D=3D"" ( - set ARGS=3D%ARGS% %QLT% -i %1 - goto End - ) +if %INPUTFLAG% =3D=3D 1 ( + set ARGS=3D%ARGS% -i %1 + set INPUTFLAG=3D0 +) else ( + set ARGS=3D%ARGS% %1 ) - -set ARGS=3D%ARGS% %1 shift goto Begin =20 :End -Brotli %ARGS% +Brotli %ARGS% %QLT% @echo on -- 2.8.0.windows.1