From 73f63fd6817bb3c460c2a0bac1efbcebde5a6289 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Tue, 14 Jan 2025 19:57:37 +0000
Subject: [PATCH] core/systemd to 257.2-2

---
 core/systemd/.SRCINFO        |  6 +++++-
 core/systemd/PKGBUILD        | 36 +++++++++++++-----------------------
 core/systemd/systemd.install |  9 ++++++++-
 3 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/core/systemd/.SRCINFO b/core/systemd/.SRCINFO
index 71322f83f..686b2220e 100644
--- a/core/systemd/.SRCINFO
+++ b/core/systemd/.SRCINFO
@@ -1,6 +1,6 @@
 pkgbase = systemd
 	pkgver = 257.2
-	pkgrel = 1
+	pkgrel = 2
 	url = https://www.github.com/systemd/systemd
 	arch = x86_64
 	license = LGPL-2.1-or-later
@@ -206,6 +206,10 @@ pkgname = systemd-sysvcompat
 	depends = systemd=257.2
 	conflicts = sysvinit
 
+pkgname = systemd-tests
+	pkgdesc = systemd tests
+	depends = systemd=257.2
+
 pkgname = systemd-ukify
 	pkgdesc = Combine kernel and initrd into a signed Unified Kernel Image
 	depends = systemd=257.2
diff --git a/core/systemd/PKGBUILD b/core/systemd/PKGBUILD
index b3615fdba..5aa9e7876 100644
--- a/core/systemd/PKGBUILD
+++ b/core/systemd/PKGBUILD
@@ -20,13 +20,13 @@ pkgname=('systemd'
          'systemd-libs'
          'systemd-resolvconf'
          'systemd-sysvcompat'
+         'systemd-tests'
          'systemd-ukify')
-_tag='257.2'
 # Upstream versioning is incompatible with pacman's version comparisons, one
-# way or another. So we replace dashes and tildes with the empty string to
-# make sure pacman's version comparing does the right thing for rc versions:
-pkgver="${_tag/[-~]/}"
-pkgrel=1
+# way or another. We use proper version for pacman here (no dash for rc
+# release!), and change in source array below.
+pkgver='257.2'
+pkgrel=2
 arch=('x86_64')
 license=('LGPL-2.1-or-later')
 url='https://www.github.com/systemd/systemd'
@@ -44,7 +44,9 @@ validpgpkeys=('63CDA1E5D3FC22B998D20DD6327F26951A015CC4'  # Lennart Poettering <
               'A9EA9081724FFAE0484C35A1A81CEA22BC8C7E2E'  # Luca Boccassi <luca.boccassi@gmail.com>
               '9A774DB5DB996C154EBBFBFDA0099A18E29326E1'  # Yu Watanabe <watanabe.yu+github@gmail.com>
               '5C251B5FC54EB2F80F407AAAC54CA336CFEB557E') # Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
-source=("git+https://github.com/systemd/systemd#tag=v${_tag}?signed"
+# For pacman's version comparisons $pkgver is missing the dash that would be
+# in an upstream rc version so add it back when fetching the tag from github.
+source=("git+https://github.com/systemd/systemd#tag=v${pkgver/rc/-rc}?signed"
         '0001-Use-Arch-Linux-device-access-groups.patch'
         # bootloader files
         'arch.conf'
@@ -85,29 +87,17 @@ sha512sums=('60e09576738abf1d328d06daae8981780a9a4facc5b09e2a3ae24b8461e23d3be2a
             '825b9dd0167c072ba62cabe0677e7cd20f2b4b850328022540f122689d8b25315005fa98ce867cf6e7460b2b26df16b88bb3b5c9ebf721746dce4e2271af7b97')
 
 _meson_version="${pkgver}-${pkgrel}"
-_meson_vcs_tag='false'
-_meson_mode='release'
-_meson_compile=()
-_meson_install=()
 _systemd_src_dir="${pkgbase}"
 
 if ((_systemd_UPSTREAM)); then
   _meson_version="${pkgver}"
-  _meson_vcs_tag='true'
-  _meson_mode='developer'
-  pkgname+=('systemd-tests')
-  if ((_systemd_QUIET)); then
-    _meson_install=('--quiet')
-  else
-    _meson_compile=('--verbose')
-  fi
 fi
 
 # Some heuristics to detect that we are building on OBS, with no network access. Skip
 # git verification, and use the OBS-provided tarball instead. The sources will be
 # unpacked by OBS in $package-$version/
 if [ -f /.build/build.dist ] && [ -d /usr/src/packages/SOURCES ] &&  [ -d /usr/src/packages/BUILD ] &&  [ -d /usr/src/packages/OTHER ]; then
-  source[0]="${pkgbase}-${pkgver}.tar.gz"
+  source[0]="$(find . -name "${pkgbase}-${pkgver}.tar.*" -print -quit)"
   sha512sums[0]='SKIP'
   _systemd_src_dir="${pkgbase}-${pkgver}"
 fi
@@ -158,9 +148,9 @@ build() {
 
   local _meson_options=(
     -Dversion-tag="${_meson_version}-arch"
-    -Dvcs-tag="${_meson_vcs_tag}"
+    -Dvcs-tag=false
     -Dshared-lib-tag="${_meson_version}"
-    -Dmode="${_meson_mode}"
+    -Dmode=release
 
     -Dapparmor=disabled
     -Dbootloader=enabled
@@ -201,7 +191,7 @@ build() {
 
   arch-meson "${_systemd_src_dir}" build "${_meson_options[@]}" $MESON_EXTRA_CONFIGURE_OPTIONS
 
-  meson compile -C build "${_meson_compile[@]}"
+  meson compile -C build
 }
 
 check() {
@@ -259,7 +249,7 @@ package_systemd() {
           etc/udev/udev.conf)
   install=systemd.install
 
-  meson install -C build --no-rebuild --destdir "$pkgdir" "${_meson_install[@]}"
+  meson install -C build --no-rebuild --destdir "$pkgdir" --quiet
 
   # we'll create this on installation
   rmdir "$pkgdir"/var/log/journal/remote
diff --git a/core/systemd/systemd.install b/core/systemd/systemd.install
index c9335173e..ef82269ba 100644
--- a/core/systemd/systemd.install
+++ b/core/systemd/systemd.install
@@ -4,6 +4,13 @@ sd_booted() {
   [[ -d run/systemd/system && ! -L run/systemd/system ]]
 }
 
+services_needing_restart() {
+  systemctl list-units --state=running --plain --quiet 'systemd-*.service' \
+    | cut -d' ' -f1 \
+    | grep -Ev '^systemd-(logind|networkd)\.service$' \
+    | grep -Ev '^systemd-.*@.*\.service$'
+}
+
 post_common() {
   systemd-sysusers
   journalctl --update-catalog
@@ -43,7 +50,7 @@ post_upgrade() {
     systemctl reload 'user@*.service'
 
     # mark systemd services for later restart
-    for UNIT in $(systemctl list-units --state=running --plain --quiet 'systemd-*.service' | cut -d' ' -f1 | grep -Ev '^systemd-(logind|networkd)\.service$'); do
+    for UNIT in $(services_needing_restart); do
       systemctl set-property --runtime "${UNIT}" Markers=needs-restart
     done
   fi