Date: Wednesday, May 10, 2023 @ 09:23:14
  Author: dvzrv
Revision: 1459745

archrelease: copy trunk to community-any

Added:
  molecule-plugins/repos/community-any/PKGBUILD
    (from rev 1459744, molecule-plugins/trunk/PKGBUILD)
  
molecule-plugins/repos/community-any/molecule-plugins-23.4.1-molecule_internals.patch
    (from rev 1459744, 
molecule-plugins/trunk/molecule-plugins-23.4.1-molecule_internals.patch)
Deleted:
  molecule-plugins/repos/community-any/PKGBUILD

--------------------------------------------------+
 PKGBUILD                                         |  216 +++++++++++----------
 molecule-plugins-23.4.1-molecule_internals.patch |  118 +++++++++++
 2 files changed, 232 insertions(+), 102 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD    2023-05-10 09:23:11 UTC (rev 1459744)
+++ PKGBUILD    2023-05-10 09:23:14 UTC (rev 1459745)
@@ -1,102 +0,0 @@
-# Maintainer: David Runge <[email protected]>
-
-pkgname=molecule-plugins
-pkgver=23.4.1
-pkgrel=2
-pkgdesc="Collection of molecule plugins"
-arch=(any)
-url="https://github.com/ansible-community/molecule-plugins";
-license=(MIT)
-depends=(
-  molecule
-  python
-  python-boto3  # for ec2 driver
-  python-cryptography  # for ec2 driver
-  python-docker
-  python-packaging  # required for podman driver
-  python-requests
-  python-selinux
-)
-makedepends=(
-  python-build
-  python-installer
-  python-setuptools
-  python-setuptools-scm
-  python-wheel
-)
-checkdepends=(
-  podman
-  python-filelock
-  python-google-auth
-  python-google-api-python-client
-  python-pexpect
-  python-pycryptodome
-  python-pytest
-  python-pytest-helpers-namespace
-  python-vagrant
-  vagrant
-)
-optdepends=(
-  'python-pycryptodome: for GCE playbooks'
-  'python-google-auth: for GCE playbooks'
-  'python-google-api-python-client: for GCE playbooks'
-  'python-vagrant: for vagrant module'
-)
-conflicts=(
-  molecule-containers
-  molecule-docker
-  molecule-podman
-  molecule-vagrant
-)
-replaces=(
-  molecule-containers
-  molecule-docker
-  molecule-podman
-  molecule-vagrant
-)
-source=(https://files.pythonhosted.org/packages/source/${pkgname::1}/$pkgname/$pkgname-$pkgver.tar.gz)
-sha512sums=('5c158e278318402006f9f86f4143dac27d0cf6e95912963414e9c06720f9b5572240a6b6ddaccbd2872bb594144215a4a5ec434f4414e692fb72a3d97de175d3')
-b2sums=('e0261d189e55b0705ff2e967620146dd6ef0bc4182a6e87d5ffdaf8e1298dc0bc9e9bb188669300b63cf692f822ad6b0d4c8038fc1cff6afbf7f79b61dfbc184')
-
-build() {
-  cd $pkgname-$pkgver
-  python -m build --wheel --no-isolation
-}
-
-check() {
-  local site_packages=$(python -c "import site; 
print(site.getsitepackages()[0])")
-  local pytest_options=(
-    --deselect test/azure/functional/test_azure.py::test_command_init_scenario
-    --deselect 
test/containers/functional/test_containers.py::test_command_init_scenario
-    --deselect test/podman/test_func.py::test_command_init_scenario
-    --deselect test/podman/test_func.py::test_sample
-    --deselect test/podman/test_func.py::test_dockerfile
-    --deselect test/vagrant/functional/test_func.py::test_command_init_scenario
-    --deselect test/vagrant/functional/test_func.py::test_invalid_settings
-    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[vagrant_root]
-    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[config_options]
-    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[provider_config_options]
-    --deselect test/vagrant/functional/test_func.py::test_vagrant_root[default]
-    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[default-compat]
-    --deselect test/vagrant/functional/test_func.py::test_vagrant_root[network]
-    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[hostname]
-    --deselect test/vagrant/functional/test_func.py::test_multi_node
-    -vv
-  )
-
-  cd $pkgname-$pkgver
-  # install to temporary location, as importlib is used
-  python -m installer --destdir=test_dir dist/*.whl
-  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
-  # skip tests that would fail because of missing interpreters: 
https://github.com/pdm-project/pdm/issues/1175
-  pytest "${pytest_options[@]}"
-}
-
-package() {
-  cd $pkgname-$pkgver
-  python -m installer --destdir="$pkgdir" dist/*.whl
-  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
-  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
-  install -vDm 644 doc/ec2/*.rst  -t "$pkgdir/usr/share/doc/$pkgname/ec2"
-  install -vDm 644 doc/vagrant/*.rst  -t 
"$pkgdir/usr/share/doc/$pkgname/vagrant"
-}

Copied: molecule-plugins/repos/community-any/PKGBUILD (from rev 1459744, 
molecule-plugins/trunk/PKGBUILD)
===================================================================
--- PKGBUILD                            (rev 0)
+++ PKGBUILD    2023-05-10 09:23:14 UTC (rev 1459745)
@@ -0,0 +1,114 @@
+# Maintainer: David Runge <[email protected]>
+
+pkgname=molecule-plugins
+pkgver=23.4.1
+pkgrel=3
+pkgdesc="Collection of molecule plugins"
+arch=(any)
+url="https://github.com/ansible-community/molecule-plugins";
+license=(MIT)
+depends=(
+  molecule
+  python
+  python-boto3  # for ec2 driver
+  python-cryptography  # for ec2 driver
+  python-docker
+  python-packaging  # required for podman driver
+  python-requests
+  python-selinux
+)
+makedepends=(
+  python-build
+  python-installer
+  python-setuptools
+  python-setuptools-scm
+  python-wheel
+)
+checkdepends=(
+  podman
+  python-filelock
+  python-google-auth
+  python-google-api-python-client
+  python-pexpect
+  python-pycryptodome
+  python-pytest
+  python-pytest-helpers-namespace
+  python-vagrant
+  vagrant
+)
+optdepends=(
+  'python-pycryptodome: for GCE playbooks'
+  'python-google-auth: for GCE playbooks'
+  'python-google-api-python-client: for GCE playbooks'
+  'python-vagrant: for vagrant module'
+)
+conflicts=(
+  molecule-containers
+  molecule-docker
+  molecule-podman
+  molecule-vagrant
+)
+replaces=(
+  molecule-containers
+  molecule-docker
+  molecule-podman
+  molecule-vagrant
+)
+source=(
+  
https://files.pythonhosted.org/packages/source/${pkgname::1}/$pkgname/$pkgname-$pkgver.tar.gz
+  $pkgname-23.4.1-molecule_internals.patch
+)
+sha512sums=('5c158e278318402006f9f86f4143dac27d0cf6e95912963414e9c06720f9b5572240a6b6ddaccbd2872bb594144215a4a5ec434f4414e692fb72a3d97de175d3'
+            
'11822fbd65ba7ccc796e454c015fe765a811e82bd89dc0727201cd45495907df3f808be967d73f45473c073816f9db5c072f32dbcab807229d7c7cf82de9101c')
+b2sums=('e0261d189e55b0705ff2e967620146dd6ef0bc4182a6e87d5ffdaf8e1298dc0bc9e9bb188669300b63cf692f822ad6b0d4c8038fc1cff6afbf7f79b61dfbc184'
+        
'62bb11057e5c429229a033ca8911b836817c456270077469decf608c9c9927c425e1c647a54f5370b4cabb644cfb0a1e44e0166b6a4f21912ce4e430f6b56a8f')
+
+prepare() {
+  # fix issues with vagrant plugin using molecule internals that are now gone:
+  # https://github.com/ansible-community/molecule-plugins/pull/142
+  # https://bugs.archlinux.org/task/78447
+  patch -Np1 -d $pkgname-$pkgver -i ../$pkgname-23.4.1-molecule_internals.patch
+}
+
+build() {
+  cd $pkgname-$pkgver
+  python -m build --wheel --no-isolation
+}
+
+check() {
+  local site_packages=$(python -c "import site; 
print(site.getsitepackages()[0])")
+  local pytest_options=(
+    --deselect test/azure/functional/test_azure.py::test_command_init_scenario
+    --deselect 
test/containers/functional/test_containers.py::test_command_init_scenario
+    --deselect test/podman/test_func.py::test_command_init_scenario
+    --deselect test/podman/test_func.py::test_sample
+    --deselect test/podman/test_func.py::test_dockerfile
+    --deselect test/vagrant/functional/test_func.py::test_command_init_scenario
+    --deselect test/vagrant/functional/test_func.py::test_invalid_settings
+    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[vagrant_root]
+    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[config_options]
+    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[provider_config_options]
+    --deselect test/vagrant/functional/test_func.py::test_vagrant_root[default]
+    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[default-compat]
+    --deselect test/vagrant/functional/test_func.py::test_vagrant_root[network]
+    --deselect 
test/vagrant/functional/test_func.py::test_vagrant_root[hostname]
+    --deselect test/vagrant/functional/test_func.py::test_multi_node
+    -vv
+  )
+
+  cd $pkgname-$pkgver
+  # install to temporary location, as importlib is used
+  python -m installer --destdir=test_dir dist/*.whl
+  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
+  # skip tests that would fail because of missing interpreters: 
https://github.com/pdm-project/pdm/issues/1175
+  pytest "${pytest_options[@]}"
+}
+
+package() {
+  cd $pkgname-$pkgver
+  python -m installer --destdir="$pkgdir" dist/*.whl
+  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
+  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
+  install -vDm 644 doc/ec2/*.rst  -t "$pkgdir/usr/share/doc/$pkgname/ec2"
+  install -vDm 644 doc/vagrant/*.rst  -t 
"$pkgdir/usr/share/doc/$pkgname/vagrant"
+}

Copied: 
molecule-plugins/repos/community-any/molecule-plugins-23.4.1-molecule_internals.patch
 (from rev 1459744, 
molecule-plugins/trunk/molecule-plugins-23.4.1-molecule_internals.patch)
===================================================================
--- molecule-plugins-23.4.1-molecule_internals.patch                            
(rev 0)
+++ molecule-plugins-23.4.1-molecule_internals.patch    2023-05-10 09:23:14 UTC 
(rev 1459745)
@@ -0,0 +1,118 @@
+From 6ee55c7b7a9e556fc18bbc14144b8ca1ee7be845 Mon Sep 17 00:00:00 2001
+From: Arnaud Patard <[email protected]>
+Date: Thu, 27 Apr 2023 18:13:56 +0200
+Subject: [PATCH] src/molecule_plugins/vagrant/modules/vagrant.py: Get rid of
+ molecule dependency
+
+To avoid changes in molecule.util breaking the vagrant module, let's
+get rid of the dependency by:
+- embedded the recursive dict merge function
+- replace template handling by our own code.
+  (and keep the autoescaping enabled)
+
+Moreover, it will make it easier to use community.vagrant since molecule
+is not needed anymore.
+
+Signed-off-by: Arnaud Patard <[email protected]>
+---
+ .../vagrant/modules/vagrant.py                | 41 +++++++++++++++----
+ 1 file changed, 33 insertions(+), 8 deletions(-)
+
+diff --git a/src/molecule_plugins/vagrant/modules/vagrant.py 
b/src/molecule_plugins/vagrant/modules/vagrant.py
+index 8232695..b8cb11f 100644
+--- a/src/molecule_plugins/vagrant/modules/vagrant.py
++++ b/src/molecule_plugins/vagrant/modules/vagrant.py
+@@ -22,16 +22,16 @@
+ 
+ 
+ import contextlib
++import copy
+ import datetime
+ import os
+ import subprocess
+ import sys
++from collections.abc import MutableMapping
+ 
++import jinja2
+ from ansible.module_utils.basic import AnsibleModule
+ 
+-import molecule
+-import molecule.util
+-
+ try:
+     import vagrant
+ except ImportError:
+@@ -199,6 +199,8 @@
+   {%- endfor -%}
+ {%- endmacro -%}
+ 
++# Ansible managed
++
+ Vagrant.configure('2') do |config|
+   if Vagrant.has_plugin?('vagrant-cachier')
+     {% if cachier is not none and cachier in [ "machine", "box" ] %}
+@@ -335,6 +337,27 @@
+ """
+ 
+ 
++# Taken from molecule.util.
++def merge_dicts(a: MutableMapping, b: MutableMapping) -> MutableMapping:
++    """Merge the values of b into a and returns a new dict.
++
++    This function uses the same algorithm as Ansible's 
`combine(recursive=True)` filter.
++
++    :param a: the target dictionary
++    :param b: the dictionary to import
++    :return: dict
++    """
++    result = copy.deepcopy(a)
++
++    for k, v in b.items():
++        if k in a and isinstance(a[k], dict) and isinstance(v, dict):
++            result[k] = merge_dicts(a[k], v)
++        else:
++            result[k] = v
++
++    return result
++
++
+ class VagrantClient:
+     def __init__(self, module) -> None:
+         self._module = module
+@@ -548,13 +571,15 @@ def _get_config(self):
+ 
+     def _write_vagrantfile(self):
+         instances = self._get_vagrant_config_dict()
+-        template = molecule.util.render_template(
+-            VAGRANTFILE_TEMPLATE,
++        j_env = jinja2.Environment(autoescape=True)
++        t = j_env.from_string(VAGRANTFILE_TEMPLATE)
++        template = t.render(
+             instances=instances,
+             cachier=self.cachier,
+             no_kvm=not os.path.exists("/dev/kvm"),
+         )
+-        molecule.util.write_file(self._vagrantfile, template)
++        with open(self._vagrantfile, "w") as f:
++            f.write(template)
+ 
+     def _write_configs(self):
+         self._write_vagrantfile()
+@@ -628,7 +653,7 @@ def _get_instance_vagrant_config_dict(self, instance):
+         }
+ 
+         d["config_options"].update(
+-            molecule.util.merge_dicts(
++            merge_dicts(
+                 d["config_options"],
+                 instance.get("config_options", {}),
+             ),
+@@ -640,7 +665,7 @@ def _get_instance_vagrant_config_dict(self, instance):
+             )
+ 
+         d["provider_options"].update(
+-            molecule.util.merge_dicts(
++            merge_dicts(
+                 d["provider_options"],
+                 instance.get("provider_options", {}),
+             ),

Reply via email to