mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-06-24 00:01:05 +00:00
a2378ba780
Port SOURCE_DATE_EPOCH patterns from xcat-core to all xcat-dep build scripts. RPM and Debian packages now produce identical output given the same Gitepoch timestamp, regardless of build host or time. EL (RPM) changes: - mockbuild-all.pl: --build-timestamp flag, deterministic run_id, tar --sort/--owner/--group/--mtime, createrepo --revision - All mockbuild.pl: SOURCE_DATE_EPOCH cascade (CLI > Gitepoch > git > time), deterministic mock config with SOURCE_DATE_EPOCH in chroot env, RPM macros for timestamp clamping and fixed buildhost - goconserver: -trimpath -buildvcs=false, canonical rpmbuild path - xnba: canonical rpmbuild path - syslinux: ZERO_AR_DATE=1 in mock env Ubuntu (Debian) changes: - All make_deb.sh: SOURCE_DATE_EPOCH fallback from Gitepoch - goconserver: deterministic SNAP_TS and changelog from epoch, -trimpath -buildvcs=false in debian/rules - syslinux: -fdebug-prefix-map for path-independent debug info - build-apt-repo.sh: gzip -n, Release Date: from SOURCE_DATE_EPOCH Verified: 31/33 package artifacts produce identical SHA256 hashes across independent builds. 2 syslinux sub-packages (devel, debugsource) have known limitations from upstream build system.
61 lines
1.6 KiB
Bash
Executable File
61 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
VERSION=0.3.3
|
|
REPO=https://github.com/xcat2/goconserver.git
|
|
REF=master
|
|
|
|
if [ -z "${SOURCE_DATE_EPOCH:-}" ]; then
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
if [ -f "$REPO_ROOT/Gitepoch" ]; then
|
|
export SOURCE_DATE_EPOCH=$(cat "$REPO_ROOT/Gitepoch")
|
|
fi
|
|
fi
|
|
|
|
if [ -n "${SOURCE_DATE_EPOCH:-}" ]; then
|
|
SNAP_TS=$(date -d "@$SOURCE_DATE_EPOCH" --utc '+%Y%m%d%H%M')
|
|
else
|
|
SNAP_TS=$(date '+%Y%m%d%H%M')
|
|
fi
|
|
FULL_VERSION="${VERSION}-snap${SNAP_TS}"
|
|
|
|
WORKDIR=$(mktemp -d)
|
|
trap "rm -rf $WORKDIR" EXIT
|
|
|
|
echo "Cloning goconserver..."
|
|
git clone --depth 1 --branch "$REF" "$REPO" "$WORKDIR/goconserver-$VERSION"
|
|
|
|
cd "$WORKDIR/goconserver-$VERSION"
|
|
|
|
# etcd storage backend has broken deps with modern Go modules
|
|
rm -rf storage/etcd.go storage/etcd/
|
|
|
|
export GOPATH="$WORKDIR/gopath"
|
|
export GOCACHE="$WORKDIR/gocache"
|
|
export GOMODCACHE="$WORKDIR/gomodcache"
|
|
export CGO_ENABLED=0
|
|
|
|
go mod init github.com/xcat2/goconserver
|
|
go mod tidy
|
|
|
|
cp -rL "$SCRIPT_DIR/debian" .
|
|
|
|
sed -i "s/Version=${VERSION}/Version=${FULL_VERSION}/g" debian/rules
|
|
|
|
if [ -n "${SOURCE_DATE_EPOCH:-}" ]; then
|
|
export DEBEMAIL="${DEBEMAIL:-xcat-build@xcat.org}"
|
|
export DEBFULLNAME="${DEBFULLNAME:-xCAT Build}"
|
|
deterministic_date=$(date -R -d "@$SOURCE_DATE_EPOCH" --utc)
|
|
sed -i "1s/(.*)/(${FULL_VERSION})/" debian/changelog
|
|
sed -i "s/^ -- .*/ -- $DEBFULLNAME <$DEBEMAIL> $deterministic_date/" debian/changelog
|
|
else
|
|
dch -v "$FULL_VERSION" -b -D unstable "Snap build for xCAT"
|
|
fi
|
|
|
|
dpkg-buildpackage -uc -us
|
|
|
|
echo "Built debs:"
|
|
ls "$WORKDIR"/*.deb
|
|
cp "$WORKDIR"/*.deb "$SCRIPT_DIR/../"
|