From f7f519dcc4cd6c83d99d2c9966fd922c290aae59 Mon Sep 17 00:00:00 2001 From: Alexey-Ayupov <116575425+Alexey-Ayupov@users.noreply.github.com> Date: Thu, 29 Dec 2022 23:33:04 +0100 Subject: [PATCH] [Ubuntu] update zstd version (#6681) --- .../SoftwareReport/SoftwareReport.Tools.psm1 | 2 +- images/linux/scripts/installers/homebrew.sh | 17 ------------- images/linux/scripts/installers/zstd.sh | 22 +++++++++++++++++ images/linux/scripts/tests/Tools.Tests.ps1 | 24 ++++++++----------- images/linux/toolsets/toolset-1804.json | 8 ------- images/linux/toolsets/toolset-2004.json | 8 ------- images/linux/toolsets/toolset-2204.json | 4 ---- images/linux/ubuntu1804.json | 3 ++- images/linux/ubuntu2004.json | 3 ++- images/linux/ubuntu2204.pkr.hcl | 3 ++- 10 files changed, 39 insertions(+), 55 deletions(-) create mode 100644 images/linux/scripts/installers/zstd.sh diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 5bfefbfe8..c18f2e814 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -281,7 +281,7 @@ function Get-YamllintVersion { function Get-ZstdVersion { $zstdVersion = zstd --version | Take-OutputPart -Part 1 -Delimiter "v" | Take-OutputPart -Part 0 -Delimiter "," - return "$zstdVersion (Homebrew)" + return "$zstdVersion" } function Get-YqVersion { diff --git a/images/linux/scripts/installers/homebrew.sh b/images/linux/scripts/installers/homebrew.sh index 1b4cbd21c..d13372141 100644 --- a/images/linux/scripts/installers/homebrew.sh +++ b/images/linux/scripts/installers/homebrew.sh @@ -22,23 +22,6 @@ setEtcEnvironmentVariable HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS 3650 echo "Validate the installation reloading /etc/environment" reloadEtcEnvironment -# Install additional brew packages - -# brew GCC installation needed because the default Ubuntu components -# are too old for current brew software -# See: -# https://github.com/Homebrew/homebrew-core/issues/110877 - -brew_packages=$(get_toolset_value .brew[].name) -for package in $brew_packages; do - echo "Install $package" - brew install $package - # create symlinks for zstd in /usr/local/bin - if [[ $package == "zstd" ]]; then - find $(brew --prefix)/bin -name *zstd* -exec sudo sh -c 'ln -s {} /usr/local/bin/$(basename {})' ';' - fi -done - gfortran=$(brew --prefix)/bin/gfortran # Remove gfortran symlink, not to conflict with system gfortran if [[ -e $gfortran ]]; then diff --git a/images/linux/scripts/installers/zstd.sh b/images/linux/scripts/installers/zstd.sh new file mode 100644 index 000000000..8c738f4c0 --- /dev/null +++ b/images/linux/scripts/installers/zstd.sh @@ -0,0 +1,22 @@ +#!/bin/bash -e +################################################################################ +## File: zstd.sh +## Desc: Installs zstd +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/install.sh + +apt-get install -y liblz4-dev +release_tag=$(curl https://api.github.com/repos/facebook/zstd/releases/latest | jq -r '.tag_name') +zstd_tar_name=zstd-${release_tag//v}.tar.gz +URL=https://github.com/facebook/zstd/releases/download/${release_tag}/${zstd_tar_name} +download_with_retries "${URL}" "/tmp" "${zstd_tar_name}" +tar xzf /tmp/$zstd_tar_name -C /tmp +make -C /tmp/zstd-${release_tag//v}/contrib/pzstd all +make -C /tmp/zstd-${release_tag//v} zstd-release +for copyprocess in zstd zstdless zstdgrep; do cp /tmp/zstd-${release_tag//v}/programs/$copyprocess /usr/local/bin/; done +cp /tmp/zstd-${release_tag//v}/contrib/pzstd/pzstd /usr/local/bin/ +for symlink in zstdcat zstdmt unzstd; do ln -sf /usr/local/bin/zstd /usr/local/bin/$symlink; done + +invoke_tests "Tools" "Zstd" diff --git a/images/linux/scripts/tests/Tools.Tests.ps1 b/images/linux/scripts/tests/Tools.Tests.ps1 index b90adf48c..b5102b5e0 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -220,6 +220,16 @@ Describe "Terraform" { } } +Describe "Zstd" { + It "zstd" { + "zstd --version" | Should -ReturnZeroExitCode + } + + It "pzstd" { + "pzstd --version" | Should -ReturnZeroExitCode + } +} + Describe "Vcpkg" { It "vcpkg" { "vcpkg version" | Should -ReturnZeroExitCode @@ -257,23 +267,9 @@ Describe "HHVM" -Skip:(Test-IsUbuntu22) { } Describe "Homebrew" { - $brewToolset = (Get-ToolsetContent).brew - $testCases = $brewToolset | ForEach-Object { @{brewName = $_.name; brewCommand = $_.command} } - It "homebrew" { "/home/linuxbrew/.linuxbrew/bin/brew --version" | Should -ReturnZeroExitCode } - - It "zstd has /usr/local/bin symlink" { - "/usr/local/bin/zstd" | Should -Exist - } - - It "homebrew package " -TestCases $testCases { - $brewPrefix = /home/linuxbrew/.linuxbrew/bin/brew --prefix $brewName - $brewPackage = Join-Path $brewPrefix "bin" $brewCommand - - "$brewPackage --version" | Should -ReturnZeroExitCode - } } Describe "Julia" { diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index e08dfe001..d79ae110c 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -221,14 +221,6 @@ ] }, "brew": [ - { - "name": "gcc@12", - "command": "gcc-12" - }, - { - "name": "zstd", - "command": "zstd" - } ], "docker": { "images": [ diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 3cd42986f..2b0fc79e9 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -221,14 +221,6 @@ ] }, "brew": [ - { - "name": "gcc@12", - "command": "gcc-12" - }, - { - "name": "zstd", - "command": "zstd" - } ], "docker": { "images": [ diff --git a/images/linux/toolsets/toolset-2204.json b/images/linux/toolsets/toolset-2204.json index 66aa074c4..5ccee8a19 100644 --- a/images/linux/toolsets/toolset-2204.json +++ b/images/linux/toolsets/toolset-2204.json @@ -206,10 +206,6 @@ ] }, "brew": [ - { - "name": "zstd", - "command": "zstd" - } ], "docker": { "images": [ diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index ad95283f6..a1001f08c 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -252,7 +252,8 @@ "{{template_dir}}/scripts/installers/android.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/aws.sh" + "{{template_dir}}/scripts/installers/aws.sh", + "{{template_dir}}/scripts/installers/zstd.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 322643203..05677d2ab 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -253,7 +253,8 @@ "{{template_dir}}/scripts/installers/android.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/graalvm.sh" + "{{template_dir}}/scripts/installers/graalvm.sh", + "{{template_dir}}/scripts/installers/zstd.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", diff --git a/images/linux/ubuntu2204.pkr.hcl b/images/linux/ubuntu2204.pkr.hcl index de2dd44d6..d59d6903d 100644 --- a/images/linux/ubuntu2204.pkr.hcl +++ b/images/linux/ubuntu2204.pkr.hcl @@ -334,7 +334,8 @@ build { "${path.root}/scripts/installers/android.sh", "${path.root}/scripts/installers/pypy.sh", "${path.root}/scripts/installers/python.sh", - "${path.root}/scripts/installers/graalvm.sh" + "${path.root}/scripts/installers/graalvm.sh", + "${path.root}/scripts/installers/zstd.sh" ] }