Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Please unblock package whatmaps Most importantly this fixes service restarts with current systemd in jessie. It also removes a spurious (but harmless) error message from the postinst and makes it usuable for derivatives (#761054). It also changes two logging statements to be consistent on the logging level to improve the output when run with unattended-upgrades. There are no other upstream changes besides the above and the integration of our two patches that we shipped before. Cheers, -- Guido unblock whatmaps/0.0.9-1 -- System Information: Debian Release: 8.0 APT prefers testing APT policy: (990, 'testing'), (500, 'testing-updates'), (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-rc6 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
diff --git a/debian/changelog b/debian/changelog index 9238046..94fec4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,17 @@ +whatmaps (0.0.9-1) unstable; urgency=medium + + * New upstream version: + * Install apt.conf configuration on derivatives too (Closes: #761054) + * Fix service detection with newer systemd (as in Debian Jessie) + * Make logging consistent + * [36fd4ee] Avoid error message on missing file. + Don't try to get the md5sum of a nonexistent file to avoid + md5sum: /etc/apt/apt.conf.d/20servicese: No such file or directory + which is confusing. + * Drop all patches merged upstream + + -- Guido Günther <a...@sigxcpu.org> Sun, 28 Dec 2014 15:04:26 +0100 + whatmaps (0.0.8-5) unstable; urgency=medium * [617fed4] Add sv Debconf translation. Thanks to Martin Bagge (Closes: diff --git a/debian/patches/0001-Another-import-bugfix.patch b/debian/patches/0001-Another-import-bugfix.patch deleted file mode 100644 index 9cbb73e..0000000 --- a/debian/patches/0001-Another-import-bugfix.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: =?utf-8?q?Guido_G=C3=BCnther?= <a...@sigxcpu.org> -Date: Fri, 11 Jul 2014 20:53:31 +0200 -Subject: Another import bugfix - ---- - whatmaps/debiandistro.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py -index 9294c9f..3a3bf16 100644 ---- a/whatmaps/debiandistro.py -+++ b/whatmaps/debiandistro.py -@@ -31,12 +31,12 @@ import subprocess - import sys - import string - --import whatmaps.distro -+from . distro import Distro - from . debianpkg import DebianPkg - from . pkg import PkgError - from . systemd import Systemd - --class DebianDistro(whatmaps.distro.Distro): -+class DebianDistro(Distro): - "Debian (dpkg) based distribution" - id = 'Debian' - diff --git a/debian/patches/0002-Abort-early-if-we-found-a-match.patch b/debian/patches/0002-Abort-early-if-we-found-a-match.patch deleted file mode 100644 index 3513ad6..0000000 --- a/debian/patches/0002-Abort-early-if-we-found-a-match.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: =?utf-8?q?Guido_G=C3=BCnther?= <a...@sigxcpu.org> -Date: Mon, 14 Jul 2014 16:12:43 +0200 -Subject: Abort early if we found a match - -Once we found a shared object that a process maps we don't need to -continue with the other shared objects since one is enough to require -a process restart. ---- - whatmaps/command.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/whatmaps/command.py b/whatmaps/command.py -index 7690ef8..e649cbb 100755 ---- a/whatmaps/command.py -+++ b/whatmaps/command.py -@@ -39,7 +39,7 @@ def check_maps(procs, shared_objects): - restart_procs[proc.exe] += [ proc ] - else: - restart_procs[proc.exe] = [ proc ] -- continue -+ break - return restart_procs - - diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 219effd..0000000 --- a/debian/patches/series +++ /dev/null @@ -1,2 +0,0 @@ -0001-Another-import-bugfix.patch -0002-Abort-early-if-we-found-a-match.patch diff --git a/debian/preinst b/debian/preinst index 1d54ef0..1ea0c9f 100644 --- a/debian/preinst +++ b/debian/preinst @@ -17,12 +17,14 @@ set -e case "$1" in install|upgrade) if dpkg --compare-versions "$2" lt-nl "0.0.8-3~"; then - # Remove backup copies of services file - md5=$(md5sum /etc/apt/apt.conf.d/20servicese | sed -e 's/ .*//') - case "$md5" in - 074e684668c83b8a98c5eeb8257c88f2|509ad2c35aa4da3153dd6e70941e060b) - rm -f /etc/apt/apt.conf.d/20servicese - esac + if [ -f /etc/apt/apt.conf.d/20servicese ]; then + # Remove errnoneous backup copies of services file + md5=$(md5sum /etc/apt/apt.conf.d/20servicese | sed -e 's/ .*//') + case "$md5" in + 074e684668c83b8a98c5eeb8257c88f2|509ad2c35aa4da3153dd6e70941e060b) + rm -f /etc/apt/apt.conf.d/20servicese + esac + fi fi ;; diff --git a/setup.py b/setup.py index 7e7ed00..cdadd50 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,8 @@ data_files = [] try: import lsb_release - if lsb_release.get_distro_information()['ID'] in [ 'Debian' ]: + if (lsb_release.get_distro_information()['ID'] in [ 'Debian' ] or + os.path.exists('/etc/debian_version')): data_files = [('../etc/apt/apt.conf.d/', ['apt/50whatmaps_apt']), ('../etc/apt/apt.conf.d/', diff --git a/whatmaps/command.py b/whatmaps/command.py index 7690ef8..d0f5c3e 100755 --- a/whatmaps/command.py +++ b/whatmaps/command.py @@ -39,7 +39,7 @@ def check_maps(procs, shared_objects): restart_procs[proc.exe] += [ proc ] else: restart_procs[proc.exe] = [ proc ] - continue + break return restart_procs @@ -59,7 +59,7 @@ def write_cmd_file(services, cmd_file, distro): out = open(cmd_file, 'w') print('#! /bin/sh', file=out) for service in services: - logging.debug("Need to restart %s", service) + logging.info("Need to restart '%s'", service) print(" ".join(distro.restart_service_cmd(service)), file=out) out.close() os.chmod(cmd_file, 0o755) @@ -113,7 +113,12 @@ def find_systemd_units(procmap, distro): for dummy, procs in procmap.items(): for proc in procs: - unit = Systemd.process_to_unit(proc) + try: + unit = Systemd.process_to_unit(proc) + except ValueError as e: + logging.warning("No systemd unit found for '%s': %s" + "- restart manually" % (proc.exe, e)) + continue if not unit: logging.warning("No systemd unit found for '%s'" "- restart manually" % proc.exe) @@ -225,7 +230,7 @@ def main(argv): write_cmd_file(services, options.print_cmds, distro) else: for service in services: - logging.info("Restarting %s" % service) + logging.info("Restarting '%s'" % service) distro.restart_service(service) elif services: print("Services that possibly need to be restarted:") diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py index 9294c9f..3a3bf16 100644 --- a/whatmaps/debiandistro.py +++ b/whatmaps/debiandistro.py @@ -31,12 +31,12 @@ import subprocess import sys import string -import whatmaps.distro +from . distro import Distro from . debianpkg import DebianPkg from . pkg import PkgError from . systemd import Systemd -class DebianDistro(whatmaps.distro.Distro): +class DebianDistro(Distro): "Debian (dpkg) based distribution" id = 'Debian' diff --git a/whatmaps/process.py b/whatmaps/process.py index 1abde23..23ed7ab 100644 --- a/whatmaps/process.py +++ b/whatmaps/process.py @@ -36,7 +36,7 @@ class Process(object): if m: self.exe = m.group('exe') self.deleted = True - logging.info("Using deleted exe %s", self.exe) + logging.debug("Using deleted exe %s", self.exe) if not os.path.exists(self.exe): logging.debug("%s doesn't exist", self.exe) self.cmdline = open(self._procpath('%d/cmdline' % self.pid)).read() diff --git a/whatmaps/systemd.py b/whatmaps/systemd.py index add6d0e..3407128 100644 --- a/whatmaps/systemd.py +++ b/whatmaps/systemd.py @@ -38,4 +38,10 @@ class Systemd(object): if systemctl_status.returncode: return None else: - return output.split()[0] + parts = output.split() + if parts[0].endswith('.service'): + return parts[0] + elif parts[1].endswith('.service'): + return parts[1] + else: + raise ValueError("Can't parse service name from\n%s" % output)