From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 B3F3421A0483A for ; Wed, 12 Apr 2017 23:34:28 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 12 Apr 2017 23:34:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,193,1488873600"; d="scan'208";a="248066477" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 12 Apr 2017 23:34:28 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 23:34:27 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 23:34:27 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Thu, 13 Apr 2017 14:34:23 +0800 From: "Gao, Liming" To: "Song, BinX" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Add --version option in Brotli and BrotliCompress Thread-Index: AdKz9ArY3sXWQW2KQGquUmwOdFkf/QAK+WPA Date: Thu, 13 Apr 2017 06:34:22 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D71DEC6@shsmsx102.ccr.corp.intel.com> References: <559D2DF22BC9A3468B4FA1AA547F0EF10255B65D@shsmsx102.ccr.corp.intel.com> In-Reply-To: <559D2DF22BC9A3468B4FA1AA547F0EF10255B65D@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools: Add --version option in Brotli and BrotliCompress 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: Thu, 13 Apr 2017 06:34:28 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Song, BinX >Sent: Thursday, April 13, 2017 9:20 AM >To: edk2-devel@lists.01.org >Cc: Gao, Liming ; Zhu, Yonghong > >Subject: [PATCH] BaseTools: Add --version option in Brotli and BrotliCompr= ess > >https://bugzilla.tianocore.org/show_bug.cgi?id=3D464 >V2: >- Add build version > >V1: >- Add --version option in Brotli and BrotliCompress > >Cc: Liming Gao >Cc: Yonghong Zhu >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Bell Song >--- > BaseTools/BinWrappers/PosixLike/BrotliCompress | 29 ++++++++++++++-- >----- > .../Source/C/BrotliCompress/BrotliCompress.bat | 30 +++++++++++++----= -- >--- > BaseTools/Source/C/BrotliCompress/tools/bro.c | 18 ++++++++++++- > 3 files changed, 55 insertions(+), 22 deletions(-) > >diff --git a/BaseTools/BinWrappers/PosixLike/BrotliCompress >b/BaseTools/BinWrappers/PosixLike/BrotliCompress >index 59c6465..49358b2 100755 >--- a/BaseTools/BinWrappers/PosixLike/BrotliCompress >+++ b/BaseTools/BinWrappers/PosixLike/BrotliCompress >@@ -11,32 +11,43 @@ > # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" >BASIS, > # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER >EXPRESS OR IMPLIED. > # >-LVL=3D"--quality 9" >+QLT=3D"-q 9" >+INPUTFLAG=3D0 > > while [ $# !=3D 0 ];do > case $1 in > -d) >- ARGS+=3D"--decompress " >+ INPUTFLAG=3D1 >+ ARGS+=3D"$1 " > ;; > -e) >+ INPUTFLAG=3D1 > ;; > -g) >- ARGS+=3D"--gap $2 " >+ ARGS+=3D"$1 $2 " > shift > ;; >- -l) >- LVL=3D"--quality $2 " >+ -o) >+ ARGS+=3D"$1 $2 " > shift > ;; >- -o) >- ARGS+=3D"--output $2 " >+ -q) >+ QLT=3D"$1 $2 " > shift > ;; > *) >- ARGS+=3D"--input $1 " >+ if [ $INPUTFLAG -eq 1 ] >+ then >+ if [ -z $2 ] >+ then >+ ARGS+=3D"$QLT -i $1 " >+ break; >+ fi >+ fi >+ ARGS+=3D"$1 " > esac > > shift > done > >-exec Brotli $ARGS $LVL >+exec Brotli $ARGS >diff --git a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat >b/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat >index 257bf1e..b291ff0 100644 >--- a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat >+++ b/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat >@@ -14,48 +14,54 @@ > @echo off > @setlocal > >-set LVL=3D--quality 9 >+set QLT=3D-q 9 >+set INPUTFLAG=3D0 > > :Begin > if "%1"=3D=3D"" goto End > > if "%1"=3D=3D"-d" ( >- set ARGS=3D%ARGS% --decompress >- shift >- goto Begin >+ set INPUTFLAG=3D1 > ) > > if "%1"=3D=3D"-e" ( >+ set INPUTFLAG=3D1 > shift > goto Begin > ) > > if "%1"=3D=3D"-g" ( >- set ARGS=3D%ARGS% --gap %2 >+ set ARGS=3D%ARGS% %1 %2 > shift > shift > goto Begin > ) > >-if "%1"=3D=3D"-l" ( >- set LVL=3D--quality %2 >+if "%1"=3D=3D"-o" ( >+ set ARGS=3D%ARGS% %1 %2 > shift > shift > goto Begin > ) > >-if "%1"=3D=3D"-o" ( >- set ARGS=3D%ARGS% --output %2 >- set INTMP=3D%2 >+if "%1"=3D=3D"-q" ( >+ set QLT=3D%1 %2 > shift > shift > goto Begin > ) > >-set ARGS=3D%ARGS% --input %1 >+if %INPUTFLAG%=3D=3D1 ( >+ if "%2"=3D=3D"" ( >+ set ARGS=3D%ARGS% %QLT% -i %1 >+ goto End >+ ) >+) >+ >+set ARGS=3D%ARGS% %1 > shift > goto Begin > > :End >-Brotli %ARGS% %LVL% >+Brotli %ARGS% > @echo on >diff --git a/BaseTools/Source/C/BrotliCompress/tools/bro.c >b/BaseTools/Source/C/BrotliCompress/tools/bro.c >index 2fa9f05..ef4592d 100644 >--- a/BaseTools/Source/C/BrotliCompress/tools/bro.c >+++ b/BaseTools/Source/C/BrotliCompress/tools/bro.c >@@ -13,6 +13,7 @@ > #include > #include > #include >+#include > > #include "../dec/decode.h" > #include "../enc/encode.h" >@@ -67,6 +68,11 @@ static int ParseQuality(const char* s, int* quality) { > return 0; > } > >+#define UTILITY_NAME "Brotli" >+#define UTILITY_MAJOR_VERSION 0 >+#define UTILITY_MINOR_VERSION 5 >+#define UTILITY_REVERSION 2 >+ > static void ParseArgv(int argc, char **argv, > char **input_path, > char **output_path, >@@ -110,6 +116,15 @@ static void ParseArgv(int argc, char **argv, > } > *verbose =3D 1; > continue; >+ } else if (!strcmp("--version", argv[k])) { >+ fprintf(stderr, >+ "%s Version %d.%d.%d %s\n", >+ UTILITY_NAME, >+ UTILITY_MAJOR_VERSION, >+ UTILITY_MINOR_VERSION, >+ UTILITY_REVERSION, >+ __BUILD_VERSION); >+ exit(1); > } > if (k < argc - 1) { > if (!strcmp("--input", argv[k]) || >@@ -177,7 +192,8 @@ error: > fprintf(stderr, > "Usage: %s [--force] [--quality n] [--gap n] [--decompress]" > " [--input filename] [--output filename] [--repeat iters]" >- " [--verbose] [--window n] [--custom-dictionary filename]\n", >+ " [--verbose] [--window n] [--custom-dictionary filename]" >+ " [--version]\n", > argv[0]); > exit(1); > } >-- >2.10.2.windows.1