commit:     e98de08886fcfdc46109c1d38048247174a9e0ac
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 20 11:12:16 2018 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Tue Nov 20 11:13:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e98de088

app-emulation/cloud-init: update gentoo fixes

Package-Manager: Portage-2.3.51, Repoman-2.3.12
Signed-off-by: Gilles Dartiguelongue <eva <AT> gentoo.org>

 ...-init-9999.ebuild => cloud-init-18.4-r1.ebuild} | 20 ++++----
 app-emulation/cloud-init/cloud-init-9999.ebuild    |  5 ++
 .../18.4-add-support-for-package_upgrade.patch     | 54 ++++++++++++++++++++++
 .../18.4-fix-filename-for-storing-locale.patch     | 30 ++++++++++++
 .../18.4-fix-update_package_sources-function.patch | 26 +++++++++++
 ...it-18.4-gentoo-support-upstream-templates.patch | 10 ++--
 6 files changed, 132 insertions(+), 13 deletions(-)

diff --git a/app-emulation/cloud-init/cloud-init-9999.ebuild 
b/app-emulation/cloud-init/cloud-init-18.4-r1.ebuild
similarity index 77%
copy from app-emulation/cloud-init/cloud-init-9999.ebuild
copy to app-emulation/cloud-init/cloud-init-18.4-r1.ebuild
index 0b0b7bcaac9..34fd8b7e077 100644
--- a/app-emulation/cloud-init/cloud-init-9999.ebuild
+++ b/app-emulation/cloud-init/cloud-init-18.4-r1.ebuild
@@ -4,15 +4,15 @@
 EAPI=6
 PYTHON_COMPAT=( python2_7 python3_4 python3_5 python3_6 )
 
-inherit distutils-r1 git-r3
+inherit distutils-r1
 
 DESCRIPTION="Cloud instance initialisation magic"
 HOMEPAGE="https://launchpad.net/cloud-init";
-EGIT_REPO_URI="https://git.launchpad.net/cloud-init";
+SRC_URI="https://launchpad.net/${PN}/trunk/${PV}/+download/${P}.tar.gz";
 
 LICENSE="GPL-3"
 SLOT="0"
-KEYWORDS=""
+KEYWORDS="~amd64 ~x86"
 IUSE="test"
 
 CDEPEND="
@@ -47,15 +47,19 @@ RDEPEND="
 "
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-18.4-fix-packages-module.patch
-       "${FILESDIR}"/${PN}-18.4-gentoo-support-upstream-templates.patch
+       # Fix Gentoo support
+       # 
https://code.launchpad.net/~gilles-dartiguelongue/cloud-init/+git/cloud-init/+merge/358777
+       "${FILESDIR}"/${P}-fix-packages-module.patch
+       "${FILESDIR}"/${P}-gentoo-support-upstream-templates.patch
+       "${FILESDIR}"/${PV}-fix-filename-for-storing-locale.patch
+       "${FILESDIR}"/${PV}-fix-update_package_sources-function.patch
+       "${FILESDIR}"/${PV}-add-support-for-package_upgrade.patch
 )
 
