Skip to content

Commit

Permalink
improve tar packaging
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nolange committed Feb 8, 2024
1 parent 6775203 commit 9067da0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-mingw-$TAG-ucrt-$DISTRO
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
- uses: actions/upload-artifact@v4
with:
name: linux-ucrt-x86_64-toolchain
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-aarch64
NAME=llvm-mingw-$TAG-ucrt-$DISTRO
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
- uses: actions/upload-artifact@v4
with:
name: linux-ucrt-aarch64-toolchain
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
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
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install
tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw
tar -Jcf ../llvm-mingw-linux.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 llvm-mingw
- uses: actions/upload-artifact@v4
with:
name: linux-asserts-toolchain
Expand All @@ -178,7 +178,7 @@ jobs:
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}}
run: |
brew install ninja
brew install ninja gnu-tar
# Disable zstd and python. Both are available on the runners, but
# installed with homebrew, and only available in the native (x86_64)
# form. Therefore, autodetection will pick them up, but linking
Expand All @@ -189,7 +189,7 @@ jobs:
cd install
NAME=llvm-mingw-$TAG-ucrt-macos-universal
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz $NAME
gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
- uses: actions/upload-artifact@v4
with:
name: macos-ucrt-toolchain
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
cd install
NAME=llvm-mingw-$TAG-ucrt-msys2-${{matrix.sys}}
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
- uses: actions/upload-artifact@v4
with:
name: msys2-${{matrix.sys}}-toolchain
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/msvcrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-mingw-$TAG-msvcrt-$DISTRO
mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME
- uses: actions/upload-artifact@v4
with:
name: linux-msvcrt-x86_64-toolchain
Expand Down
2 changes: 1 addition & 1 deletion release-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -rf $DEST
time CLEAN=1 SYNC=1 MACOS_REDIST=1 ./build-all.sh $DEST
dir=$(pwd)
cd $HOME
tar -Jcvf $dir/$RELNAME.tar.xz $RELNAME
gtar -Jcvf $dir/$RELNAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $RELNAME
rm -rf $RELNAME
cd $dir
ls -lh $RELNAME.tar.xz
4 changes: 2 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi
time docker build -f Dockerfile . -t mstorsjo/llvm-mingw:latest -t mstorsjo/llvm-mingw:$TAG

DISTRO=ubuntu-20.04-$(uname -m)
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
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

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

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
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

for arch in i686 x86_64; do
temp=$(uuidgen)
Expand Down

0 comments on commit 9067da0

Please sign in to comment.