Skip to content

Commit 3f19c24

Browse files
committed
Create reproducible tarballs
1 parent 7ce3ba3 commit 3f19c24

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Create tarballs
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
Linux:
10+
strategy:
11+
fail-fast: true
12+
matrix:
13+
os:
14+
- name: debian
15+
version: base
16+
17+
runs-on: ubuntu-latest
18+
container:
19+
image: debian:trixie
20+
env:
21+
SDK_VERSION_STANDALONE: 1.4.325.0
22+
SDK_VERSION_REPO: 1.4.309
23+
24+
defaults:
25+
run:
26+
shell: bash
27+
28+
steps:
29+
- name: show env
30+
run: env
31+
- name: Install dependencies
32+
run: |
33+
apt-get update
34+
apt-get upgrade -y
35+
apt-get install -y \
36+
git \
37+
gettext-base
38+
39+
- name: Check Out Code
40+
uses: actions/checkout@v4
41+
with:
42+
submodules: recursive
43+
44+
- name: Fix missing tags
45+
run: |
46+
git config --global --add safe.directory `pwd`
47+
git submodule foreach 'git fetch --unshallow --tags|| true'
48+
git fetch --unshallow --tags
49+
git submodule update --recursive
50+
./create-tarballs.sh
51+
echo "Checksums"
52+
cat tarballs/*.txt
53+
echo "Extracted versions"
54+
cat release-info.cmake
55+
56+
- name: Create tarballs
57+
run: |
58+
./create-tarballs.sh
59+
echo "Checksums"
60+
cat tarballs/*.txt
61+
echo "Extracted versions"
62+
cat release-info.cmake
63+
64+
- name: Upload Artifacts
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: ngscopeclient-source
68+
path: |
69+
tarballs/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ asan-build
66
release-nodebug-build
77
debug-noopt-build
88
release-asan-build
9+
tarballs

create-tarballs.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
#Loosely based on https://www.gnu.org/software/tar/manual/html_section/Reproducibility.html
4+
#Drop the mtime attribute from the files since I was unable to reliably make that reproducible
5+
6+
set -e
7+
8+
export TZ=UTC0
9+
export LANG=C
10+
11+
location="$(dirname -- "$( readlink -f -- "$0"; )";)"
12+
cd "$location"
13+
14+
export NGSCOPECLIENT_PACKAGE_VERSION="$(git describe --always --tags)"
15+
export NGSCOPECLIENT_PACKAGE_VERSION_LONG="$(git describe --always --tags --long)"
16+
export SCOPEHAL_PACKAGE_VERSION="$(cd lib;git describe --always --tags --long)"
17+
cat release-info.cmake.in | envsubst > release-info.cmake
18+
19+
git_file_list=$(git ls-files --recurse-submodules )
20+
21+
TARFLAGS="
22+
--sort=name --format=posix
23+
--pax-option=exthdr.name=%d/PaxHeaders/%f
24+
--pax-option=delete=atime,delete=ctime
25+
--mtime=0
26+
--numeric-owner --owner=0 --group=0
27+
--mode=go+u,go-w
28+
"
29+
30+
git_file_list="$git_file_list release-info.cmake"
31+
32+
GZIPFLAGS="--no-name --best"
33+
34+
rm -Rf tarballs
35+
mkdir "tarballs"
36+
37+
LC_ALL=C tar $TARFLAGS -cf - $git_file_list |
38+
gzip $GZIPFLAGS > "tarballs/ngscopeclient-$NGSCOPECLIENT_PACKAGE_VERSION.tar.gz"
39+
40+
cd tarballs
41+
echo "" > ../digest.txt
42+
for file in *; do
43+
sha256sum $file >> ../digest.txt
44+
ls -s $file >> ../digest.txt
45+
sha256sum $file > $file.sha256sum
46+
done
47+
mv ../digest.txt "ngscopeclient-$NGSCOPECLIENT_PACKAGE_VERSION-manifest.txt"

release-info.cmake.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set(SCOPEHAL_PACKAGE_VERSION "${SCOPEHAL_PACKAGE_VERSION}" CACHE STRING "scopehal package version override")
2+
set(NGSCOPECLIENT_PACKAGE_VERSION "${NGSCOPECLIENT_PACKAGE_VERSION}" CACHE STRING "ngscopeclient package version override")
3+
set(NGSCOPECLIENT_PACKAGE_VERSION_LONG "${NGSCOPECLIENT_PACKAGE_VERSION_LONG}" CACHE STRING "ngscopeclient long package version override")

0 commit comments

Comments
 (0)