-python_prepare_all() {
+src_prepare() {
        # Fix location of documentation installation
        sed -i "s:USR + '/share/doc/cloud-init:USR + '/share/doc/${PF}:" 
setup.py || die
-       sed -i 's/version=get_version(),/version=9999,/g' setup.py || die
-       distutils-r1_python_prepare_all
+       distutils-r1_src_prepare
 }
 
 python_test() {

diff --git a/app-emulation/cloud-init/cloud-init-9999.ebuild 
b/app-emulation/cloud-init/cloud-init-9999.ebuild
index 0b0b7bcaac9..141eb23c883 100644
--- a/app-emulation/cloud-init/cloud-init-9999.ebuild
+++ b/app-emulation/cloud-init/cloud-init-9999.ebuild
@@ -47,8 +47,13 @@ RDEPEND="
 "
 
 PATCHES=(
+       # Fix Gentoo support
+       # 
https://code.launchpad.net/~gilles-dartiguelongue/cloud-init/+git/cloud-init/+merge/358777
        "${FILESDIR}"/${PN}-18.4-fix-packages-module.patch
        "${FILESDIR}"/${PN}-18.4-gentoo-support-upstream-templates.patch
+       "${FILESDIR}"/18.4-fix-filename-for-storing-locale.patch
+       "${FILESDIR}"/18.4-fix-update_package_sources-function.patch
+       "${FILESDIR}"/18.4-add-support-for-package_upgrade.patch
 )
 
 python_prepare_all() {

diff --git 
a/app-emulation/cloud-init/files/18.4-add-support-for-package_upgrade.patch 
b/app-emulation/cloud-init/files/18.4-add-support-for-package_upgrade.patch
new file mode 100644
index 00000000000..9c542cfc077
--- /dev/null
+++ b/app-emulation/cloud-init/files/18.4-add-support-for-package_upgrade.patch
@@ -0,0 +1,54 @@
+From 7868b97507d0dd7d7721ad5c4539e22c67635f92 Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <[email protected]>
+Date: Wed, 14 Nov 2018 15:58:30 +0100
+Subject: [PATCH 5/5] gentoo: add support for package_upgrade
+
+---
+ cloudinit/distros/gentoo.py | 25 ++++++++++++++-----------
+ 1 file changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/cloudinit/distros/gentoo.py b/cloudinit/distros/gentoo.py
+index 7b838e82..22ad2cf3 100644
+--- a/cloudinit/distros/gentoo.py
++++ b/cloudinit/distros/gentoo.py
+@@ -189,23 +189,26 @@ class Distro(distros.Distro):
+         distros.set_etc_timezone(tz=tz, tz_file=self._find_tz_file(tz))
+ 
+     def package_command(self, command, args=None, pkgs=None):
+-        if pkgs is None:
+-            pkgs = []
+-
+         cmd = ['emerge']
+         # Redirect output
+         cmd.append("--quiet")
+ 
+-        if args and isinstance(args, str):
+-            cmd.append(args)
+-        elif args and isinstance(args, list):
+-            cmd.extend(args)
++        if command == "upgrade":
++            cmd.extend(["--update", "world"])
++        else:
++            if pkgs is None:
++                pkgs = []
++
++            if args and isinstance(args, str):
++                cmd.append(args)
++            elif args and isinstance(args, list):
++                cmd.extend(args)
+ 
+-        if command:
+-            cmd.append(command)
++            if command:
++                cmd.append(command)
+ 
+-        pkglist = util.expand_package_list('%s-%s', pkgs)
+-        cmd.extend(pkglist)
++            pkglist = util.expand_package_list('%s-%s', pkgs)
++            cmd.extend(pkglist)
+ 
+         # Allow the output of this to flow outwards (ie not be captured)
+         util.subp(cmd, capture=False)
+-- 
+2.19.1
+

diff --git 
a/app-emulation/cloud-init/files/18.4-fix-filename-for-storing-locale.patch 
b/app-emulation/cloud-init/files/18.4-fix-filename-for-storing-locale.patch
new file mode 100644
index 00000000000..a5bbf6034ac
--- /dev/null
+++ b/app-emulation/cloud-init/files/18.4-fix-filename-for-storing-locale.patch
@@ -0,0 +1,30 @@
+From 3756cdea3e844b9611de321a8075df80e7dbf74d Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <[email protected]>
+Date: Wed, 14 Nov 2018 15:28:22 +0100
+Subject: [PATCH 3/5] gentoo: fix filename for storing locale
+
+There must have been a misunderstanding as locale.gen is meant to
+contain locales to be generated if no argument is passed to locale-gen.
+
+When using openrc, Gentoo stores system locale in /etc/env.d/02locale
+which is generally manipulated through eselect.
+---
+ 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 98ac41ca..50bb61fb 100644
+--- a/cloudinit/distros/gentoo.py
++++ b/cloudinit/distros/gentoo.py
+@@ -20,7 +20,7 @@ LOG = logging.getLogger(__name__)
+ 
+ 
+ class Distro(distros.Distro):
+-    locale_conf_fn = '/etc/locale.gen'
++    locale_conf_fn = '/etc/env.d/02locale'
+     network_conf_fn = '/etc/conf.d/net'
+     resolve_conf_fn = '/etc/resolv.conf'
+     hostname_conf_fn = '/etc/conf.d/hostname'
+-- 
+2.19.1
+

diff --git 
a/app-emulation/cloud-init/files/18.4-fix-update_package_sources-function.patch 
b/app-emulation/cloud-init/files/18.4-fix-update_package_sources-function.patch
new file mode 100644
index 00000000000..d90258d1bc4
--- /dev/null
+++ 
b/app-emulation/cloud-init/files/18.4-fix-update_package_sources-function.patch
@@ -0,0 +1,26 @@
+From b15c4c4b24c894b3c8d444466110c881c35525e2 Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <[email protected]>
+Date: Wed, 14 Nov 2018 15:35:37 +0100
+Subject: [PATCH 4/5] gentoo: fix update_package_sources function
+
+Method is meant to update packages repository, not to update the system.
+---
+ 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 50bb61fb..7b838e82 100644
+--- a/cloudinit/distros/gentoo.py
++++ b/cloudinit/distros/gentoo.py
+@@ -212,7 +212,7 @@ class Distro(distros.Distro):
+ 
+     def update_package_sources(self):
+         self._runner.run("update-sources", self.package_command,
+-                         ["-u", "world"], freq=PER_INSTANCE)
++                         ["--sync"], freq=PER_INSTANCE)
+ 
+ 
+ def convert_resolv_conf(settings):
+-- 
+2.19.1
+

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
index 60d9da60055..6f87399af94 100644
--- 
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
@@ -1,7 +1,7 @@
-From 946ce2b005a71e9922654af79bce51fefa16c3d4 Mon Sep 17 00:00:00 2001
+From 823454f1ea140ec47f5f9c5c3c5ad62eb458eb8a Mon Sep 17 00:00:00 2001
 From: Gilles Dartiguelongue <[email protected]>
 Date: Wed, 24 Oct 2018 10:52:46 +0200
-Subject: [PATCH 2/2] Add support for gentoo in cloud.cfg and templates
+Subject: [PATCH 2/5] Add support for gentoo in cloud.cfg and templates
 
 ---
  config/cloud.cfg.tmpl       |  8 ++++++--
@@ -11,7 +11,7 @@ Subject: [PATCH 2/2] Add support for gentoo in cloud.cfg and 
templates
  create mode 100644 templates/hosts.gentoo.tmpl
 
 diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
-index 1fef133a..f66b5f7e 100644
+index 1fef133a..3f5a41a2 100644
 --- a/config/cloud.cfg.tmpl
 +++ b/config/cloud.cfg.tmpl
 @@ -134,7 +134,7 @@ cloud_final_modules:
@@ -39,7 +39,7 @@ index 1fef133a..f66b5f7e 100644
 +{% elif variant == "gentoo" %}
 +     groups: [users, wheel]
 +     primary_group: users
-+     no-user-group: true
++     no_user_group: true
  {% else %}
       groups: [wheel, adm, systemd-journal]
  {% endif %}
@@ -87,5 +87,5 @@ index 8b7cb875..d109044e 100755
  if "avoid-pep8-E402-import-not-top-of-file":
      _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
 -- 
-2.19.0
+2.19.1
 

Reply via email to