Gentoo Archives: gentoo-commits

From: Gilles Dartiguelongue <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/cloud-init/files/, app-emulation/cloud-init/
Date: Wed, 24 Oct 2018 13:19:26
Message-Id: 1540387145.aa3309442f544a16e542cfaae4e9d130b541e2cd.eva@gentoo
1 commit: aa3309442f544a16e542cfaae4e9d130b541e2cd
2 Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 24 13:14:01 2018 +0000
4 Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 24 13:19:05 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa330944
7
8 app-emulation/cloud-init: version bump 17.2 → 18.4
9
10 Fix running unittests. Remove unused inherits. Rely on build system for
11 cloud.cfg, templates and documentation installation. Add patches for
12 Gentoo specifics.
13
14 Package-Manager: Portage-2.3.51, Repoman-2.3.11
15 RepoMan-Options: --force
16 Signed-off-by: Gilles Dartiguelongue <eva <AT> gentoo.org>
17
18 app-emulation/cloud-init/Manifest | 1 +
19 app-emulation/cloud-init/cloud-init-18.4.ebuild | 84 ++++++++++++++++++++
20 .../cloud-init-18.4-fix-packages-module.patch | 25 ++++++
21 ...it-18.4-gentoo-support-upstream-templates.patch | 91 ++++++++++++++++++++++
22 4 files changed, 201 insertions(+)
23
24 diff --git a/app-emulation/cloud-init/Manifest b/app-emulation/cloud-init/Manifest
25 index 62e79395b58..1ed457e3bf6 100644
26 --- a/app-emulation/cloud-init/Manifest
27 +++ b/app-emulation/cloud-init/Manifest
28 @@ -5,3 +5,4 @@ DIST cloud-init-0.7.8.tar.gz 508777 BLAKE2B 7b5b3f1b5f28b6a4ba67ef30cbbb32e1a1eb
29 DIST cloud-init-0.7.9.tar.gz 602188 BLAKE2B c2e2b8538488474cd4674b976f859164f0ab8ed585fc0b59c6e75f23a62fd035b8b76e0700c1e68893fc4a8346b3110ff2b25f13be92ff13eeac0f1ad2405641 SHA512 ee52909f634f51dcf9e1229a8f49faa8c562bf05b69fac108fcc80cb3217f4364a33cf696df015e4dcd7887c68cf6108729850648b4daee07b3d3247ca3cc5b1
30 DIST cloud-init-17.1.tar.gz 780532 BLAKE2B 10809da2e81d594542d83b2416481c493474cac2e790da25363e631f6dae9edc1e2fd160708121486dd3a2ebd19cfc29d18978cbe7d82eb1aec907762bf7bf0b SHA512 988cae4291c8d6a5bce012b78d651c602c02ad38c3790e9ed9aa7c815ae84c98767718ab9b0d346ddbc9c83cb886d455590128af750183618c0bf0f0c5a79564
31 DIST cloud-init-17.2.tar.gz 810821 BLAKE2B df1a7c1ed1fc48a7801a53bd89839d963debca6abf7f892d61bf7ec9222ab33bf78221e65d79028e0445cac4c5fe1e0c1620d49aea26c036ee17933d9c1893f5 SHA512 ad1c7f6ca9762b70a1f06a6b538032a7de0c5371fd792260d5959df113f4f51509d184b2207ffa23b41f395c1903d551d66aaf2a2ad60af3594cf1f18d1e4a38
32 +DIST cloud-init-18.4.tar.gz 965112 BLAKE2B 2879aafedea877e4e406a5e837d100ba65e40c62660621f606e7a189af7b1ec8d98ba2c02ae5d253a0b4587502d3a636dec5c2772c968a9037b47e62a05656b4 SHA512 730aca6406f652f55afc2dd50c49eb6708584e0a96715606bcba05cb7f40e47c256faff1f9748f04674a8f941ec9435801c9ed2ac79adec8a6ef167d6b195103
33
34 diff --git a/app-emulation/cloud-init/cloud-init-18.4.ebuild b/app-emulation/cloud-init/cloud-init-18.4.ebuild
35 new file mode 100644
36 index 00000000000..331c102da1a
37 --- /dev/null
38 +++ b/app-emulation/cloud-init/cloud-init-18.4.ebuild
39 @@ -0,0 +1,84 @@
40 +# Copyright 1999-2018 Gentoo Authors
41 +# Distributed under the terms of the GNU General Public License v2
42 +
43 +EAPI=6
44 +PYTHON_COMPAT=( python2_7 python3_4 python3_5 python3_6 )
45 +
46 +inherit distutils-r1
47 +
48 +DESCRIPTION="Cloud instance initialisation magic"
49 +HOMEPAGE="https://launchpad.net/cloud-init"
50 +SRC_URI="https://launchpad.net/${PN}/trunk/${PV}/+download/${P}.tar.gz"
51 +
52 +LICENSE="GPL-3"
53 +SLOT="0"
54 +KEYWORDS="~amd64 ~x86"
55 +IUSE="test"
56 +
57 +# remove prettytable in 17.2
58 +CDEPEND="
59 + dev-python/jinja[${PYTHON_USEDEP}]
60 + dev-python/oauthlib[${PYTHON_USEDEP}]
61 + dev-python/pyserial[${PYTHON_USEDEP}]
62 + >=dev-python/configobj-5.0.2[${PYTHON_USEDEP}]
63 + dev-python/pyyaml[${PYTHON_USEDEP}]
64 + dev-python/requests[${PYTHON_USEDEP}]
65 + dev-python/jsonpatch[${PYTHON_USEDEP}]
66 + dev-python/jsonschema[${PYTHON_USEDEP}]
67 + dev-python/six[${PYTHON_USEDEP}]
68 +"
69 +DEPEND="
70 + dev-python/setuptools[${PYTHON_USEDEP}]
71 + test? (
72 + ${CDEPEND}
73 + >=dev-python/httpretty-0.7.1[${PYTHON_USEDEP}]
74 + dev-python/mock[${PYTHON_USEDEP}]
75 + dev-python/nose[${PYTHON_USEDEP}]
76 + dev-python/unittest2[${PYTHON_USEDEP}]
77 + dev-python/coverage[${PYTHON_USEDEP}]
78 + dev-python/contextlib2[${PYTHON_USEDEP}]
79 + )
80 +"
81 +RDEPEND="
82 + ${CDEPEND}
83 + net-analyzer/macchanger
84 + sys-apps/iproute2
85 + sys-fs/growpart
86 + virtual/logger
87 +"
88 +
89 +PATCHES=(
90 + "${FILESDIR}"/${P}-fix-packages-module.patch
91 + "${FILESDIR}"/${P}-gentoo-support-upstream-templates.patch
92 +)
93 +
94 +src_prepare() {
95 + # Fix location of documentation installation
96 + sed -i "s:USR + '/share/doc/cloud-init:USR + '/share/doc/${PF}:" setup.py || die
97 + distutils-r1_src_prepare
98 +}
99 +
100 +python_test() {
101 + # Do not use Makefile target as it does not setup environment correclty
102 + esetup.py nosetests -v --where cloudinit --where tests/unittests || die
103 +}
104 +
105 +python_install() {
106 + distutils-r1_python_install --init-system=sysvinit_openrc,systemd --distro gentoo
107 +}
108 +
109 +python_install_all() {
110 + keepdir /etc/cloud
111 +
112 + distutils-r1_python_install_all
113 +
114 + # installs as non-executable
115 + chmod +x "${D}"/etc/init.d/*
116 +}
117 +
118 +pkg_postinst() {
119 + elog "cloud-init-local needs to be run in the boot runlevel because it"
120 + elog "modifies services in the default runlevel. When a runlevel is started"
121 + elog "it is cached, so modifications that happen to the current runlevel"
122 + elog "while you are in it are not acted upon."
123 +}
124
125 diff --git a/app-emulation/cloud-init/files/cloud-init-18.4-fix-packages-module.patch b/app-emulation/cloud-init/files/cloud-init-18.4-fix-packages-module.patch
126 new file mode 100644
127 index 00000000000..4a42cbb7d9e
128 --- /dev/null
129 +++ b/app-emulation/cloud-init/files/cloud-init-18.4-fix-packages-module.patch
130 @@ -0,0 +1,25 @@
131 +From e894c6f57b88305cdf6e4e2b1543475b2e02f436 Mon Sep 17 00:00:00 2001
132 +From: Gilles Dartiguelongue <eva@g.o>
133 +Date: Tue, 23 Oct 2018 18:59:58 +0200
134 +Subject: [PATCH 1/2] Fix Gentoo package installation command
135 +
136 +---
137 + cloudinit/distros/gentoo.py | 2 +-
138 + 1 file changed, 1 insertion(+), 1 deletion(-)
139 +
140 +diff --git a/cloudinit/distros/gentoo.py b/cloudinit/distros/gentoo.py
141 +index dc57717d..98ac41ca 100644
142 +--- a/cloudinit/distros/gentoo.py
143 ++++ b/cloudinit/distros/gentoo.py
144 +@@ -192,7 +192,7 @@ class Distro(distros.Distro):
145 + if pkgs is None:
146 + pkgs = []
147 +
148 +- cmd = list('emerge')
149 ++ cmd = ['emerge']
150 + # Redirect output
151 + cmd.append("--quiet")
152 +
153 +--
154 +2.19.0
155 +
156
157 diff --git a/app-emulation/cloud-init/files/cloud-init-18.4-gentoo-support-upstream-templates.patch b/app-emulation/cloud-init/files/cloud-init-18.4-gentoo-support-upstream-templates.patch
158 new file mode 100644
159 index 00000000000..60d9da60055
160 --- /dev/null
161 +++ b/app-emulation/cloud-init/files/cloud-init-18.4-gentoo-support-upstream-templates.patch
162 @@ -0,0 +1,91 @@
163 +From 946ce2b005a71e9922654af79bce51fefa16c3d4 Mon Sep 17 00:00:00 2001
164 +From: Gilles Dartiguelongue <eva@g.o>
165 +Date: Wed, 24 Oct 2018 10:52:46 +0200
166 +Subject: [PATCH 2/2] Add support for gentoo in cloud.cfg and templates
167 +
168 +---
169 + config/cloud.cfg.tmpl | 8 ++++++--
170 + templates/hosts.gentoo.tmpl | 24 ++++++++++++++++++++++++
171 + tools/render-cloudcfg | 2 +-
172 + 3 files changed, 31 insertions(+), 3 deletions(-)
173 + create mode 100644 templates/hosts.gentoo.tmpl
174 +
175 +diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
176 +index 1fef133a..f66b5f7e 100644
177 +--- a/config/cloud.cfg.tmpl
178 ++++ b/config/cloud.cfg.tmpl
179 +@@ -134,7 +134,7 @@ cloud_final_modules:
180 + # (not accessible to handlers/transforms)
181 + system_info:
182 + # This will affect which distro class gets used
183 +-{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %}
184 ++{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd", "gentoo"] %}
185 + distro: {{ variant }}
186 + {% else %}
187 + # Unknown/fallback distro.
188 +@@ -172,7 +172,7 @@ system_info:
189 + primary: http://ports.ubuntu.com/ubuntu-ports
190 + security: http://ports.ubuntu.com/ubuntu-ports
191 + ssh_svcname: ssh
192 +-{% elif variant in ["centos", "rhel", "fedora", "suse"] %}
193 ++{% elif variant in ["centos", "rhel", "fedora", "suse", "gentoo"] %}
194 + # Default user name + that default users groups (if added/used)
195 + default_user:
196 + name: {{ variant }}
197 +@@ -180,6 +180,10 @@ system_info:
198 + gecos: {{ variant }} Cloud User
199 + {% if variant == "suse" %}
200 + groups: [cdrom, users]
201 ++{% elif variant == "gentoo" %}
202 ++ groups: [users, wheel]
203 ++ primary_group: users
204 ++ no-user-group: true
205 + {% else %}
206 + groups: [wheel, adm, systemd-journal]
207 + {% endif %}
208 +diff --git a/templates/hosts.gentoo.tmpl b/templates/hosts.gentoo.tmpl
209 +new file mode 100644
210 +index 00000000..cd045fa6
211 +--- /dev/null
212 ++++ b/templates/hosts.gentoo.tmpl
213 +@@ -0,0 +1,24 @@
214 ++## template:jinja
215 ++{#
216 ++This file /etc/cloud/templates/hosts.gentoo.tmpl is only utilized
217 ++if enabled in cloud-config. Specifically, in order to enable it
218 ++you need to add the following to config:
219 ++ manage_etc_hosts: True
220 ++-#}
221 ++# Your system has configured 'manage_etc_hosts' as True.
222 ++# As a result, if you wish for changes to this file to persist
223 ++# then you will need to either
224 ++# a.) make changes to the master file in /etc/cloud/templates/hosts.gentoo.tmpl
225 ++# b.) change or remove the value of 'manage_etc_hosts' in
226 ++# /etc/cloud/cloud.cfg or cloud-config from user-data
227 ++#
228 ++# The following lines are desirable for IPv4 capable hosts
229 ++127.0.0.1 {{fqdn}} {{hostname}}
230 ++127.0.0.1 localhost.localdomain localhost
231 ++127.0.0.1 localhost4.localdomain4 localhost4
232 ++
233 ++# The following lines are desirable for IPv6 capable hosts
234 ++::1 {{fqdn}} {{hostname}}
235 ++::1 localhost.localdomain localhost
236 ++::1 localhost6.localdomain6 localhost6
237 ++
238 +diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
239 +index 8b7cb875..d109044e 100755
240 +--- a/tools/render-cloudcfg
241 ++++ b/tools/render-cloudcfg
242 +@@ -4,7 +4,7 @@ import argparse
243 + import os
244 + import sys
245 +
246 +-VARIANTS = ["bsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown"]
247 ++VARIANTS = ["bsd", "centos", "fedora", "gentoo", "rhel", "suse", "ubuntu", "unknown"]
248 +
249 + if "avoid-pep8-E402-import-not-top-of-file":
250 + _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
251 +--
252 +2.19.0
253 +