This commit is contained in:
OBattler
2022-07-16 04:11:03 +02:00
2 changed files with 16 additions and 4 deletions

2
.ci/Jenkinsfile vendored
View File

@@ -215,7 +215,7 @@ pipeline {
/* Create source tarball. */
try {
retry(10) {
node('Linux') {
node('Linux || macOS') {
/* Run git clone. */
gitClone(repository[buildBranch], branch[buildBranch])

View File

@@ -52,8 +52,20 @@ make_tar() {
# Install dependencies.
if ! which tar xz > /dev/null 2>&1
then
which apt-get > /dev/null 2>&1 && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y tar xz-utils
if which apt-get > /dev/null 2>&1
then
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y tar xz-utils
sudo apt-get clean
elif which port > /dev/null 2>&1
then
sudo port install gnutar xz
fi
fi
# Prefer gnutar on macOS.
local tar_cmd=tar
which gnutar > /dev/null 2>&1 && tar_cmd=gnutar
# Determine the best supported compression type.
local compression_flag=
@@ -80,7 +92,7 @@ make_tar() {
# --uid/gid (bsdtar) or even none at all (MSYS2 bsdtar). Account for such
# flag differences by checking if they're mentioned on the help text.
local ownership_flags=
local tar_help=$(tar --help 2>&1)
local tar_help=$("$tar_cmd" --help 2>&1)
if echo $tar_help | grep -q -- --owner
then
local ownership_flags="--owner=0 --group=0"
@@ -90,7 +102,7 @@ make_tar() {
fi
# Run tar.
tar -c $compression_flag -f "$1$compression_ext" $ownership_flags *
"$tar_cmd" -c $compression_flag -f "$1$compression_ext" $ownership_flags *
return $?
}