mkosi: Stop using git commit timestamps for package releases
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 26 Aug 2024 11:08:25 +0000 (13:08 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 26 Aug 2024 13:22:29 +0000 (14:22 +0100)
This prevents bisecting to figure out which commit broke something
as when going backwards the git commit timestamp will be older meaning
package managers will refuse to upgrade to the "older" version. Let's
make sure the release is always newer by using the current date unless
$SOURCE_DATE_EPOCH is set.

mkosi.images/build/mkosi.conf.d/arch/mkosi.build.chroot
mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.build.chroot
mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.build.chroot
mkosi.images/build/mkosi.conf.d/opensuse/mkosi.build.chroot

index 3ffde85f35faf43c823ae5ade0ace9ce5be0cc36..176f0b8869b7a9f9182eb3baa13974ce4ae63339 100755 (executable)
@@ -61,11 +61,7 @@ EOF
 # Linting the PKGBUILD takes multiple seconds every build so avoid that by nuking all the linting functions.
 rm /usr/share/makepkg/lint_pkgbuild/*
 
-if [[ -d .git/ ]] && [[ -z "$(git status --porcelain)" ]]; then
-    TS="$(git show --no-patch --format=%ct HEAD)"
-else
-    TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
-fi
+TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
 
 sed --in-place "pkg/$PKG_SUBDIR/PKGBUILD" \
     --expression "s/^_tag=.*/_tag=$(cat meson.version)/" \
index 466699c4fdc6cd464a6e434341d5b445d2b2be42..ce69aa33b75012f0a95227c0665bc5475182d972 100755 (executable)
@@ -9,11 +9,7 @@ if [[ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]]; then
     exit 1
 fi
 
-if [[ -d .git/ ]] && [[ -z "$(git status --porcelain)" ]]; then
-    TS="$(git show --no-patch --format=%ct HEAD)"
-else
-    TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
-fi
+TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
 
 if [[ "$(rpm --eval "%{lua:print(rpm.vercmp('$(rpm --version | cut -d ' ' -f3)', '4.19.91'))}")" == "-1" ]]; then
     # Fix the %install override so debuginfo packages are generated even when --build-in-place is used.
index 03b3b049eb9c920ccaab036eb08ceca72b221558..0d33b10d6f05c4d45447c9deb48cda61b8f1aeea 100755 (executable)
@@ -18,11 +18,7 @@ rm -rf "$SRCDIR"/debian/patches/*
 DEB_HOST_GNU_TYPE="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"
 mount --mkdir --bind "$BUILDDIR" "$SRCDIR/obj-$DEB_HOST_GNU_TYPE"
 
-if [[ -d .git/ ]] && [[ -z "$(git status --porcelain)" ]]; then
-    TS="$(git show --no-patch --format=%ct HEAD)"
-else
-    TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
-fi
+TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
 
 # Add a new changelog entry to update the version. We use a fixed date since a dynamic one causes a full
 # rebuild every time.
index a1fb83cdd9320a5ebfd8938488d025db63567710..173468f6c1427cdd8c19ee6b8b2fa190f13acc20 100755 (executable)
@@ -9,11 +9,7 @@ if [[ ! -f "pkg/$PKG_SUBDIR/systemd.spec" ]]; then
     exit 1
 fi
 
-if [[ -d .git/ ]] && [[ -z "$(git status --porcelain)" ]]; then
-    TS="$(git show --no-patch --format=%ct HEAD)"
-else
-    TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
-fi
+TS="${SOURCE_DATE_EPOCH:-$(date +%s)}"
 
 # The openSUSE filelists hardcode the manpage compression extension. This causes rpmbuild errors since we
 # disable manpage compression as the files cannot be found. Fix the issue by removing the compression