Skip to content

Commit 45ad096

Browse files
nolangemstorsjo
authored andcommitted
improve tar packaging
The generated tar archives contain the uid/gid of the builder, if unpacked as root on another system those will denote nothing or an unexpected user/group. The expectation would be uid/gid = 0. Use a simple enough tar format as well. The Mac version of tar (bsdtar?) does not support those flags, for CI the separate gnu-tar is installed.
1 parent 6b6b124 commit 45ad096

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
7878
NAME=llvm-mingw-$TAG-ucrt-$DISTRO
7979
mv llvm-mingw $NAME
80-
tar -Jcf ../$NAME.tar.xz $NAME
80+
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
8181
- uses: actions/upload-artifact@v4
8282
with:
8383
name: linux-ucrt-x86_64-toolchain
@@ -124,7 +124,7 @@ jobs:
124124
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-aarch64
125125
NAME=llvm-mingw-$TAG-ucrt-$DISTRO
126126
mv llvm-mingw $NAME
127-
tar -Jcf ../$NAME.tar.xz $NAME
127+
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
128128
- uses: actions/upload-artifact@v4
129129
with:
130130
name: linux-ucrt-aarch64-toolchain
@@ -157,7 +157,7 @@ jobs:
157157
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb --enable-asserts
158158
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
159159
cd install
160-
tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw
160+
tar -Jcf ../llvm-mingw-linux.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 llvm-mingw
161161
- uses: actions/upload-artifact@v4
162162
with:
163163
name: linux-asserts-toolchain
@@ -178,7 +178,7 @@ jobs:
178178
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
179179
TAG: ${{needs.prepare.outputs.TAG}}
180180
run: |
181-
brew install ninja
181+
brew install ninja gnu-tar
182182
# Disable zstd and python. Both are available on the runners, but
183183
# installed with homebrew, and only available in the native (x86_64)
184184
# form. Therefore, autodetection will pick them up, but linking
@@ -189,7 +189,7 @@ jobs:
189189
cd install
190190
NAME=llvm-mingw-$TAG-ucrt-macos-universal
191191
mv llvm-mingw $NAME
192-
tar -Jcf ../$NAME.tar.xz $NAME
192+
gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
193193
- uses: actions/upload-artifact@v4
194194
with:
195195
name: macos-ucrt-toolchain
@@ -241,7 +241,7 @@ jobs:
241241
cd install
242242
NAME=llvm-mingw-$TAG-ucrt-msys2-${{matrix.sys}}
243243
mv llvm-mingw $NAME
244-
tar -Jcf ../$NAME.tar.xz $NAME
244+
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
245245
- uses: actions/upload-artifact@v4
246246
with:
247247
name: msys2-${{matrix.sys}}-toolchain

.github/workflows/msvcrt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
7777
NAME=llvm-mingw-$TAG-msvcrt-$DISTRO
7878
mv llvm-mingw $NAME
79-
tar -Jcf ../$NAME.tar.xz $NAME
79+
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
8080
- uses: actions/upload-artifact@v4
8181
with:
8282
name: linux-msvcrt-x86_64-toolchain

release-macos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ rm -rf $DEST
3333
time CLEAN=1 SYNC=1 MACOS_REDIST=1 ./build-all.sh $DEST
3434
dir=$(pwd)
3535
cd $HOME
36-
tar -Jcvf $dir/$RELNAME.tar.xz $RELNAME
36+
gtar -Jcvf $dir/$RELNAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $RELNAME
3737
rm -rf $RELNAME
3838
cd $dir
3939
ls -lh $RELNAME.tar.xz

release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fi
3030
time docker build -f Dockerfile . -t mstorsjo/llvm-mingw:latest -t mstorsjo/llvm-mingw:$TAG
3131

3232
DISTRO=ubuntu-20.04-$(uname -m)
33-
docker run --rm mstorsjo/llvm-mingw:latest sh -c "cd /opt && mv llvm-mingw llvm-mingw-$TAG-ucrt-$DISTRO && tar -Jcvf - llvm-mingw-$TAG-ucrt-$DISTRO" > llvm-mingw-$TAG-ucrt-$DISTRO.tar.xz
33+
docker run --rm mstorsjo/llvm-mingw:latest sh -c "cd /opt && mv llvm-mingw llvm-mingw-$TAG-ucrt-$DISTRO && tar -Jcvf - --format=ustar --numeric-owner --owner=0 --group=0 llvm-mingw-$TAG-ucrt-$DISTRO" > llvm-mingw-$TAG-ucrt-$DISTRO.tar.xz
3434

3535
if [ -n "$NATIVEONLY" ]; then
3636
exit 0
@@ -57,7 +57,7 @@ msvcrt_image=llvm-mingw-msvcrt-$(uuidgen)
5757
temp_images="$temp_images $msvcrt_image"
5858
time docker build -f Dockerfile.dev -t $msvcrt_image --build-arg DEFAULT_CRT=msvcrt .
5959

60-
docker run --rm $msvcrt_image sh -c "cd /opt && mv llvm-mingw llvm-mingw-$TAG-msvcrt-$DISTRO && tar -Jcvf - llvm-mingw-$TAG-msvcrt-$DISTRO" > llvm-mingw-$TAG-msvcrt-$DISTRO.tar.xz
60+
docker run --rm $msvcrt_image sh -c "cd /opt && mv llvm-mingw llvm-mingw-$TAG-msvcrt-$DISTRO && tar -Jcvf - --format=ustar --numeric-owner --owner=0 --group=0 llvm-mingw-$TAG-msvcrt-$DISTRO" > llvm-mingw-$TAG-msvcrt-$DISTRO.tar.xz
6161

6262
for arch in i686 x86_64; do
6363
temp=$(uuidgen)

0 commit comments

Comments
 (0)