* [Patch] BaseTools: Update BrotliCompress script to handle the different input format
@ 2017-12-08 4:39 Liming Gao
2017-12-08 16:10 ` Zhu, Yonghong
0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2017-12-08 4:39 UTC (permalink / raw)
To: edk2-devel
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 <liming.gao@intel.com>
---
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/BinWrappers/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.<BR>
# This program and the accompanying materials
@@ -13,50 +13,37 @@
#
QLT="-q 9"
INPUTFLAG=0
+ARGS=
-for arg; do
- if [ $1 = -d ]
- then
+while test $# -gt 0
+do
+ case $1 in
+ -e)
INPUTFLAG=1
- fi
- if [ $1 = -e ]
- then
+ ;;
+ -d)
INPUTFLAG=1
- shift
- continue;
- fi
- if [ $1 = -g ]
- then
- ARGS+="$1 $2 "
- shift
- shift
- continue;
- fi
- if [ $1 = -o ]
- then
+ ARGS+="$1 "
+ ;;
+ -o|-g)
ARGS+="$1 $2 "
shift
- shift
- continue;
- fi
- if [ $1 = -q ]
- then
+ ;;
+ -q)
QLT="$1 $2 "
shift
- shift
- continue;
- fi
- if [ $INPUTFLAG -eq 1 ]
- then
- if [ -z $2 ]
+ ;;
+ *)
+ if [ $INPUTFLAG -eq 1 ]
then
- ARGS+="$QLT -i $1 "
- break;
+ ARGS+="-i $1 "
+ INPUTFLAG=0
+ else
+ ARGS+="$1 "
fi
- fi
-
-ARGS+="$1 "
-shift
+ ;;
+ esac
+ shift
done
-exec Brotli $ARGS
+exec Brotli $ARGS $QLT
diff --git a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat b/BaseTools/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 @@
set QLT=-q 9
set INPUTFLAG=0
+set ARGS=
:Begin
if "%1"=="" goto End
if "%1"=="-d" (
set INPUTFLAG=1
+ set ARGS=%ARGS% %1
+ shift
+ goto Begin
)
if "%1"=="-e" (
@@ -51,17 +55,15 @@ if "%1"=="-q" (
goto Begin
)
-if %INPUTFLAG%==1 (
- if "%2"=="" (
- set ARGS=%ARGS% %QLT% -i %1
- goto End
- )
+if %INPUTFLAG% == 1 (
+ set ARGS=%ARGS% -i %1
+ set INPUTFLAG=0
+) else (
+ set ARGS=%ARGS% %1
)
-
-set ARGS=%ARGS% %1
shift
goto Begin
:End
-Brotli %ARGS%
+Brotli %ARGS% %QLT%
@echo on
--
2.8.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] BaseTools: Update BrotliCompress script to handle the different input format
2017-12-08 4:39 [Patch] BaseTools: Update BrotliCompress script to handle the different input format Liming Gao
@ 2017-12-08 16:10 ` Zhu, Yonghong
0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2017-12-08 16:10 UTC (permalink / raw)
To: Gao, Liming, edk2-devel@lists.01.org
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Gao, Liming
Sent: Friday, December 8, 2017 12:39 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [Patch] BaseTools: Update BrotliCompress script to handle the different input format
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 <liming.gao@intel.com>
---
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/BinWrappers/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.<BR> # This program and the accompanying materials @@ -13,50 +13,37 @@ # QLT="-q 9"
INPUTFLAG=0
+ARGS=
-for arg; do
- if [ $1 = -d ]
- then
+while test $# -gt 0
+do
+ case $1 in
+ -e)
INPUTFLAG=1
- fi
- if [ $1 = -e ]
- then
+ ;;
+ -d)
INPUTFLAG=1
- shift
- continue;
- fi
- if [ $1 = -g ]
- then
- ARGS+="$1 $2 "
- shift
- shift
- continue;
- fi
- if [ $1 = -o ]
- then
+ ARGS+="$1 "
+ ;;
+ -o|-g)
ARGS+="$1 $2 "
shift
- shift
- continue;
- fi
- if [ $1 = -q ]
- then
+ ;;
+ -q)
QLT="$1 $2 "
shift
- shift
- continue;
- fi
- if [ $INPUTFLAG -eq 1 ]
- then
- if [ -z $2 ]
+ ;;
+ *)
+ if [ $INPUTFLAG -eq 1 ]
then
- ARGS+="$QLT -i $1 "
- break;
+ ARGS+="-i $1 "
+ INPUTFLAG=0
+ else
+ ARGS+="$1 "
fi
- fi
-
-ARGS+="$1 "
-shift
+ ;;
+ esac
+ shift
done
-exec Brotli $ARGS
+exec Brotli $ARGS $QLT
diff --git a/BaseTools/Source/C/BrotliCompress/BrotliCompress.bat b/BaseTools/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 @@
set QLT=-q 9
set INPUTFLAG=0
+set ARGS=
:Begin
if "%1"=="" goto End
if "%1"=="-d" (
set INPUTFLAG=1
+ set ARGS=%ARGS% %1
+ shift
+ goto Begin
)
if "%1"=="-e" (
@@ -51,17 +55,15 @@ if "%1"=="-q" (
goto Begin
)
-if %INPUTFLAG%==1 (
- if "%2"=="" (
- set ARGS=%ARGS% %QLT% -i %1
- goto End
- )
+if %INPUTFLAG% == 1 (
+ set ARGS=%ARGS% -i %1
+ set INPUTFLAG=0
+) else (
+ set ARGS=%ARGS% %1
)
-
-set ARGS=%ARGS% %1
shift
goto Begin
:End
-Brotli %ARGS%
+Brotli %ARGS% %QLT%
@echo on
--
2.8.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-08 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-08 4:39 [Patch] BaseTools: Update BrotliCompress script to handle the different input format Liming Gao
2017-12-08 16:10 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox