Skip to content

Commit 55effa8

Browse files
committed
Try to improve build on MacOS
1 parent 1c85ca3 commit 55effa8

File tree

2 files changed

+32
-38
lines changed

2 files changed

+32
-38
lines changed

.github/workflows/package_code.yml

+7-10
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
strategy:
6464
fail-fast: false
6565
matrix:
66-
os: [ macos-latest, ubuntu-latest, windows-latest ]
66+
os: [ macos-latest, ubuntu-latest ]
6767

6868
steps:
6969
- name: Checkout repository
@@ -92,19 +92,16 @@ jobs:
9292
current=CMakeFiles/dist/apache-log4cxx-$VERSION
9393
reference=CMakeFiles/reference/apache-log4cxx-$VERSION
9494
for format in tar.gz zip; do
95-
for hash in sha256 sha512; do
96-
if ! cmp --silent "$reference.$format.$hash" "$current.$format.$hash"; then
97-
echo Files apache-log4cxx-$VERSION.$format differ\! >& 2
98-
cat $reference.$format.$hash >& 2
99-
cat $current.$format.$hash >& 2
100-
exit 1
101-
fi
102-
done
95+
if ! cmp --silent "$reference.$format" "$current.$format"; then
96+
echo Files apache-log4cxx-$VERSION.$format differ\! >& 2
97+
exit 1
98+
fi
10399
done
104100
105101
- name: Upload reproducibility results
106102
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 4.4.3
107-
if: ${{ failure() && steps.check.conclusion == 'failure' }}
103+
if: ${{ always() }}
104+
#if: ${{ failure() && steps.check.conclusion == 'failure' }}
108105
with:
109106
name: apache-log4cxx-reproducibility-${{ matrix.os }}
110107
path: |

package.sh

+25-28
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@ if ! echo "$OUTPUT_TIMESTAMP" | grep -Eq "^$d{4}-$d{2}-$d{2}T$d{2}:$d{2}:$d{2}Z$
1818
exit 1
1919
fi
2020

21-
# Build directory containing temporary files
21+
# Build directory containing temporary files, all the paths are relative to it.
2222
#
2323
build=CMakeFiles
2424

25-
# Directory containing the distribution archives
26-
#
27-
dist="$build/dist"
28-
2925
# Create source directory
30-
mkdir -p "$dist"
31-
OUTPUT_DIR="$build/apache-log4cxx-$VERSION"
26+
mkdir -p "$build/dist"
27+
OUTPUT_DIR="apache-log4cxx-$VERSION"
3228
if [ -f "$OUTPUT_DIR" ]; then
3329
if [ ! -d "$OUTPUT_DIR" ]; then
3430
echo File "$OUTPUT_DIR" is not a directory >& 2
@@ -39,7 +35,7 @@ if [ -f "$OUTPUT_DIR" ]; then
3935
exit 1
4036
fi
4137
fi
42-
mkdir -p "$OUTPUT_DIR"
38+
mkdir -p "$build/$OUTPUT_DIR"
4339

4440
# Copy files to directory
4541
cp -r \
@@ -52,13 +48,13 @@ cp -r \
5248
src \
5349
liblog4cxx.pc.in \
5450
liblog4cxx-qt.pc.in \
55-
"$OUTPUT_DIR"
56-
rm -r "$OUTPUT_DIR"/src/main/abi-symbols
51+
"$build/$OUTPUT_DIR"
52+
rm -r "$build/$OUTPUT_DIR"/src/main/abi-symbols
5753

5854
# Create TAR file
5955
#
6056
# See https://reproducible-builds.org/docs/archives/ for reproducibility tips
61-
TAR_ARCHIVE="$dist/apache-log4cxx-$VERSION.tar.gz"
57+
TAR_ARCHIVE="dist/apache-log4cxx-$VERSION.tar.gz"
6258
echo 'Tar version:'
6359
tar --version | sed -e 's/^/\t/'
6460
echo 'Gzip version:'
@@ -68,43 +64,44 @@ if [ -f "$TAR_ARCHIVE" ]; then
6864
exit 1
6965
fi
7066

71-
tar --transform="s!^$OUTPUT_DIR!apache-log4cxx-$VERSION!" \
72-
--mtime="$OUTPUT_TIMESTAMP" \
73-
--owner=0 --group=0 --numeric-owner \
74-
--sort=name \
75-
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
76-
--create --gzip --file "$TAR_ARCHIVE" "$OUTPUT_DIR"
77-
78-
echo -e Tar archive: "$TAR_ARCHIVE"
67+
(
68+
cd "$build"
69+
tar --mtime="$OUTPUT_TIMESTAMP" \
70+
--owner=0 --group=0 --numeric-owner \
71+
--sort=name \
72+
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
73+
--create --gzip --file "$TAR_ARCHIVE" "$OUTPUT_DIR"
74+
)
75+
echo -e Tar archive: "$build/$TAR_ARCHIVE"
7976

8077
# Create ZIP file
8178
#
8279
# See https://reproducible-builds.org/docs/archives/ for reproducibility tips
8380
# Change the mtime of all files
84-
ZIP_ARCHIVE="$dist/apache-log4cxx-$VERSION.zip"
81+
ZIP_ARCHIVE="dist/apache-log4cxx-$VERSION.zip"
8582
echo 'Zip version:'
8683
zip --version | sed 's/^/\t/'
8784
if [ -f "$ZIP_ARCHIVE" ]; then
8885
echo Archive "$ZIP_ARCHIVE" already exists >& 2
8986
exit 1
9087
fi
9188

92-
find "$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} +
89+
find "$build/$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} +
9390
# Sort files and zip.
9491
(
9592
cd "$build"
96-
find apache-log4cxx-$VERSION -print0 |
93+
find "$OUTPUT_DIR" -print0 |
9794
LC_ALL=C sort -z |
98-
xargs -0 zip -q -X dist/apache-log4cxx-$VERSION.zip
95+
xargs -0 zip -q -X "$ZIP_ARCHIVE"
9996
)
10097

101-
echo -e ZIP archive: "$ZIP_ARCHIVE"
98+
echo -e ZIP archive: "$build/$ZIP_ARCHIVE"
10299

103100
# Generate hashes
104101
(
105-
cd "$dist"
106-
for format in tar.gz zip; do
107-
sha256sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha256
108-
sha512sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha512
102+
cd "$build/dist"
103+
for file in *; do
104+
sha256sum "$file" > "$file.sha256"
105+
sha512sum "$file" > "$file.sha512"
109106
done
110107
)

0 commit comments

Comments
 (0)