mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Derive all build timestamps from BUILDDATE
The build date stored in version.h is now the single time source for a release. Each package workflow converts it to SOURCE_DATE_EPOCH and passes that into the build containers, the debian changelog entry is stamped from it rather than from the build clock, and rpmbuild is told to use it as the build time and to clamp file mtimes to it. rpm also records the build host, which is a container id and therefore differs on every run, so pin it as well - otherwise the timestamps alone do not make the package reproducible. Rebuilding the same commit now produces byte identical packages, verified for both formats by building twice and comparing checksums. In the version workflow the clock is read exactly once, when a new build date is minted. YEAR3PROXY is derived from the build date instead of being read separately, so the two cannot straddle a year boundary and a re-run in a later year no longer rewrites version.h.
This commit is contained in:
1 parent
3dcd83e6d6
commit
4b48311d82
4 files changed
+31
-11
No files matched your search
@@ -27,8 +27,10 @@ jobs:
|
||||
pwd
|
||||
echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV
|
||||
BUILDDATE=$(sed -n 's/^#define BUILDDATE "\(.*\)"$/\1/p' src/version.h)
|
||||
[ -n "$BUILDDATE" ] || BUILDDATE=$(date +%y%m%d%H%M%S)
|
||||
[ -n "$BUILDDATE" ] || BUILDDATE=$(date -u +%y%m%d%H%M%S)
|
||||
echo "VERSION=$BUILDDATE" >> $GITHUB_ENV
|
||||
SOURCE_DATE_EPOCH=$(date -u -d "20${BUILDDATE:0:2}-${BUILDDATE:2:2}-${BUILDDATE:4:2} ${BUILDDATE:6:2}:${BUILDDATE:8:2}:${BUILDDATE:10:2}" +%s)
|
||||
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" >> $GITHUB_ENV
|
||||
- name: echo env
|
||||
run: echo "release $RELEASE version $VERSION"
|
||||
- name: Linux libraries
|
||||
@@ -52,6 +54,7 @@ jobs:
|
||||
-v "$PWD/scripts/rh/3proxy.spec:/3proxy.spec:ro" \
|
||||
-v "$PWD/rpmout:/out" \
|
||||
-e RELEASE="$RELEASE" -e HOSTUID="$(id -u)" -e HOSTGID="$(id -g)" \
|
||||
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||
"almalinux:$EL" bash -c '
|
||||
set -e
|
||||
dnf -y install rpm-build gcc make openssl-devel pcre2-devel pam-devel tar gzip
|
||||
@@ -60,7 +63,11 @@ jobs:
|
||||
ln -sf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
|
||||
cp /3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
|
||||
cd ~/rpmbuild/SPECS
|
||||
rpmbuild -ba 3proxy-$RELEASE.spec
|
||||
rpmbuild -ba \
|
||||
--define "use_source_date_epoch_as_buildtime 1" \
|
||||
--define "clamp_mtime_to_source_date_epoch 1" \
|
||||
--define "_buildhost 3proxy.org" \
|
||||
3proxy-$RELEASE.spec
|
||||
cp ~/rpmbuild/RPMS/*/*.rpm /out/
|
||||
chown "$HOSTUID:$HOSTGID" /out/*.rpm || chmod 0666 /out/*.rpm'
|
||||
done
|
||||
@@ -81,6 +88,7 @@ jobs:
|
||||
docker run --rm \
|
||||
-v "$HOME/debian:/debian" \
|
||||
-e RELEASE="$RELEASE" -e VERSION="$VERSION" \
|
||||
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||
ubuntu:22.04 bash -c '
|
||||
set -e
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
@@ -93,7 +101,7 @@ jobs:
|
||||
echo " "
|
||||
echo " *3proxy $RELEASE build"
|
||||
echo " "
|
||||
echo " -- z3APA3A <3apa3a@3proxy.org> $(date "+%a, %d %b %Y %H:%M:%S %z")"
|
||||
echo " -- z3APA3A <3apa3a@3proxy.org> $(date -R -u -d @$SOURCE_DATE_EPOCH)"
|
||||
echo ""
|
||||
} > debian/changelog
|
||||
dpkg-buildpackage'
|
||||
|
||||
Reference in new issue
Block a user