Is it possible to mix systemd and non-systemd in a rules file?

Michael Biebl biebl at debian.org
Thu Nov 5 15:00:04 GMT 2020


Am 05.11.20 um 15:55 schrieb Alex Nelson:
> Hmm, if I could have 2 rules files, I would have one saying "--with 
> systemd" and the other would not say "--with systemd".
> I think you are asking so what?
> 
> Here is my rules file:
> 
> *#!/usr/bin/make -f
> # -*- makefile -*-
> 
> # Uncomment this to turn on verbose mode.
> export DH_VERBOSE=1
> 
> %:
>          dh $@ --with python3,systemd --buildsystem=pybuild
> 
> # Until debhelper compat 11, you need to explicitly indicate there are no
> # SysV .init files.  We are using compat 9 for now.
> override_dh_installinit:
>          dh_installinit -n --name=package_two
> 
> override_dh_systemd_enable:
>          dh_systemd_enable --name=package_two
> 
> override_dh_systemd_start:
>          dh_systemd_start --restart-after-upgrade package_two*
> *
> *
> *
> *
> setup.py finds the two packages (package_one and package_two).
> After building, as expected, I get 2 debian packages.
> I did not expect to see any references to systemd in package_one.
> Before I starting hacking around, the rules line looked like this:
> 
> *dh $@ --with python3 --buildsystem=pybuild
> *
> *
> *
> and generated no references to anything systemd in debian package_one.
> 
> After adding "systemd" to the Makefile line, my package one debian 
> package generates all kinds of unwanted systemd references.
> For example, the debian package for my *package_one *has systemd 
> references to *package_two*.
> 
> Here is the postint  that now lives in debian package_one:
> 
> *#!/bin/sh
> set -e
> # Automatically added by dh_systemd_enable
> # This will only remove masks created by d-s-h on package removal.
> deb-systemd-helper unmask package_two.service >/dev/null || true
> 
> # was-enabled defaults to true, so new installations run enable.
> if deb-systemd-helper --quiet was-enabled editshare-reindexer.service; then
> # Enables the unit on first installation, creates new
> # symlinks on upgrades if the unit file has changed.
> deb-systemd-helper enable package_two.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 editshare-reindexer.service >/dev/null 
> || true
> fi
> # End automatically added section
> # Automatically added by dh_systemd_start
> if [ -d /run/systemd/system ]; then
> systemctl --system daemon-reload >/dev/null || true
> if [ -n "$2" ]; then
> _dh_action=try-restart
> else
> _dh_action=start
> fi
> deb-systemd-invoke $_dh_action package_two.service >/dev/null || true
> fi
> # End automatically added section*
> 

Why is that unwanted (and problematic)?
If package one *does* ship a service you really want those postinst code.
If package one is not supposed to ship a .service file, don't install it 
(via debian/package_one.install).

What are the contents of package_one.deb? Can you past the dpkg -c 
output of the individual packages.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20201105/49835e60/attachment-0001.sig>


More information about the Pkg-systemd-maintainers mailing list