Skip to content

Commit b5d5983

Browse files
committed
Create reproducible tarballs
1 parent 7ce3ba3 commit b5d5983

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
location="$(dirname -- "$( readlink -f -- "$0"; )";)"
9+
cd "$location"
10+
11+
export NGSCOPECLIENT_PACKAGE_VERSION="$(git describe --always --tags)"
12+
export NGSCOPECLIENT_PACKAGE_VERSION_LONG="$(git describe --always --tags --long)"
13+
export SCOPEHAL_PACKAGE_VERSION="$(cd lib;git describe --always --tags --long)"
14+
cat release-info.cmake.in | envsubst > release-info.cmake
15+
16+
git_file_list=$(git ls-files --recurse-submodules )
17+
18+
TARFLAGS="
19+
--sort=name --format=posix
20+
--pax-option=exthdr.name=%d/PaxHeaders/%f
21+
--pax-option=delete=atime,delete=ctime
22+
--mtime=0
23+
--numeric-owner --owner=0 --group=0
24+
--mode=go+u,go-w
25+
"
26+
27+
git_file_list="$git_file_list release-info.cmake"
28+
29+
GZIPFLAGS="--no-name --best"
30+
31+
rm -Rf tarballs
32+
mkdir "tarballs"
33+
34+
LC_ALL=C tar $TARFLAGS -cf - $git_file_list |
35+
gzip $GZIPFLAGS > "tarballs/ngscopeclient-$NGSCOPECLIENT_PACKAGE_VERSION.tar.gz"
36+
37+
cd tarballs
38+
echo "" > ../digest.txt
39+
for file in *; do
40+
sha256sum $file >> ../digest.txt
41+
ls -s $file >> ../digest.txt
42+
sha256sum $file > $file.sha256sum
43+
done
44+
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)