Skip to content
Merged
Prev Previous commit
Next Next commit
Use LZMA
  • Loading branch information
bebound committed Dec 6, 2023
commit deb94acefb8a5769e54d8b880e75d3435d64d4f8
3 changes: 2 additions & 1 deletion build_scripts/windows/scripts/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ if "%TARGET%"=="msi" (
echo Building ZIP...
REM Rename zip root folder to "Azure CLI"
ren %BUILDING_DIR% "Azure CLI"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Azure CLI as root folder of zip package.
PS: The MSI installation path is C:\Program Files\Microsoft SDKs\Azure\CLI2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set BUILDING_DIR=%ARTIFACTS_DIR%\cli
set ZIP_DIR=%ARTIFACTS_DIR%\Azure CLI

ren %BUILDING_DIR% "Azure CLI" renames BUILDING_DIR to %ARTIFACTS_DIR%\Azure CLI. Let's not hard code Azure CLI but use a variable.

"%ProgramFiles%\7-Zip\7z.exe" a -tzip "%OUTPUT_DIR%\Microsoft Azure CLI.zip" "%ZIP_DIR%"
REM Use LZMA compression to reduce the size of the zip file.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zip with default deflate algorithm: 90MB
zip with LZMA algorithm: 77MB

"%ProgramFiles%\7-Zip\7z.exe" a -tzip -m0=LZMA "%OUTPUT_DIR%\Microsoft Azure CLI.zip" "%ZIP_DIR%"
Copy link
Member

@jiasli jiasli Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to 7-Zip's manual C:\Program Files\7-Zip\7-zip.chm, only 7z type supports the {N}={MethodID}[:param1][:param2] ... [:paramN] notation:

image

For Zip, it should be m={MethodID}:

image

Copy link
Contributor Author

@bebound bebound Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.
According to the doc, -m0 should only works in 7z and I should use -mm.
However, it works.
I've created a bug report for 7z: https://sourceforge.net/p/sevenzip/bugs/2441/

)

if %errorlevel% neq 0 goto ERROR
Expand Down