Add support for suse_py39 flavor

Change-Id: Id10e623e0dd881ac601c1dad3adfd5b14036bd5a
This commit is contained in:
Dirk Müller 2023-03-03 21:56:31 +01:00
parent 4a4e844c87
commit 1c1c2089f4
No known key found for this signature in database
4 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,82 @@
From 90059d316cbed4094c434ea77275e65e60e3b87c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dirk@dmllr.de>
Date: Fri, 20 Jan 2023 18:32:16 +0100
Subject: [PATCH] add suse_py39 flavor to explicitly render templates for py39
This is needed when py 3.9 is not the primary python version
(e.g. SLE15).
Change-Id: I2a94acbf3b6f601e3665fe3bd32401468af67d20
---
pymod2pkg/__init__.py | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/pymod2pkg/__init__.py b/pymod2pkg/__init__.py
index 4a5d4fe..a369cab 100644
--- a/pymod2pkg/__init__.py
+++ b/pymod2pkg/__init__.py
@@ -104,6 +104,20 @@ def default_suse_tr(mod):
return (pkg, py2pkg, py3pkg)
+def default_suse_py39_tr(mod):
+ """
+ Default translation function for openSUSE, SLES, and other
+ SUSE based systems that have python 3.9
+
+ Returns a tuple of 3 elements - the unversioned name, the python2 versioned
+ name and the python3 versioned name.
+ """
+ pkg = 'python-%s' % mod
+ py2pkg = 'python2-%s' % mod
+ py3pkg = 'python39-%s' % mod
+ return (pkg, py2pkg, py3pkg)
+
+
def openstack_prefix_tr(mod):
pkg = 'openstack-' + mod.lower()
return (pkg, pkg, pkg)
@@ -268,7 +282,7 @@ RDO_PKG_MAP = [
]
-SUSE_PKG_MAP = [
+SUSE_COMMON_PKG_MAP = [
# not following SUSE naming policy
SingleRule('ansible', 'ansible'),
SingleRule('ansible-runner', 'ansible-runner'),
@@ -309,6 +323,13 @@ SUSE_PKG_MAP = [
pkgfun=suse_horizon_plugins_tr),
]
+SUSE_PKG_MAP = SUSE_COMMON_PKG_MAP
+
+SUSE_PY39_PKG_MAP = SUSE_COMMON_PKG_MAP
+SUSE_PY39_PKG_MAP.extend([
+ SingleRule('devel', 'python-devel', 'python39-devel'),
+])
+
UBUNTU_PKG_MAP = [
SingleRule('glance_store', 'python-glance-store'),
SingleRule('GitPython', 'python-git'),
@@ -346,6 +367,8 @@ OPENSTACK_UPSTREAM_PKG_MAP = [
def get_pkg_map(dist):
d_lower = dist.lower()
+ if 'suse_py39' in d_lower:
+ return SUSE_PY39_PKG_MAP
if 'suse' in d_lower or 'sles' in d_lower:
return SUSE_PKG_MAP
if 'ubuntu' in d_lower:
@@ -355,6 +378,8 @@ def get_pkg_map(dist):
def get_default_tr_func(dist):
d_lower = dist.lower()
+ if 'suse_py39' in d_lower:
+ return default_suse_py39_tr
if 'suse' in d_lower or 'sles' in d_lower:
return default_suse_tr
if 'ubuntu' in d_lower:
--
2.39.2

View File

@ -11,6 +11,7 @@ License: {{ license('Apache-2.0') }}
Group: Development/Libraries/Python
URL: https://wiki.openstack.org/wiki/Rpm-packaging
Source0: {{ source }}
Patch1: 0001-add-suse_py39-flavor-to-explicitly-render-templates-.patch
BuildRequires: openstack-macros
BuildRequires: {{ py3('distro') }}
BuildRequires: {{ py3('pbr') }}

View File

@ -0,0 +1,44 @@
From b9145d5d4d4d660c1a236f9866265e5e51ca8b70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dirk@dmllr.de>
Date: Fri, 3 Mar 2023 21:51:42 +0100
Subject: [PATCH] Allow selecting suse_39 template
Change-Id: Ib16122c5b25cf8f83f27a83ef49ee75643bbc7ba
---
renderspec/__init__.py | 2 +-
renderspec/contextfuncs.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/renderspec/__init__.py b/renderspec/__init__.py
index 0594584..2effa8c 100644
--- a/renderspec/__init__.py
+++ b/renderspec/__init__.py
@@ -172,7 +172,7 @@ def process_args():
"default: autodetect")
parser.add_argument("--spec-style", help="distro style you want to use. "
"default: %s" % (distro), default=distro,
- choices=['suse', 'fedora'])
+ choices=['suse', 'suse_py39', 'fedora'])
parser.add_argument("--skip-pyversion",
help='Skip requirements for this pyversion',
default=_get_default_pyskips(distro),
diff --git a/renderspec/contextfuncs.py b/renderspec/contextfuncs.py
index 023e688..b2c3aea 100644
--- a/renderspec/contextfuncs.py
+++ b/renderspec/contextfuncs.py
@@ -250,9 +250,9 @@ def _context_license_spdx(context, value):
if context['spec_style'] == 'fedora':
return mapping[value]
- else:
- # just use the spdx license name
- return value
+
+ # just use the spdx license name
+ return value
###############
--
2.39.2

View File

@ -12,6 +12,7 @@ License: {{ license('Apache-2.0') }}
Group: Development/Languages/Python
URL: https://docs.openstack.org/{{ pypi_name }}
Source0: https://files.pythonhosted.org/packages/source/r/{{ pypi_name }}/{{ pypi_name }}-%{version}.tar.gz
Patch1: 0001-Allow-selecting-suse_39-template.patch
BuildRequires: openstack-macros
BuildRequires: {{ py3('Jinja2') }}
BuildRequires: {{ py3('ddt') }}