From nobody Wed May 1 20:07:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1492046427786804.7575380074575; Wed, 12 Apr 2017 18:20:27 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A721E20D7648C; Wed, 12 Apr 2017 18:20:25 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 B268720D7648C for ; Wed, 12 Apr 2017 18:20:23 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2017 18:20:20 -0700 Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 12 Apr 2017 18:20:14 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 18:20:14 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 12 Apr 2017 18:20:13 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.217]) with mapi id 14.03.0319.002; Thu, 13 Apr 2017 09:19:49 +0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,192,1488873600"; d="dat'59?scan'59,208,59";a="76762771" From: "Song, BinX" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Add --version option in Brotli and BrotliCompress Thread-Index: AdKz9ArY3sXWQW2KQGquUmwOdFkf/Q== Date: Thu, 13 Apr 2017 01:19:48 +0000 Message-ID: <559D2DF22BC9A3468B4FA1AA547F0EF10255B65D@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <559D2DF22BC9A3468B4FA1AA547F0EF10255B65D@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: [edk2] [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: , Cc: "Gao, Liming" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Liming Gao --- 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/Bin= Wrappers/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 IMP= LIED. # -LVL=3D"--quality 9" +QLT=3D"-q 9" +INPUTFLAG=3D0 =20 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 =20 shift done =20 -exec Brotli $ARGS $LVL +exec Brotli $ARGS diff --git a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat b/BaseToo= ls/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 =20 -set LVL=3D--quality 9 +set QLT=3D-q 9 +set INPUTFLAG=3D0 =20 :Begin if "%1"=3D=3D"" goto End =20 if "%1"=3D=3D"-d" ( - set ARGS=3D%ARGS% --decompress - shift - goto Begin + set INPUTFLAG=3D1 ) =20 if "%1"=3D=3D"-e" ( + set INPUTFLAG=3D1 shift goto Begin ) =20 if "%1"=3D=3D"-g" ( - set ARGS=3D%ARGS% --gap %2 + set ARGS=3D%ARGS% %1 %2 shift shift goto Begin ) =20 -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 ) =20 -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 ) =20 -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 =20 :End -Brotli %ARGS% %LVL% +Brotli %ARGS% @echo on diff --git a/BaseTools/Source/C/BrotliCompress/tools/bro.c b/BaseTools/Sour= ce/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 =20 #include "../dec/decode.h" #include "../enc/encode.h" @@ -67,6 +68,11 @@ static int ParseQuality(const char* s, int* quality) { return 0; } =20 +#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); } --=20 2.10.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel