summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-11-05 09:17:01 -0500
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-11-05 14:39:32 -0500
commit515f39e4530ae0f3f279304a77343fbb88e2362f (patch)
tree4e6c9458b9c2ce39516efce6b6d9bb9eb60509a1
parentafef7f063536d1e6519e425f654c986815f38a6a (diff)
downloadmeta-virtualization-515f39e4530ae0f3f279304a77343fbb88e2362f.tar.gz
guest: import cloud-init from meta-openstack
Bringing cloud-init from meta-openstack into meta-virtualization to make it more visible/obvious for use with Xen and k*s images. Not only is this an import, it is a significant update to the package and the way it is built. Out of the box, it installs either systemd or sysvinit startup services, templates and the main script/binary. It is not expected that this will be useful out of the box, but will need to be bbappended and have variables added to the main recipe to make it flexible for more use cases. But we can't gather those use cases, without the package being available, so we integrate this as a starting point. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-extended/cloud-init/cloud-init/0001-setup.py-check-for-install-anywhere-in-args.patch34
-rw-r--r--recipes-extended/cloud-init/cloud-init/cloud-init-source-local-lsb-functions.patch64
-rw-r--r--recipes-extended/cloud-init/cloud-init_20.3.bb55
3 files changed, 153 insertions, 0 deletions
diff --git a/recipes-extended/cloud-init/cloud-init/0001-setup.py-check-for-install-anywhere-in-args.patch b/recipes-extended/cloud-init/cloud-init/0001-setup.py-check-for-install-anywhere-in-args.patch
new file mode 100644
index 00000000..f61b82ce
--- /dev/null
+++ b/recipes-extended/cloud-init/cloud-init/0001-setup.py-check-for-install-anywhere-in-args.patch
@@ -0,0 +1,34 @@
1From 5c96379a4727c07fb5222208525013ec8b878184 Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Wed, 4 Nov 2020 21:15:50 -0500
4Subject: [PATCH] setup.py: check for 'install' anywhere in args
5
6The python3distutils bbclass calls setup.py in a different way then
7cloud-init expects .. the 'install' is not argument 1, but is in fact
8after a 'build' and some other options.
9
10So rather than checking for install to be argv[1], we check for it
11anywhere in the arguments are trigger the template replacement to
12happen.
13
14Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
15---
16 setup.py | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19diff --git a/setup.py b/setup.py
20index cbacf48e..5f13d9eb 100755
21--- a/setup.py
22+++ b/setup.py
23@@ -87,7 +87,7 @@ def render_tmpl(template, mode=None):
24
25 # older versions of tox use bdist (xenial), and then install from there.
26 # newer versions just use install.
27- if not (sys.argv[1] == 'install' or sys.argv[1].startswith('bdist*')):
28+ if not ('install' in sys.argv or sys.argv[1].startswith('bdist*')):
29 return template
30
31 tmpl_ext = ".tmpl"
32--
332.25.1
34
diff --git a/recipes-extended/cloud-init/cloud-init/cloud-init-source-local-lsb-functions.patch b/recipes-extended/cloud-init/cloud-init/cloud-init-source-local-lsb-functions.patch
new file mode 100644
index 00000000..869fb311
--- /dev/null
+++ b/recipes-extended/cloud-init/cloud-init/cloud-init-source-local-lsb-functions.patch
@@ -0,0 +1,64 @@
1From 72dd3b4b38705442d821fe97a40061f23e748769 Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@windriver.com>
3Date: Thu, 6 Mar 2014 01:55:09 -0500
4Subject: [PATCH] cloud-init: source local lsb functions
5
6Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
7---
8 sysvinit/debian/cloud-config | 1 +
9 sysvinit/debian/cloud-final | 1 +
10 sysvinit/debian/cloud-init | 1 +
11 sysvinit/debian/cloud-init-local | 1 +
12 4 files changed, 4 insertions(+)
13
14diff --git a/sysvinit/debian/cloud-config b/sysvinit/debian/cloud-config
15index 53322748ac65..7874dcfab9b0 100644
16--- a/sysvinit/debian/cloud-config
17+++ b/sysvinit/debian/cloud-config
18@@ -30,6 +30,7 @@ SCRIPTNAME=/etc/init.d/$NAME
19 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
20 # and status_of_proc is working.
21 . /lib/lsb/init-functions
22+. /etc/init.d/functions
23
24 if init_is_upstart; then
25 case "$1" in
26diff --git a/sysvinit/debian/cloud-final b/sysvinit/debian/cloud-final
27index 55afc8b0678a..661314f0b64c 100644
28--- a/sysvinit/debian/cloud-final
29+++ b/sysvinit/debian/cloud-final
30@@ -32,6 +32,7 @@ SCRIPTNAME=/etc/init.d/$NAME
31 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
32 # and status_of_proc is working.
33 . /lib/lsb/init-functions
34+. /etc/init.d/functions
35
36 if init_is_upstart; then
37 case "$1" in
38diff --git a/sysvinit/debian/cloud-init b/sysvinit/debian/cloud-init
39index 48fa04233f00..d3ccec99bacc 100755
40--- a/sysvinit/debian/cloud-init
41+++ b/sysvinit/debian/cloud-init
42@@ -30,6 +30,7 @@ SCRIPTNAME=/etc/init.d/$NAME
43 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
44 # and status_of_proc is working.
45 . /lib/lsb/init-functions
46+. /etc/init.d/functions
47
48 if init_is_upstart; then
49 case "$1" in
50diff --git a/sysvinit/debian/cloud-init-local b/sysvinit/debian/cloud-init-local
51index 802ee8e9f386..c309e8347324 100644
52--- a/sysvinit/debian/cloud-init-local
53+++ b/sysvinit/debian/cloud-init-local
54@@ -29,6 +29,7 @@ SCRIPTNAME=/etc/init.d/$NAME
55 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
56 # and status_of_proc is working.
57 . /lib/lsb/init-functions
58+. /etc/init.d/functions
59
60 if init_is_upstart; then
61 case "$1" in
62--
631.7.10.4
64
diff --git a/recipes-extended/cloud-init/cloud-init_20.3.bb b/recipes-extended/cloud-init/cloud-init_20.3.bb
new file mode 100644
index 00000000..31b4066f
--- /dev/null
+++ b/recipes-extended/cloud-init/cloud-init_20.3.bb
@@ -0,0 +1,55 @@
1DESCRIPTION = "Init scripts for use on cloud images"
2HOMEPAGE = "https://github.com/canonical/cloud-init"
3SECTION = "devel/python"
4LICENSE = "GPLv3"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=c6dd79b6ec2130a3364f6fa9d6380408"
6
7SRCREV = "1431c8a1bddaabf85e1bbb32bf316a3aef20036e"
8SRC_URI = "git://github.com/canonical/cloud-init \
9 file://cloud-init-source-local-lsb-functions.patch \
10 file://0001-setup.py-check-for-install-anywhere-in-args.patch \
11 "
12
13S = "${WORKDIR}/git"
14
15DISTUTILS_INSTALL_ARGS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--init-system=sysvinit_deb', '', d)}"
16DISTUTILS_INSTALL_ARGS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--init-system=systemd', '', d)}"
17
18do_install_append() {
19 ln -s ${libdir}/${BPN}/uncloud-init ${D}${sysconfdir}/cloud/uncloud-init
20 ln -s ${libdir}/${BPN}/write-ssh-key-fingerprints ${D}${sysconfdir}/cloud/write-ssh-key-fingerprints
21}
22
23inherit pkgconfig
24inherit setuptools3
25inherit update-rc.d
26inherit systemd
27
28inherit python3native
29
30PACKAGES += "${PN}-systemd"
31
32FILES_${PN} += "${sysconfdir}/* \
33 ${datadir}/*"
34
35FILES_${PN}-systemd += "${systemd_unitdir}/*"
36RDEPENDS_${PN}-systemd += " ${PN}"
37
38INITSCRIPT_PACKAGES = "${PN}"
39INITSCRIPT_NAME_${BPN} = "cloud-init"
40
41DEPENDS += "python3-pyyaml-native \
42 python3-requests-native \
43 python3-jinja2-native \
44 "
45
46RDEPENDS_${PN} = "python3 \
47 python3-jinja2 \
48 python3-configobj \
49 python3-requests \
50 python3-jsonpatch \
51 python3-jsonschema \
52 python3-pyyaml \
53 python3-oauthlib \
54 "
55