Bug#1034214: tcmu-runner: dh_installsystemd doesn't handle files in /usr/lib/systemd/system

2023-04-25 Thread Cyril Brulebois
Control: tag -1 patch pending

Andreas Henriksson  (2023-04-12):
> A better solution would derive the path from systemd.pc, eg.
> pkg-config --variable=systemdsystemunitdir systemd
> 
> (Note: this needs pkg-config and systemd in build-deps)

Not during the hard freeze.

Minimal source debdiff attached, along with the resulting binary debdiff
for the tcmu-runner package.


Maintainer: I'm uploading to DELAYED/5, it can be either rescheduled to
DELAYED/0 if you're happy with the changes right now, or be superseded
by an upload of yours if that happens before the delay is over.


Cheers,
-- 
Cyril Brulebois (k...@debian.org)
D-I release manager -- Release team member -- Freelance Consultant
diff -Nru tcmu-1.5.4/debian/changelog tcmu-1.5.4/debian/changelog
--- tcmu-1.5.4/debian/changelog	2022-07-23 21:53:15.0 +
+++ tcmu-1.5.4/debian/changelog	2023-04-25 17:51:40.0 +
@@ -1,3 +1,11 @@
+tcmu (1.5.4-4.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Ship systemd unit under /lib/systemd/system so that it can get picked
+up by dh_installsystemd. Closes: #1034214
+
+ -- Cyril Brulebois   Tue, 25 Apr 2023 17:51:40 +
+
 tcmu (1.5.4-4) unstable; urgency=medium
 
   * QA upload.
diff -Nru tcmu-1.5.4/debian/tcmu-runner.install tcmu-1.5.4/debian/tcmu-runner.install
--- tcmu-1.5.4/debian/tcmu-runner.install	2022-07-23 21:53:15.0 +
+++ tcmu-1.5.4/debian/tcmu-runner.install	2023-04-25 17:51:39.0 +
@@ -1,5 +1,5 @@
 debian/tmp/etc
-debian/tmp/usr/lib/systemd/system/tcmu-runner.service
+debian/tmp/usr/lib/systemd/system/tcmu-runner.service /lib/systemd/system
 debian/tmp/usr/lib/*/tcmu-runner
 debian/tmp/usr/bin
 debian/tmp/usr/share
[The following lists of changes regard files as different if they have
different names, permissions or owners.]

Files in second .deb but not in first
-
-rw-r--r--  root/root   /usr/lib/systemd/system/tcmu-runner.service

Files in first .deb but not in second
-
-rw-r--r--  root/root   /lib/systemd/system/tcmu-runner.service

No differences were encountered between the conffiles files

Control files: lines which differ (wdiff format)

Installed-Size: [-326-] {+324+}
Version: [-1.5.4-4.1-] {+1.5.4-4+}

Postinst files: lines which differ (wdiff format)
-
[-# Automatically added by dh_installsystemd/13.11.4-]
[-if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = 
"abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then-]
[-  # The following line should be removed in trixie or trixie+1-]
[-  deb-systemd-helper unmask 'tcmu-runner.service' >/dev/null || true-]
[--]
[-  # was-enabled defaults to true, so new installations run enable.-]
[-  if deb-systemd-helper --quiet was-enabled 'tcmu-runner.service'; then-]
[-  # Enables the unit on first installation, creates new-]
[-  # symlinks on upgrades if the unit file has changed.-]
[-  deb-systemd-helper enable 'tcmu-runner.service' >/dev/null || 
true-]
[-  else-]
[-  # Update the statefile to add new symlinks (if any), which need 
to be-]
[-  # cleaned up on purge. Also remove old symlinks.-]
[-  deb-systemd-helper update-state 'tcmu-runner.service' 
>/dev/null || true-]
[-  fi-]
[-fi-]
[-# End automatically added section-]
[-# Automatically added by dh_installsystemd/13.11.4-]
[-if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = 
"abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then-]
[-  if [ -d /run/systemd/system ]; then-]
[-  systemctl --system daemon-reload >/dev/null || true-]
[-  if [ -n "$2" ]; then-]
[-  _dh_action=restart-]
[-  else-]
[-  _dh_action=start-]
[-  fi-]
[-  deb-systemd-invoke $_dh_action 'tcmu-runner.service' >/dev/null 
|| true-]
[-  fi-]
[-fi-]
[-# End automatically added section-]

Postrm files: lines which differ (wdiff format)
---
[-# Automatically added by dh_installsystemd/13.11.4-]
[-if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then-]
[-  systemctl --system daemon-reload >/dev/null || true-]
[-fi-]
[-# End automatically added section-]
[-# Automatically added by dh_installsystemd/13.11.4-]
[-if [ "$1" = "purge" ]; then-]
[-  if [ -x "/usr/bin/deb-systemd-helper" ]; then-]
[-  deb-systemd-helper purge 'tcmu-runner.service' >/dev/null || 
true-]
[-  fi-]
[-fi-]
[-# End automatically added section-]

No differences were encountered between the preinst files

Prerm files: lines which differ (wdiff format)
--
# Automatically added by [-dh_installsystemd/13.11.4-]
[-if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove

Bug#1034214: tcmu-runner: dh_installsystemd doesn't handle files in /usr/lib/systemd/system

2023-04-12 Thread Andreas Henriksson
On Tue, Apr 11, 2023 at 09:37:27AM +0200, bi...@debian.org wrote:
> Package: tcmu-runner
> Version: 1.5.4-4   
> Severity: serious
> Tags: sid bookworm
> User: debhel...@packages.debian.org
> Usertags: systemd-files-in-usr-bookworm
> 
> Dear Maintainer,
> 
> It seems that your package tcmu-runner is shipping files (.service, .socket or
> .timer) in /usr/lib/systemd/system.
[...]

tcmu-1.5.4> grep -R systemd.system .
./debian/tcmu-runner.install:debian/tmp/usr/lib/systemd/system/tcmu-runner.service
./README.md:1. If using systemd, copy `org.kernel.TCMUService1.service` to 
`/usr/share/dbus-1/system-services/` and `tcmu-runner.service` to 
`/lib/systemd/system`.
./CMakeLists.txt:  install(FILES tcmu-runner.service DESTINATION 
/usr/lib/systemd/system/)

These paths are wrong and the culprit of this bug report.

You could change them to use the currently correct path, but then you
would have to revert that again after bookworm is released when the
paths will change again.

A better solution would derive the path from systemd.pc, eg.
pkg-config --variable=systemdsystemunitdir systemd

(Note: this needs pkg-config and systemd in build-deps)

Since the upstream build system is CMake, there are plenty of others
to look at of how to implement using pkg-config and querying the
variable in CMake.
This should give you atleast a few hits that could be possible
examples to follow:
https://codesearch.debian.net/search?q=systemdsystemunitdir+path%3ACMake&literal=0
https://codesearch.debian.net/search?q=systemdsystemunitdir+path%3AFindSystemd&literal=0

Regards,
Andreas Henriksson