From dc8d47bc28b164ecc01a8207274cbd0c7f33300b Mon Sep 17 00:00:00 2001 From: Gilles Dartiguelongue Date: Wed, 24 Oct 2018 12:53:02 +0200 Subject: app-emulation/cloud-init: version bump 17.2 → 18.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix running unittests. Remove unused inherits. Rely on build system for cloud.cfg, templates and documentation installation. Add patches for Gentoo specifics. Package-Manager: Portage-2.3.50, Repoman-2.3.11 Manifest-Sign-Key: 0x5A56C8CD0C13248A --- app-emulation/cloud-init/Manifest | 23 ++++++ app-emulation/cloud-init/cloud-init-18.4.ebuild | 81 +++++++++++++++++++ ...1-Fix-Gentoo-package-installation-command.patch | 25 ++++++ ...ort-for-gentoo-in-cloud.cfg-and-templates.patch | 91 ++++++++++++++++++++++ app-emulation/cloud-init/metadata.xml | 14 ++++ 5 files changed, 234 insertions(+) create mode 100644 app-emulation/cloud-init/Manifest create mode 100644 app-emulation/cloud-init/cloud-init-18.4.ebuild create mode 100644 app-emulation/cloud-init/files/0001-Fix-Gentoo-package-installation-command.patch create mode 100644 app-emulation/cloud-init/files/0002-Add-support-for-gentoo-in-cloud.cfg-and-templates.patch create mode 100644 app-emulation/cloud-init/metadata.xml diff --git a/app-emulation/cloud-init/Manifest b/app-emulation/cloud-init/Manifest new file mode 100644 index 0000000..da360cf --- /dev/null +++ b/app-emulation/cloud-init/Manifest @@ -0,0 +1,23 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +DIST cloud-init-18.4.tar.gz 965112 BLAKE2B 2879aafedea877e4e406a5e837d100ba65e40c62660621f606e7a189af7b1ec8d98ba2c02ae5d253a0b4587502d3a636dec5c2772c968a9037b47e62a05656b4 SHA512 730aca6406f652f55afc2dd50c49eb6708584e0a96715606bcba05cb7f40e47c256faff1f9748f04674a8f941ec9435801c9ed2ac79adec8a6ef167d6b195103 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2 + +iQKTBAEBCAB9FiEEX+aBqe7MmoWBwzA1lSmjXZiBxnkFAlvQTwxfFIAAAAAALgAo +aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDVG +RTY4MUE5RUVDQzlBODU4MUMzMzAzNTk1MjlBMzVEOTg4MUM2NzkACgkQlSmjXZiB +xnk7tw/9GYZJb3Loz9Y+2MTvjYtTZipZeSMJ8eag5Fy6EMKfifCKogBFGI8lr6wd +aTwS+w4gxIYZkqRBeh0re/V6B7Nk6FzB2ZlG8nqPJ6j1rWtRfrk7ecqMTgLbHCIf +vPc2UvbMPBH+6IY4X1+/97ADLvy60PcUQMcdLP+2cnR3xM/0U4rE6qYfysGnQYPK +zyw0sAu3K0gcKTFgJPdPtkBFhRsR5Iz2zgipwP6MtB5nt4y5R5o6k3lcXsIpBVg2 +0f5amxm5ajNY89D4xOCsAeT8fLScxdLEWVscB+eNExEVNeIz65UG1EX9NaZ37I0E +Yks5stmeF2+4ibFAAU80QUkU3/gsPGy0wBah8l9TlfFQ552VFRIrui1AwD7eJQtm +rzc7C3yCshquQoPmVOEoQBoTqsqSlFa0FrHOvPq3GzRLg82xvi/ox2culHPbHZf2 +ciah5q2C5tbxxgYQDgFhGDukw3Z3vOGuGJLKN+MVwBnsT7TApX+xfs+gHJcrThwU +RZQjsKH3iqUn5H+lGpNhPLTvX1iMHKJZqCl40OVv1X6N/T0Uh+xFT3mCXjs81z4D +1dnnR+Q9ohbKxoUsuZN4sADs1jOwcvU52wI6mvLzcGh/E7zG89CimpyR5m8wVdgV +2zVZjCsA+7qD+3xrcu0pJWBb/lyTy0e1zqoS0MlXGIw7V76LUBw= +=7ziw +-----END PGP SIGNATURE----- diff --git a/app-emulation/cloud-init/cloud-init-18.4.ebuild b/app-emulation/cloud-init/cloud-init-18.4.ebuild new file mode 100644 index 0000000..253a3fb --- /dev/null +++ b/app-emulation/cloud-init/cloud-init-18.4.ebuild @@ -0,0 +1,81 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +PYTHON_COMPAT=( python2_7 python3_4 python3_5 python3_6 ) + +inherit distutils-r1 + +DESCRIPTION="Cloud instance initialisation magic" +HOMEPAGE="https://launchpad.net/cloud-init" +SRC_URI="https://launchpad.net/${PN}/trunk/${PV}/+download/${P}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" + +# remove prettytable in 17.2 +CDEPEND=" + dev-python/jinja[${PYTHON_USEDEP}] + dev-python/oauthlib[${PYTHON_USEDEP}] + dev-python/pyserial[${PYTHON_USEDEP}] + >=dev-python/configobj-5.0.2[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] + dev-python/jsonpatch[${PYTHON_USEDEP}] + dev-python/jsonschema[${PYTHON_USEDEP}] + dev-python/six[${PYTHON_USEDEP}] +" +DEPEND=" + dev-python/setuptools[${PYTHON_USEDEP}] + test? ( + ${CDEPEND} + >=dev-python/httpretty-0.7.1[${PYTHON_USEDEP}] + dev-python/mock[${PYTHON_USEDEP}] + dev-python/nose[${PYTHON_USEDEP}] + dev-python/unittest2[${PYTHON_USEDEP}] + dev-python/coverage[${PYTHON_USEDEP}] + dev-python/contextlib2[${PYTHON_USEDEP}] + ) +" +RDEPEND=" + ${CDEPEND} + net-analyzer/macchanger + sys-apps/iproute2 + sys-fs/growpart + virtual/logger +" + +PATCHES=( "${FILESDIR}" ) + +src_prepare() { + # Fix location of documentation installation + sed -i "s:USR + '/share/doc/cloud-init:USR + '/share/doc/${PF}:" setup.py || die + distutils-r1_src_prepare +} + +python_test() { + # Do not use Makefile target as it does not setup environment correclty + esetup.py nosetests -v --where cloudinit --where tests/unittests || die +} + +python_install() { + distutils-r1_python_install --init-system=sysvinit_openrc,systemd --distro gentoo +} + +python_install_all() { + keepdir /etc/cloud + + distutils-r1_python_install_all + + # installs as non-executable + chmod +x "${D}"/etc/init.d/* +} + +pkg_postinst() { + elog "cloud-init-local needs to be run in the boot runlevel because it" + elog "modifies services in the default runlevel. When a runlevel is started" + elog "it is cached, so modifications that happen to the current runlevel" + elog "while you are in it are not acted upon." +} diff --git a/app-emulation/cloud-init/files/0001-Fix-Gentoo-package-installation-command.patch b/app-emulation/cloud-init/files/0001-Fix-Gentoo-package-installation-command.patch new file mode 100644 index 0000000..4a42cbb --- /dev/null +++ b/app-emulation/cloud-init/files/0001-Fix-Gentoo-package-installation-command.patch @@ -0,0 +1,25 @@ +From e894c6f57b88305cdf6e4e2b1543475b2e02f436 Mon Sep 17 00:00:00 2001 +From: Gilles Dartiguelongue +Date: Tue, 23 Oct 2018 18:59:58 +0200 +Subject: [PATCH 1/2] Fix Gentoo package installation command + +--- + cloudinit/distros/gentoo.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cloudinit/distros/gentoo.py b/cloudinit/distros/gentoo.py +index dc57717d..98ac41ca 100644 +--- a/cloudinit/distros/gentoo.py ++++ b/cloudinit/distros/gentoo.py +@@ -192,7 +192,7 @@ class Distro(distros.Distro): + if pkgs is None: + pkgs = [] + +- cmd = list('emerge') ++ cmd = ['emerge'] + # Redirect output + cmd.append("--quiet") + +-- +2.19.0 + diff --git a/app-emulation/cloud-init/files/0002-Add-support-for-gentoo-in-cloud.cfg-and-templates.patch b/app-emulation/cloud-init/files/0002-Add-support-for-gentoo-in-cloud.cfg-and-templates.patch new file mode 100644 index 0000000..60d9da6 --- /dev/null +++ b/app-emulation/cloud-init/files/0002-Add-support-for-gentoo-in-cloud.cfg-and-templates.patch @@ -0,0 +1,91 @@ +From 946ce2b005a71e9922654af79bce51fefa16c3d4 Mon Sep 17 00:00:00 2001 +From: Gilles Dartiguelongue +Date: Wed, 24 Oct 2018 10:52:46 +0200 +Subject: [PATCH 2/2] Add support for gentoo in cloud.cfg and templates + +--- + config/cloud.cfg.tmpl | 8 ++++++-- + templates/hosts.gentoo.tmpl | 24 ++++++++++++++++++++++++ + tools/render-cloudcfg | 2 +- + 3 files changed, 31 insertions(+), 3 deletions(-) + create mode 100644 templates/hosts.gentoo.tmpl + +diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl +index 1fef133a..f66b5f7e 100644 +--- a/config/cloud.cfg.tmpl ++++ b/config/cloud.cfg.tmpl +@@ -134,7 +134,7 @@ cloud_final_modules: + # (not accessible to handlers/transforms) + system_info: + # This will affect which distro class gets used +-{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %} ++{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd", "gentoo"] %} + distro: {{ variant }} + {% else %} + # Unknown/fallback distro. +@@ -172,7 +172,7 @@ system_info: + primary: http://ports.ubuntu.com/ubuntu-ports + security: http://ports.ubuntu.com/ubuntu-ports + ssh_svcname: ssh +-{% elif variant in ["centos", "rhel", "fedora", "suse"] %} ++{% elif variant in ["centos", "rhel", "fedora", "suse", "gentoo"] %} + # Default user name + that default users groups (if added/used) + default_user: + name: {{ variant }} +@@ -180,6 +180,10 @@ system_info: + gecos: {{ variant }} Cloud User + {% if variant == "suse" %} + groups: [cdrom, users] ++{% elif variant == "gentoo" %} ++ groups: [users, wheel] ++ primary_group: users ++ no-user-group: true + {% else %} + groups: [wheel, adm, systemd-journal] + {% endif %} +diff --git a/templates/hosts.gentoo.tmpl b/templates/hosts.gentoo.tmpl +new file mode 100644 +index 00000000..cd045fa6 +--- /dev/null ++++ b/templates/hosts.gentoo.tmpl +@@ -0,0 +1,24 @@ ++## template:jinja ++{# ++This file /etc/cloud/templates/hosts.gentoo.tmpl is only utilized ++if enabled in cloud-config. Specifically, in order to enable it ++you need to add the following to config: ++ manage_etc_hosts: True ++-#} ++# Your system has configured 'manage_etc_hosts' as True. ++# As a result, if you wish for changes to this file to persist ++# then you will need to either ++# a.) make changes to the master file in /etc/cloud/templates/hosts.gentoo.tmpl ++# b.) change or remove the value of 'manage_etc_hosts' in ++# /etc/cloud/cloud.cfg or cloud-config from user-data ++# ++# The following lines are desirable for IPv4 capable hosts ++127.0.0.1 {{fqdn}} {{hostname}} ++127.0.0.1 localhost.localdomain localhost ++127.0.0.1 localhost4.localdomain4 localhost4 ++ ++# The following lines are desirable for IPv6 capable hosts ++::1 {{fqdn}} {{hostname}} ++::1 localhost.localdomain localhost ++::1 localhost6.localdomain6 localhost6 ++ +diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg +index 8b7cb875..d109044e 100755 +--- a/tools/render-cloudcfg ++++ b/tools/render-cloudcfg +@@ -4,7 +4,7 @@ import argparse + import os + import sys + +-VARIANTS = ["bsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown"] ++VARIANTS = ["bsd", "centos", "fedora", "gentoo", "rhel", "suse", "ubuntu", "unknown"] + + if "avoid-pep8-E402-import-not-top-of-file": + _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +-- +2.19.0 + diff --git a/app-emulation/cloud-init/metadata.xml b/app-emulation/cloud-init/metadata.xml new file mode 100644 index 0000000..0516fdb --- /dev/null +++ b/app-emulation/cloud-init/metadata.xml @@ -0,0 +1,14 @@ + + + + + prometheanfire@gentoo.org + Matthew Thode + + + Package provides configuration and customization of cloud instance. + + + cloud-init + + -- cgit v1.2.3-65-gdbad