diff -Nru ceph-10.2.5/debian/changelog ceph-10.2.5/debian/changelog --- ceph-10.2.5/debian/changelog 2017-01-11 12:02:24.000000000 +0100 +++ ceph-10.2.5/debian/changelog 2017-05-12 12:12:00.000000000 +0200 @@ -1,3 +1,12 @@ +ceph (10.2.5-7) unstable; urgency=medium + + * [a12798] Add fix-init-system-detection.patch. + This replaces the static init system detection by more appropriate + runtime detection which also works if a Debian system is running with + sysvinit. (Closes: #862075) + + -- Gaudenz Steinlin Fri, 12 May 2017 12:12:00 +0200 + ceph (10.2.5-6) unstable; urgency=medium * [e44a30] Disable running dh_auto_install with parallel jobs diff -Nru ceph-10.2.5/debian/patches/fix-init-system-detection.patch ceph-10.2.5/debian/patches/fix-init-system-detection.patch --- ceph-10.2.5/debian/patches/fix-init-system-detection.patch 1970-01-01 01:00:00.000000000 +0100 +++ ceph-10.2.5/debian/patches/fix-init-system-detection.patch 2017-05-12 12:11:13.000000000 +0200 @@ -0,0 +1,144 @@ +Last-Update: 2017-05-11 +Bug-Ceph: http://tracker.ceph.com/issues/19884 +Author: Kefu Chai and Gaudenz Steinlin +Description: Replace static init system detection by runtime detection. Modified + version of the patch proposed by Kefu Chai upstream. + +--- a/src/ceph-detect-init/ceph_detect_init/debian/__init__.py ++++ b/src/ceph-detect-init/ceph_detect_init/debian/__init__.py +@@ -1,3 +1,6 @@ ++import os ++import subprocess ++ + distro = None + release = None + codename = None +@@ -8,14 +11,11 @@ + + Returns the name of a init system (upstart, sysvinit ...). + """ +- assert(distro and codename) +- if distro.lower() in ('ubuntu', 'linuxmint'): +- if codename >= 'vivid': +- return 'systemd' +- else: +- return 'upstart' +- if distro.lower() == 'debian': +- if codename in ('squeeze', 'wheezy'): +- return 'sysvinit' +- else: +- return 'systemd' ++ # yes, this is heuristics ++ if os.path.isdir('/run/systemd/system'): ++ return 'systemd' ++ if not subprocess.call('. /lib/lsb/init-functions ; init_is_upstart', ++ shell=True): ++ return 'upstart' ++ elif os.path.isfile('/sbin/init') and not os.path.islink('/sbin/init'): ++ return 'sysvinit' +--- a/src/ceph-detect-init/tests/test_all.py ++++ b/src/ceph-detect-init/tests/test_all.py +@@ -44,30 +44,35 @@ + self.assertEqual('sysvinit', centos.choose_init()) + + def test_debian(self): +- with mock.patch.multiple('ceph_detect_init.debian', +- distro='debian', +- codename='wheezy'): +- self.assertEqual('sysvinit', debian.choose_init()) +- with mock.patch.multiple('ceph_detect_init.debian', +- distro='debian', +- codename='squeeze'): +- self.assertEqual('sysvinit', debian.choose_init()) +- with mock.patch.multiple('ceph_detect_init.debian', +- distro='debian', +- codename='jessie'): ++ with mock.patch.multiple('os.path', ++ isdir=lambda x: x == '/run/systemd/system'): + self.assertEqual('systemd', debian.choose_init()) +- with mock.patch.multiple('ceph_detect_init.debian', +- distro='ubuntu', +- codename='trusty'): +- self.assertEqual('upstart', debian.choose_init()) +- with mock.patch.multiple('ceph_detect_init.debian', +- distro='ubuntu', +- codename='vivid'): +- self.assertEqual('systemd', debian.choose_init()) +- with mock.patch.multiple('ceph_detect_init.debian', +- distro='not-debian', +- codename='andy'): +- self.assertIs(None, debian.choose_init()) ++ ++ def mock_call_with_upstart(*args, **kwargs): ++ if args[0] == '. /lib/lsb/init-functions ; init_is_upstart' and \ ++ kwargs['shell']: ++ return 0 ++ else: ++ return 1 ++ with mock.patch.multiple('os.path', ++ isdir=lambda x: False, ++ isfile=lambda x: False): ++ with mock.patch.multiple('subprocess', ++ call=mock_call_with_upstart): ++ self.assertEqual('upstart', debian.choose_init()) ++ with mock.patch.multiple('os.path', ++ isdir=lambda x: False, ++ isfile=lambda x: x == '/sbin/init', ++ islink=lambda x: x != '/sbin/init'): ++ with mock.patch.multiple('subprocess', ++ call=lambda *args, **kwargs: 1): ++ self.assertEqual('sysvinit', debian.choose_init()) ++ with mock.patch.multiple('os.path', ++ isdir=lambda x: False, ++ isfile=lambda x: False): ++ with mock.patch.multiple('subprocess', ++ call=lambda *args, **kwargs: 1): ++ self.assertIs(None, debian.choose_init()) + + def test_fedora(self): + with mock.patch('ceph_detect_init.fedora.release', +@@ -115,7 +120,6 @@ + self.assertEqual(False, distro.is_el) + self.assertEqual('6.0', distro.release) + self.assertEqual('squeeze', distro.codename) +- self.assertEqual('sysvinit', distro.init) + + def test_get_distro(self): + g = ceph_detect_init._get_distro +--- a/src/ceph-detect-init/ceph_detect_init/__init__.py ++++ b/src/ceph-detect-init/ceph_detect_init/__init__.py +@@ -25,7 +25,7 @@ + + def get(use_rhceph=False): + distro_name, release, codename = platform_information() +- if not codename or not _get_distro(distro_name): ++ if not _get_distro(distro_name): + raise exc.UnsupportedPlatform( + distro=distro_name, + codename=codename, +@@ -83,25 +83,6 @@ + logging.debug('platform_information: linux_distribution = ' + + str(platform.linux_distribution())) + distro, release, codename = platform.linux_distribution() +- # this could be an empty string in Debian +- if not codename and 'debian' in distro.lower(): +- debian_codenames = { +- '8': 'jessie', +- '7': 'wheezy', +- '6': 'squeeze', +- } +- major_version = release.split('.')[0] +- codename = debian_codenames.get(major_version, '') +- +- # In order to support newer jessie/sid or wheezy/sid strings +- # we test this if sid is buried in the minor, we should use +- # sid anyway. +- if not codename and '/' in release: +- major, minor = release.split('/') +- if minor == 'sid': +- codename = minor +- else: +- codename = major + + return ( + str(distro).rstrip(), diff -Nru ceph-10.2.5/debian/patches/series ceph-10.2.5/debian/patches/series --- ceph-10.2.5/debian/patches/series 2017-01-08 21:34:12.000000000 +0100 +++ ceph-10.2.5/debian/patches/series 2017-05-12 12:09:22.000000000 +0200 @@ -16,6 +16,7 @@ # Use correct compiler flags on armel softfp-armel.patch mips_mipsel_libatomic.patch +fix-init-system-detection.patch ## From Ubuntu fix-cycles-arch.patch diff -Nru ceph-10.2.5/debian/rules ceph-10.2.5/debian/rules --- ceph-10.2.5/debian/rules 2017-01-11 11:46:10.000000000 +0100 +++ ceph-10.2.5/debian/rules 2017-05-11 23:00:46.000000000 +0200 @@ -62,7 +62,8 @@ # Build fix for mips/mipsel # The first two variables work around a compiler bug which leads to virtual -# memory exhaustion while compiling the testsuite. See Debian bug #849657. +# memory exhaustion while compiling the testsuite. See Debian bug #849657 and +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79030 ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel)) export DEB_CFLAGS_MAINT_APPEND= --param ggc-min-expand=5 export DEB_CXXFLAGS_MAINT_APPEND= --param ggc-min-expand=5