From nobody Fri May 3 17:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.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 1512707970911203.84870116737557; Thu, 7 Dec 2017 20:39:30 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B8EEB21B02851; Thu, 7 Dec 2017 20:34:55 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 A0FA921B02851 for ; Thu, 7 Dec 2017 20:34:54 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2017 20:39:28 -0800 Received: from shwde7172.ccr.corp.intel.com ([10.239.9.15]) by fmsmga006.fm.intel.com with ESMTP; 07 Dec 2017 20:39:27 -0800 X-Original-To: edk2-devel@lists.01.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; Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,376,1508828400"; d="scan'208";a="185161729" From: Liming Gao To: edk2-devel@lists.01.org Date: Fri, 8 Dec 2017 12:39:13 +0800 Message-Id: <1512707953-13216-1-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 Subject: [edk2] [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: , MIME-Version: 1.0 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" After this update, BrotliCompress can support below styles. BrotliCompress -e InputFile -o OutputFile BrotliCompress -e -o OutputFile InputFile 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 --=20 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel