Skip to contentSkip to conversation

cloud-init: add dependency on systemd to fix installed-vs-shipped QA issue

PATCH In review Martin Jansa 2 participants 3 messages Nov 7, 2020 – Nov 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cloud-init: add dependency on systemd to fix installed-vs-shipped QA issue

* without systemd in RSS, setup.py will fail to call:
"pkg-config systemd --variable=systemdsystemunitdir"
and then clound-init might fail with:
ERROR: cloud-init-20.3-r0 do_package: QA Issue: cloud-init: Files/directories were installed but not shipped in any package:
/lib/systemd
/lib/systemd/system-generators
/lib/systemd/system
/lib/systemd/system-generators/cloud-init-generator
/lib/systemd/system/cloud-final.service
/lib/systemd/system/cloud-init.service
/lib/systemd/system/cloud-config.target
/lib/systemd/system/cloud-init.target
/lib/systemd/system/cloud-init-local.service
/lib/systemd/system/cloud-config.service
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
cloud-init: 10 installed and not shipped files. [installed-vs-shipped]

when systemd on host or in the systemd fallback uses different systemdsystemunitdir value than what OE packages with:
FILES_${PN}-systemd += "${systemd_unitdir}/*"

  setup.py fallback:
  def pkg_config_read(library, var):
    fallbacks = {
        'systemd': {
            'systemdsystemunitdir': '/lib/systemd/system',
            'systemdsystemgeneratordir': '/lib/systemd/system-generators',
        }
    }
    ..

  ubuntu:
  meta-virtualization$ pkg-config systemd --variable=systemdsystemunitdir
  /lib/systemd/system

OE (with usrmerge in DISTRO_FEATURES):
cloud-init/20.3-r0$ pkg-config systemd --variable=systemdsystemunitdir /usr/lib/systemd/system

---
 recipes-extended/cloud-init/cloud-init_20.3.bb | 3 +++
 1 file changed, 3 insertions(+)
recipes-extended/cloud-init/cloud-init_20.3.bb +3 -0
index 31b4066..53d71a6 100644
@@ -25,6 +25,9 @@ inherit setuptools3
 inherit update-rc.d
 inherit systemd
 
+# setup.py calls "pkg-config systemd --variable=systemdsystemunitdir" and needs to find our systemd
+DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
+
 inherit python3native
 
 PACKAGES += "${PN}-systemd"
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 cloud-init: fix usrmerge QA error:

* respect udevdir variable
* with usrmerge cloud-init triggers QA error:
ERROR: cloud-init-20.3-r0 do_package_qa: QA Issue: cloud-init package is not obeying usrmerge distro feature. /lib should be relocated to /usr. [usrmerge]
ERROR: cloud-init-20.3-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
because of:
/lib/udev/rules.d/66-azure-ephemeral.rules

---
 ...01-setup.py-respect-udevdir-variable.patch | 42 +++++++++++++++++++
 .../cloud-init/cloud-init_20.3.bb             |  7 ++--
 2 files changed, 46 insertions(+), 3 deletions(-)
 create mode 100644 recipes-extended/cloud-init/cloud-init/0001-setup.py-respect-udevdir-variable.patch
recipes-extended/cloud-init/cloud-init/0001-setup.py-respect-udevdir-variable.patch new file +42 -0
new file mode 100644
index 0000000..94ec98a
@@ -0,0 +1,42 @@
+From d7a6b8f765e9a08a8811331298e76ebd7a0c7076 Mon Sep 17 00:00:00 2001
+From: Martin Jansa <[email protected]>
+Date: Sat, 7 Nov 2020 15:55:23 +0000
+Subject: [PATCH] setup.py respect udevdir variable
+
+* with usrmerge cloud-init triggers QA error:
+  ERROR: cloud-init-20.3-r0 do_package_qa: QA Issue: cloud-init package is not obeying usrmerge distro feature. /lib should be relocated to /usr. [usrmerge]
+  ERROR: cloud-init-20.3-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
+  because of:
+  /lib/udev/rules.d/66-azure-ephemeral.rules
+
+Upstream-Status: Pending
+
+Signed-off-by: Martin Jansa <[email protected]>
+---
+ setup.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index cbacf48e..5e137a6d 100755
+--- a/setup.py
++++ b/setup.py
+@@ -142,6 +142,7 @@ INITSYS_ROOTS = {
+     'sysvinit_deb': 'etc/init.d',
+     'sysvinit_openrc': 'etc/init.d',
+     'sysvinit_suse': 'etc/init.d',
++    'udevdir': pkg_config_read('udev', 'udevdir'),
+     'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'),
+     'systemd.generators': pkg_config_read('systemd',
+                                           'systemdsystemgeneratordir'),
+@@ -264,7 +265,7 @@ if not platform.system().endswith('BSD'):
+         (ETC + '/NetworkManager/dispatcher.d/',
+          ['tools/hook-network-manager']),
+         (ETC + '/dhcp/dhclient-exit-hooks.d/', ['tools/hook-dhclient']),
+-        (LIB + '/udev/rules.d', [f for f in glob('udev/*.rules')])
++        ('udevdir' + '/rules.d', [f for f in glob('udev/*.rules')])
+     ])
+ # Use a subclass for install that handles
+ # adding on the right init system configuration files
+-- 
+2.27.0
+
recipes-extended/cloud-init/cloud-init_20.3.bb +4 -3
index 53d71a6..b9efb31 100644
@@ -6,9 +6,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c6dd79b6ec2130a3364f6fa9d6380408"
 
 SRCREV = "1431c8a1bddaabf85e1bbb32bf316a3aef20036e"
 SRC_URI = "git://github.com/canonical/cloud-init \
-           file://cloud-init-source-local-lsb-functions.patch \
-           file://0001-setup.py-check-for-install-anywhere-in-args.patch \
-          "
+    file://cloud-init-source-local-lsb-functions.patch \
+    file://0001-setup.py-check-for-install-anywhere-in-args.patch \
+    file://0001-setup.py-respect-udevdir-variable.patch \
+"
 
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.27.0
#2 lore raw

Thanks for the fixups .. most appreciated.

These are now merged.

Bruce

In message: [meta-virtualization][PATCH 1/2] cloud-init: add dependency on systemd to fix installed-vs-shipped QA issue

Quoted 65 lines · on 07/11/2020 Martin Jansa wrote:

* without systemd in RSS, setup.py will fail to call:
"pkg-config systemd --variable=systemdsystemunitdir"
and then clound-init might fail with:
ERROR: cloud-init-20.3-r0 do_package: QA Issue: cloud-init: Files/directories were installed but not shipped in any package:
/lib/systemd
/lib/systemd/system-generators
/lib/systemd/system
/lib/systemd/system-generators/cloud-init-generator
/lib/systemd/system/cloud-final.service
/lib/systemd/system/cloud-init.service
/lib/systemd/system/cloud-config.target
/lib/systemd/system/cloud-init.target
/lib/systemd/system/cloud-init-local.service
/lib/systemd/system/cloud-config.service
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
cloud-init: 10 installed and not shipped files. [installed-vs-shipped]

when systemd on host or in the systemd fallback uses different systemdsystemunitdir value than what OE packages with:
FILES_${PN}-systemd += "${systemd_unitdir}/*"

  setup.py fallback:
  def pkg_config_read(library, var):
    fallbacks = {
        'systemd': {
            'systemdsystemunitdir': '/lib/systemd/system',
            'systemdsystemgeneratordir': '/lib/systemd/system-generators',
        }
    }
    ..

  ubuntu:
  meta-virtualization$ pkg-config systemd --variable=systemdsystemunitdir
  /lib/systemd/system

OE (with usrmerge in DISTRO_FEATURES):
cloud-init/20.3-r0$ pkg-config systemd --variable=systemdsystemunitdir /usr/lib/systemd/system

---
 recipes-extended/cloud-init/cloud-init_20.3.bb | 3 +++
 1 file changed, 3 insertions(+)
recipes-extended/cloud-init/cloud-init_20.3.bb +3 -0
index 31b4066..53d71a6 100644
@@ -25,6 +25,9 @@ inherit setuptools3
 inherit update-rc.d
 inherit systemd
 
+# setup.py calls "pkg-config systemd --variable=systemdsystemunitdir" and needs to find our systemd
+DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
+
 inherit python3native
 
 PACKAGES += "${PN}-systemd"
Signature · 1 line
2.27.0