Browse code

ansible: upgrade to v2.13.3

sanity_check.sh:
- Delete intermediate __pycache__ dirs
- If not deleted, spec checker will complain about unused .pyc files if
we have a python source files inside SPECS/ directory like in ansible.

python3-jinja2:
- upgrade to latest, needed by ansible.
- fix make check

python3-markupsafe:
- upgrade to latest, needed by python3-jinja2
- fix make check

python3-sphinxcontrib-serializinghtml:
- Upgrade to v2.0.0
- fix make check

python3-sphinxcontrib-htmlhelp:
- upgrade to 1.1.5
- fix make check

Change-Id: Iff2eb88cb37a625bad4f44435998954a32752e1e
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/16373
Reviewed-by: Tapas Kundu <tkundu@vmware.com>
Tested-by: Tapas Kundu <tkundu@vmware.com>

Shreenidhi Shedi authored on 2022/05/26 21:06:03
Showing 10 changed files
1 1
deleted file mode 100644
... ...
@@ -1,388 +0,0 @@
1
-From d1ccebbf0e4227411ebd13fadb75c0ca8f291ed5 Mon Sep 17 00:00:00 2001
2
-From: Shreenidhi Shedi <sshedi@vmware.com>
3
-Date: Fri, 10 Dec 2021 16:57:09 +0530
4
-Subject: [PATCH] tdnf: Support VMware Photon OS package manager
5
-
6
-tdnf is the package manager of VMware Photon OS
7
-
8
-Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
9
-Signed-off-by: Shreenidhi Shedi <yesshedi@gmail.com>
10
- lib/ansible/modules/tdnf.py | 365 ++++++++++++++++++++++++++++++++++++
11
- 1 file changed, 365 insertions(+)
12
- create mode 100644 lib/ansible/modules/tdnf.py
13
-
14
-diff --git a/lib/ansible/modules/tdnf.py b/lib/ansible/modules/tdnf.py
15
-new file mode 100644
16
-index 0000000000..1d4cc77c71
17
-+++ b/lib/ansible/modules/tdnf.py
18
-@@ -0,0 +1,365 @@
19
-+#!/usr/bin/python
20
-+# -*- coding: utf-8 -*-
21
-+
22
-+# Copyright (C) 2021 VMware, Inc. All Rights Reserved.
23
-+#
24
-+# GNU General Public License v3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
25
-+#
26
-+
27
-+''' tdnf ansible module for Photon OS  '''
28
-+
29
-+from __future__ import absolute_import, division, print_function
30
-+__metaclass__ = type
31
-+
32
-+
33
-+DOCUMENTATION = '''
34
-+---
35
-+module: tdnf
36
-+short_description: Tiny DNF package manager
37
-+description:
38
-+  - Manages rpm packages in VMware Photon OS.
39
-+version_added: "2.12.1"
40
-+options:
41
-+  name:
42
-+    description:
43
-+      - A package name, like C(foo), or multiple packages, like C(foo, bar).
44
-+    aliases:
45
-+      - pkg
46
-+    type: list
47
-+    elements: str
48
-+
49
-+  state:
50
-+    description:
51
-+      - Indicates the desired package(s) state.
52
-+      - C(present) ensures the package(s) is/are present.
53
-+      - C(absent) ensures the package(s) is/are absent.
54
-+      - C(latest) ensures the package(s) is/are present and the latest version(s).
55
-+      - C(removed) ensures the package(s) is/are removed.
56
-+      - C(installed) ensures the package(s) is/are installed.
57
-+    type: str
58
-+    default: present
59
-+    choices: ['present', 'installed', 'absent', 'removed', 'latest']
60
-+
61
-+  update_cache:
62
-+    description:
63
-+      - Update repo metadata cache. Can be run with other steps or on it's own.
64
-+    type: bool
65
-+    default: 'no'
66
-+
67
-+  upgrade:
68
-+    description:
69
-+      - Upgrade all installed packages to their latest version.
70
-+    type: bool
71
-+    default: 'no'
72
-+
73
-+  enablerepo:
74
-+    description:
75
-+      - I(Repoid) of repositories to enable for the install/update operation.
76
-+        When specifying multiple repos, separate them with a ",".
77
-+    type: list
78
-+    elements: str
79
-+
80
-+  disablerepo:
81
-+    description:
82
-+      - I(Repoid) of repositories to disable for the install/update operation.
83
-+        When specifying multiple repos, separate them with a ",".
84
-+    type: list
85
-+    elements: str
86
-+
87
-+  conf_file:
88
-+    description:
89
-+      - The tdnf configuration file to use for the transaction.
90
-+    type: str
91
-+
92
-+  disable_gpg_check:
93
-+    description:
94
-+      - Whether to disable the GPG checking of signatures of packages being
95
-+        installed. Has an effect only if state is I(present) or I(latest).
96
-+    type: bool
97
-+    default: 'no'
98
-+
99
-+  installroot:
100
-+    description:
101
-+      - Specifies an alternative installroot, relative to which all packages
102
-+        will be installed.
103
-+    type: str
104
-+    default: '/'
105
-+
106
-+  security_severity:
107
-+    description:
108
-+      - Specifies the CVSS v3 score above which to install updates for packages
109
-+    type: str
110
-+
111
-+  releasever:
112
-+    description:
113
-+      - Specifies an alternative release from which all packages will be
114
-+        installed.
115
-+    type: str
116
-+
117
-+  exclude:
118
-+    description:
119
-+      - Package name(s) to exclude when state=present, or latest. This can be a
120
-+        list or a comma separated string.
121
-+    type: list
122
-+    elements: str
123
-+
124
-+author:
125
-+  - Anish Swaminathan (@suezzelur) <anishs@vmware.com>
126
-+  - Shreenidhi Shedi (@sshedi) <sshedi@vmware.com>
127
-+
128
-+notes:
129
-+  - '"name" and "upgrade" are mutually exclusive.'
130
-+  - When used with a `loop:` each package will be processed individually, it is much more efficient to pass the list directly to the `name` option.
131
-+'''
132
-+
133
-+EXAMPLES = '''
134
-+# Update repositories and install "foo" package
135
-+- tdnf:
136
-+    name: ['foo']
137
-+    update_cache: yes
138
-+
139
-+# Update repositories and install "foo" and "bar" packages
140
-+- tdnf:
141
-+    name: ['foo', 'bar']
142
-+    update_cache: yes
143
-+
144
-+# Remove "foo" package
145
-+- tdnf:
146
-+    name: ['foo']
147
-+    state: absent
148
-+
149
-+# Remove "foo" and "bar" packages
150
-+- tdnf:
151
-+    name: ['foo', 'bar']
152
-+    state: absent
153
-+
154
-+# Install the package "foo"
155
-+- tdnf:
156
-+    name: ['foo']
157
-+    state: present
158
-+
159
-+# Install the packages "foo" and "bar"
160
-+- tdnf:
161
-+    name: ['foo', 'bar']
162
-+    state: present
163
-+
164
-+# Update repositories and update package "foo" to latest version
165
-+- tdnf:
166
-+    name: ['foo']
167
-+    state: latest
168
-+    update_cache: yes
169
-+
170
-+# Update repositories and update packages "foo" and "bar" to latest versions
171
-+- tdnf:
172
-+    name: ['foo', 'bar']
173
-+    state: latest
174
-+    update_cache: yes
175
-+
176
-+# Update all installed packages to the latest versions
177
-+- tdnf:
178
-+    upgrade: yes
179
-+
180
-+# Update repositories as a separate step
181
-+- tdnf:
182
-+    update_cache: yes
183
-+'''
184
-+
185
-+RETURN = '''
186
-+stdout:
187
-+    description: output from tdnf
188
-+    returned: success, when needed
189
-+    type: str
190
-+stderr:
191
-+    description: error output from tdnf
192
-+    returned: success, when needed
193
-+    type: str
194
-+rc:
195
-+    description: tdnf command return value
196
-+    returned: 0 on success
197
-+    type: int
198
-+'''
199
-+
200
-+from ansible.module_utils.basic import AnsibleModule
201
-+
202
-+
203
-+def prep_tdnf_cmd(cmd, p_dict):
204
-+    ''' Prepare tdnf command based on given configs '''
205
-+    if p_dict['excludelist']:
206
-+        cmd = '%s --exclude %s' % (cmd, ','.join(p_dict['excludelist']))
207
-+
208
-+    if p_dict['disable_gpg_check']:
209
-+        cmd = '%s --nogpgcheck' % cmd
210
-+
211
-+    if p_dict['releasever']:
212
-+        cmd = '%s --releasever %s' % (cmd, p_dict['releasever'])
213
-+
214
-+    if p_dict['conf_file']:
215
-+        cmd = '%s -c %s' % (cmd, p_dict['conf_file'])
216
-+
217
-+    if p_dict['installroot'] != '/':
218
-+        cmd = '%s --installroot %s' % (cmd, p_dict['installroot'])
219
-+
220
-+    for repo in p_dict['enablerepolist']:
221
-+        cmd = '%s --enablerepo=%s' % (cmd, repo)
222
-+
223
-+    for repo in p_dict['disablerepolist']:
224
-+        cmd = '%s --disablerepo=%s' % (cmd, repo)
225
-+
226
-+    if p_dict['security_severity']:
227
-+        cmd = '%s --sec-severity %s' % (cmd, p_dict['security_severity'])
228
-+
229
-+    return cmd
230
-+
231
-+
232
-+def exec_cmd(module, params):
233
-+    '''
234
-+    Run the final command
235
-+    get_out is a special value from update_package_db
236
-+    if it's set, we just update the db cache and exit
237
-+    '''
238
-+    get_out = params.get('get_out', False)
239
-+    check_rc = params.get('check_rc', False)
240
-+
241
-+    rc, out, err = module.run_command(params['cmd'], check_rc=check_rc)
242
-+    if rc:
243
-+        module.fail_json(msg=params['msg_f'], stdout=out, stderr=err)
244
-+    elif ('get_out' not in params and rc == 0) or get_out:
245
-+        module.exit_json(changed=True, msg=params['msg_s'], stdout=out, stderr=err)
246
-+
247
-+
248
-+def update_package_db(module, get_out, p_dict):
249
-+    ''' Update tdnf cache metadata  '''
250
-+    cmd = '%s makecache --refresh -q' % (p_dict['tdnf'])
251
-+    cmd = prep_tdnf_cmd(cmd, p_dict)
252
-+
253
-+    params = {
254
-+        'cmd': cmd,
255
-+        'msg_s': 'Updated package db',
256
-+        'msg_f': 'Could not update package db',
257
-+        'get_out': get_out,
258
-+    }
259
-+    exec_cmd(module, params)
260
-+
261
-+
262
-+def upgrade_packages(module, p_dict):
263
-+    ''' Upgrade all packages  '''
264
-+    cmd = '%s upgrade -y' % (p_dict['tdnf'])
265
-+    cmd = prep_tdnf_cmd(cmd, p_dict)
266
-+    params = {
267
-+        'cmd': cmd,
268
-+        'msg_s': 'Upgraded packages',
269
-+        'msg_f': 'Failed to upgrade packages',
270
-+    }
271
-+
272
-+    exec_cmd(module, params)
273
-+
274
-+
275
-+def install_packages(module, p_dict):
276
-+    ''' Install given packages '''
277
-+    packages = ' '.join(p_dict['pkglist'])
278
-+    cmd = '%s install -y' % (p_dict['tdnf'])
279
-+    cmd = prep_tdnf_cmd(cmd, p_dict)
280
-+    cmd = '%s %s' % (cmd, packages)
281
-+
282
-+    params = {
283
-+        'cmd': cmd,
284
-+        'msg_s': 'Installed %s package(s)' % (packages),
285
-+        'msg_f': 'Failed to install %s' % (packages),
286
-+    }
287
-+
288
-+    exec_cmd(module, params)
289
-+
290
-+
291
-+def remove_packages(module, p_dict):
292
-+    ''' Erase/Uninstall packages '''
293
-+    packages = ' '.join(p_dict['pkglist'])
294
-+    cmd = '%s erase -y %s' % (p_dict['tdnf'], packages)
295
-+
296
-+    params = {
297
-+        'cmd': cmd,
298
-+        'msg_s': 'Removed %s package(s)' % (packages),
299
-+        'msg_f': 'Failed to remove %s package(s)' % (packages),
300
-+    }
301
-+
302
-+    exec_cmd(module, params)
303
-+
304
-+
305
-+def convert_to_list(input_list):
306
-+    ''' Convert nested list into flat list '''
307
-+    flat_list = []
308
-+
309
-+    for sublist in input_list:
310
-+        if not isinstance(sublist, list):
311
-+            flat_list.append(sublist)
312
-+            continue
313
-+        for item in sublist:
314
-+            flat_list.append(item)
315
-+
316
-+    return flat_list
317
-+
318
-+
319
-+def main():
320
-+    ''' Trigger point function '''
321
-+    choices = ['present', 'installed', 'absent', 'removed', 'latest']
322
-+    module = AnsibleModule(
323
-+        argument_spec=dict(
324
-+            state=dict(default='present', choices=choices),
325
-+            name=dict(type='list', elements='str', aliases=['pkg']),
326
-+            update_cache=dict(default=False, type='bool'),
327
-+            upgrade=dict(default=False, type='bool'),
328
-+            enablerepo=dict(type='list', default=[], elements='str'),
329
-+            disablerepo=dict(type='list', default=[], elements='str'),
330
-+            disable_gpg_check=dict(type='bool', default=False),
331
-+            exclude=dict(type='list', default=[], elements='str'),
332
-+            installroot=dict(type='str', default='/'),
333
-+            security_severity=dict(type='str', default=None),
334
-+            releasever=dict(default=None),
335
-+            conf_file=dict(type='str', default=None),
336
-+        ),
337
-+        required_one_of=[['name', 'update_cache', 'upgrade', 'security_severity']],
338
-+        mutually_exclusive=[['name', 'upgrade'], ['name', 'security_severity']],
339
-+        supports_check_mode=True
340
-+    )
341
-+
342
-+    # Set LANG env since we parse stdout
343
-+    module.run_command_environ_update = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C', LC_CTYPE='C')
344
-+
345
-+    p_dict = module.params
346
-+
347
-+    pkglist = convert_to_list(p_dict['name'])
348
-+    enablerepolist = convert_to_list(p_dict['enablerepo'])
349
-+    disablerepolist = convert_to_list(p_dict['disablerepo'])
350
-+    excludelist = convert_to_list(p_dict['exclude'])
351
-+
352
-+    p_dict['tdnf'] = module.get_bin_path('tdnf', required=True)
353
-+    p_dict['pkglist'] = pkglist
354
-+    p_dict['enablerepolist'] = enablerepolist
355
-+    p_dict['disablerepolist'] = disablerepolist
356
-+    p_dict['excludelist'] = excludelist
357
-+
358
-+    # normalize the state parameter
359
-+    if p_dict['state'] in ['present', 'installed', 'latest']:
360
-+        p_dict['state'] = 'present'
361
-+
362
-+    if p_dict['state'] in ['absent', 'removed']:
363
-+        p_dict['state'] = 'absent'
364
-+
365
-+    if p_dict['update_cache']:
366
-+        get_out = True
367
-+        for key in ['name', 'upgrade', 'security_severity']:
368
-+            if p_dict[key]:
369
-+                get_out = False
370
-+                break
371
-+        update_package_db(module, get_out, p_dict)
372
-+
373
-+    if p_dict['upgrade']:
374
-+        upgrade_packages(module, p_dict)
375
-+
376
-+    if p_dict['state'] == 'present':
377
-+        install_packages(module, p_dict)
378
-+    else:
379
-+        remove_packages(module, p_dict)
380
-+
381
-+
382
-+if __name__ == '__main__':
383
-+    main()
384
-2.25.1
385
-
... ...
@@ -1,8 +1,6 @@
1
-%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
-
3 1
 Summary:        Configuration-management, application deployment, cloud provisioning system
4 2
 Name:           ansible
5
-Version:        2.9.27
3
+Version:        2.13.3
6 4
 Release:        1%{?dist}
7 5
 License:        GPLv3+
8 6
 URL:            https://www.ansible.com
... ...
@@ -10,49 +8,51 @@ Group:          Development/Libraries
10 10
 Vendor:         VMware, Inc.
11 11
 Distribution:   Photon
12 12
 
13
-Source0:        http://releases.ansible.com/ansible/%{name}-%{version}.tar.gz
14
-%define sha512 %{name}=99987b8a1d243ef3496d66178774c33b05951daaff584b12e645c0176391805f90d00780e86adec01316b28645287489326218c0de7c10084552da90848735c7
15
-
16
-Patch0:         Add-Photon-OS-tdnf-support.patch
13
+Source0: http://releases.ansible.com/ansible/%{name}-%{version}.tar.gz
14
+%define sha512 %{name}=06d3e322980eb61b0f73b93b43d0bf3b5542feacbf11e8dc7862150f13bcc3c46d7f7a34ca1866cd6f4a09881e464a63714e9e645ca1367cee05dd192f375c4b
17 15
 
18
-BuildArch:      noarch
16
+Source1: tdnf.py
19 17
 
20
-BuildRequires:  python3
21
-BuildRequires:  python3-libs
22
-BuildRequires:  python3-setuptools
23
-BuildRequires:  python3-resolvelib
18
+BuildArch: noarch
24 19
 
25
-Requires:       python3
26
-Requires:       python3-libs
27
-Requires:       python3-jinja2
28
-Requires:       python3-PyYAML
29
-Requires:       python3-xml
30
-Requires:       python3-paramiko
31
-Requires:       python3-resolvelib
20
+BuildRequires: python3-devel
21
+BuildRequires: python3-setuptools
22
+BuildRequires: python3-resolvelib
32 23
 
33
-%if %{with_check}
34
-BuildRequires:  python3-devel
35
-BuildRequires:  python3-pip
36
-BuildRequires:  python3-cryptography
37
-BuildRequires:  python3-PyYAML
38
-BuildRequires:  python3-jinja2
24
+%if 0%{?with_check}
25
+BuildRequires: python3-pip
26
+BuildRequires: python3-jinja2 >= 3.1.2
27
+BuildRequires: python3-PyYAML
28
+BuildRequires: python3-pytest
29
+BuildRequires: python3-cryptography
39 30
 %endif
40 31
 
32
+Requires: python3
33
+Requires: python3-jinja2 >= 3.1.2
34
+Requires: python3-PyYAML
35
+Requires: python3-xml
36
+Requires: python3-paramiko
37
+Requires: python3-resolvelib
38
+
41 39
 %description
42 40
 Ansible is a radically simple IT automation system. It handles configuration-management, application deployment, cloud provisioning, ad-hoc task-execution, and multinode orchestration - including trivializing things like zero downtime rolling updates with load balancers.
43 41
 
44 42
 %prep
45 43
 %autosetup -p1
44
+cp -vp %{SOURCE1} lib/%{name}/modules/
46 45
 
47 46
 %build
48
-python3 setup.py build
47
+%py3_build
49 48
 
50 49
 %install
51
-%{__rm} -rf %{buildroot}
52
-python3 setup.py install -O1 --skip-build --root "%{buildroot}"
50
+%py3_install
53 51
 
52
+%if 0%{?with_check}
54 53
 %check
55
-python3 setup.py test
54
+# make check is unstable at the moment
55
+#pip3 install pytest-forked
56
+#make tests-py3 %%{?_smp_mflags}
57
+%endif
56 58
 
57 59
 %files
58 60
 %defattr(-, root, root)
... ...
@@ -60,6 +60,8 @@ python3 setup.py test
60 60
 %{python3_sitelib}/*
61 61
 
62 62
 %changelog
63
+* Sat Sep 03 2022 Shreenidhi Shedi <sshedi@vmware.com> 2.13.3-1
64
+- Upgrade to v2.13.3
63 65
 * Mon Apr 18 2022 Gerrit Photon <photon-checkins@vmware.com> 2.9.27-1
64 66
 - Automatic Version Bump
65 67
 * Fri Dec 10 2021 Shreenidhi Shedi <sshedi@vmware.com> 2.12.1-1
66 68
new file mode 100644
... ...
@@ -0,0 +1,368 @@
0
+#!/usr/bin/python3
1
+# -*- coding: utf-8 -*-
2
+
3
+# Copyright (C) 2021 VMware, Inc. All Rights Reserved.
4
+#
5
+# GNU General Public License v3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
6
+#
7
+
8
+""" tdnf ansible module for Photon OS  """
9
+
10
+from __future__ import absolute_import, division, print_function
11
+
12
+__metaclass__ = type
13
+
14
+
15
+DOCUMENTATION = """
16
+---
17
+module: tdnf
18
+short_description: Tiny DNF package manager
19
+description:
20
+  - Manages rpm packages in VMware Photon OS.
21
+version_added: "2.12.1"
22
+options:
23
+  name:
24
+    description:
25
+      - A package name, like C(foo), or multiple packages, like C(foo, bar).
26
+    aliases:
27
+      - pkg
28
+    type: list
29
+    elements: str
30
+
31
+  state:
32
+    description:
33
+      - Indicates the desired package(s) state.
34
+      - C(present) ensures the package(s) is/are present.
35
+      - C(absent) ensures the package(s) is/are absent.
36
+      - C(latest) ensures the package(s) is/are present and the latest version(s).
37
+      - C(removed) ensures the package(s) is/are removed.
38
+      - C(installed) ensures the package(s) is/are installed.
39
+    type: str
40
+    default: present
41
+    choices: ['present', 'installed', 'absent', 'removed', 'latest']
42
+
43
+  update_cache:
44
+    description:
45
+      - Update repo metadata cache. Can be run with other steps or on it's own.
46
+    type: bool
47
+    default: 'no'
48
+
49
+  upgrade:
50
+    description:
51
+      - Upgrade all installed packages to their latest version.
52
+    type: bool
53
+    default: 'no'
54
+
55
+  enablerepo:
56
+    description:
57
+      - I(Repoid) of repositories to enable for the install/update operation.
58
+        When specifying multiple repos, separate them with a ",".
59
+    type: list
60
+    elements: str
61
+
62
+  disablerepo:
63
+    description:
64
+      - I(Repoid) of repositories to disable for the install/update operation.
65
+        When specifying multiple repos, separate them with a ",".
66
+    type: list
67
+    elements: str
68
+
69
+  conf_file:
70
+    description:
71
+      - The tdnf configuration file to use for the transaction.
72
+    type: str
73
+
74
+  disable_gpg_check:
75
+    description:
76
+      - Whether to disable the GPG checking of signatures of packages being
77
+        installed. Has an effect only if state is I(present) or I(latest).
78
+    type: bool
79
+    default: 'no'
80
+
81
+  installroot:
82
+    description:
83
+      - Specifies an alternative installroot, relative to which all packages
84
+        will be installed.
85
+    type: str
86
+    default: '/'
87
+
88
+  security_severity:
89
+    description:
90
+      - Specifies the CVSS v3 score above which to install updates for packages
91
+    type: str
92
+
93
+  releasever:
94
+    description:
95
+      - Specifies an alternative release from which all packages will be
96
+        installed.
97
+    type: str
98
+
99
+  exclude:
100
+    description:
101
+      - Package name(s) to exclude when state=present, or latest. This can be a
102
+        list or a comma separated string.
103
+    type: list
104
+    elements: str
105
+
106
+author:
107
+  - Anish Swaminathan (@suezzelur) <anishs@vmware.com>
108
+  - Shreenidhi Shedi (@sshedi) <sshedi@vmware.com>
109
+
110
+notes:
111
+  - '"name" and "upgrade" are mutually exclusive.'
112
+  - When used with a `loop:` each package will be processed individually, it is much more efficient to pass the list directly to the `name` option.
113
+"""
114
+
115
+EXAMPLES = """
116
+# Update repositories and install "foo" package
117
+- tdnf:
118
+    name: ['foo']
119
+    update_cache: yes
120
+
121
+# Update repositories and install "foo" and "bar" packages
122
+- tdnf:
123
+    name: ['foo', 'bar']
124
+    update_cache: yes
125
+
126
+# Remove "foo" package
127
+- tdnf:
128
+    name: ['foo']
129
+    state: absent
130
+
131
+# Remove "foo" and "bar" packages
132
+- tdnf:
133
+    name: ['foo', 'bar']
134
+    state: absent
135
+
136
+# Install the package "foo"
137
+- tdnf:
138
+    name: ['foo']
139
+    state: present
140
+
141
+# Install the packages "foo" and "bar"
142
+- tdnf:
143
+    name: ['foo', 'bar']
144
+    state: present
145
+
146
+# Update repositories and update package "foo" to latest version
147
+- tdnf:
148
+    name: ['foo']
149
+    state: latest
150
+    update_cache: yes
151
+
152
+# Update repositories and update packages "foo" and "bar" to latest versions
153
+- tdnf:
154
+    name: ['foo', 'bar']
155
+    state: latest
156
+    update_cache: yes
157
+
158
+# Update all installed packages to the latest versions
159
+- tdnf:
160
+    upgrade: yes
161
+
162
+# Update repositories as a separate step
163
+- tdnf:
164
+    update_cache: yes
165
+"""
166
+
167
+RETURN = """
168
+stdout:
169
+    description: output from tdnf
170
+    returned: success, when needed
171
+    type: str
172
+stderr:
173
+    description: error output from tdnf
174
+    returned: success, when needed
175
+    type: str
176
+rc:
177
+    description: tdnf command return value
178
+    returned: 0 on success
179
+    type: int
180
+"""
181
+
182
+from ansible.module_utils.basic import AnsibleModule
183
+
184
+
185
+def prep_tdnf_cmd(cmd, p_dict):
186
+    """Prepare tdnf command based on given configs"""
187
+    if p_dict["excludelist"]:
188
+        cmd = "%s --exclude %s" % (cmd, ",".join(p_dict["excludelist"]))
189
+
190
+    if p_dict["disable_gpg_check"]:
191
+        cmd = "%s --nogpgcheck" % cmd
192
+
193
+    if p_dict["releasever"]:
194
+        cmd = "%s --releasever %s" % (cmd, p_dict["releasever"])
195
+
196
+    if p_dict["conf_file"]:
197
+        cmd = "%s -c %s" % (cmd, p_dict["conf_file"])
198
+
199
+    if p_dict["installroot"] != "/":
200
+        cmd = "%s --installroot %s" % (cmd, p_dict["installroot"])
201
+
202
+    for repo in p_dict["enablerepolist"]:
203
+        cmd = "%s --enablerepo=%s" % (cmd, repo)
204
+
205
+    for repo in p_dict["disablerepolist"]:
206
+        cmd = "%s --disablerepo=%s" % (cmd, repo)
207
+
208
+    if p_dict["security_severity"]:
209
+        cmd = "%s --sec-severity %s" % (cmd, p_dict["security_severity"])
210
+
211
+    return cmd
212
+
213
+
214
+def exec_cmd(module, params):
215
+    """
216
+    Run the final command
217
+    get_out is a special value from update_package_db
218
+    if it's set, we just update the db cache and exit
219
+    """
220
+    get_out = params.get("get_out", False)
221
+    check_rc = params.get("check_rc", False)
222
+
223
+    rc, out, err = module.run_command(params["cmd"], check_rc=check_rc)
224
+    if rc:
225
+        module.fail_json(msg=params["msg_f"], stdout=out, stderr=err)
226
+    elif ("get_out" not in params and rc == 0) or get_out:
227
+        module.exit_json(changed=True, msg=params["msg_s"], stdout=out, stderr=err)
228
+
229
+
230
+def update_package_db(module, get_out, p_dict):
231
+    """Update tdnf cache metadata"""
232
+    cmd = "%s makecache --refresh -q" % (p_dict["tdnf"])
233
+    cmd = prep_tdnf_cmd(cmd, p_dict)
234
+
235
+    params = {
236
+        "cmd": cmd,
237
+        "msg_s": "Updated package db",
238
+        "msg_f": "Could not update package db",
239
+        "get_out": get_out,
240
+    }
241
+    exec_cmd(module, params)
242
+
243
+
244
+def upgrade_packages(module, p_dict):
245
+    """Upgrade all packages"""
246
+    cmd = "%s upgrade -y" % (p_dict["tdnf"])
247
+    cmd = prep_tdnf_cmd(cmd, p_dict)
248
+    params = {
249
+        "cmd": cmd,
250
+        "msg_s": "Upgraded packages",
251
+        "msg_f": "Failed to upgrade packages",
252
+    }
253
+
254
+    exec_cmd(module, params)
255
+
256
+
257
+def install_packages(module, p_dict):
258
+    """Install given packages"""
259
+    packages = " ".join(p_dict["pkglist"])
260
+    cmd = "%s install -y" % (p_dict["tdnf"])
261
+    cmd = prep_tdnf_cmd(cmd, p_dict)
262
+    cmd = "%s %s" % (cmd, packages)
263
+
264
+    params = {
265
+        "cmd": cmd,
266
+        "msg_s": "Installed %s package(s)" % (packages),
267
+        "msg_f": "Failed to install %s" % (packages),
268
+    }
269
+
270
+    exec_cmd(module, params)
271
+
272
+
273
+def remove_packages(module, p_dict):
274
+    """Erase/Uninstall packages"""
275
+    packages = " ".join(p_dict["pkglist"])
276
+    cmd = "%s erase -y %s" % (p_dict["tdnf"], packages)
277
+
278
+    params = {
279
+        "cmd": cmd,
280
+        "msg_s": "Removed %s package(s)" % (packages),
281
+        "msg_f": "Failed to remove %s package(s)" % (packages),
282
+    }
283
+
284
+    exec_cmd(module, params)
285
+
286
+
287
+def convert_to_list(input_list):
288
+    """Convert nested list into flat list"""
289
+    flat_list = []
290
+
291
+    for sublist in input_list:
292
+        if not isinstance(sublist, list):
293
+            flat_list.append(sublist)
294
+            continue
295
+        for item in sublist:
296
+            flat_list.append(item)
297
+
298
+    return flat_list
299
+
300
+
301
+def main():
302
+    """Trigger point function"""
303
+    choices = ["present", "installed", "absent", "removed", "latest"]
304
+    module = AnsibleModule(
305
+        argument_spec=dict(
306
+            state=dict(default="present", choices=choices),
307
+            name=dict(type="list", elements="str", aliases=["pkg"]),
308
+            update_cache=dict(default=False, type="bool"),
309
+            upgrade=dict(default=False, type="bool"),
310
+            enablerepo=dict(type="list", default=[], elements="str"),
311
+            disablerepo=dict(type="list", default=[], elements="str"),
312
+            disable_gpg_check=dict(type="bool", default=False),
313
+            exclude=dict(type="list", default=[], elements="str"),
314
+            installroot=dict(type="str", default="/"),
315
+            security_severity=dict(type="str", default=None),
316
+            releasever=dict(default=None),
317
+            conf_file=dict(type="str", default=None),
318
+        ),
319
+        required_one_of=[["name", "update_cache", "upgrade", "security_severity"]],
320
+        mutually_exclusive=[["name", "upgrade"], ["name", "security_severity"]],
321
+        supports_check_mode=True,
322
+    )
323
+
324
+    # Set LANG env since we parse stdout
325
+    module.run_command_environ_update = dict(
326
+        LANG="C", LC_ALL="C", LC_MESSAGES="C", LC_CTYPE="C"
327
+    )
328
+
329
+    p_dict = module.params
330
+
331
+    pkglist = convert_to_list(p_dict["name"])
332
+    enablerepolist = convert_to_list(p_dict["enablerepo"])
333
+    disablerepolist = convert_to_list(p_dict["disablerepo"])
334
+    excludelist = convert_to_list(p_dict["exclude"])
335
+
336
+    p_dict["tdnf"] = module.get_bin_path("tdnf", required=True)
337
+    p_dict["pkglist"] = pkglist
338
+    p_dict["enablerepolist"] = enablerepolist
339
+    p_dict["disablerepolist"] = disablerepolist
340
+    p_dict["excludelist"] = excludelist
341
+
342
+    # normalize the state parameter
343
+    if p_dict["state"] in ["present", "installed", "latest"]:
344
+        p_dict["state"] = "present"
345
+
346
+    if p_dict["state"] in ["absent", "removed"]:
347
+        p_dict["state"] = "absent"
348
+
349
+    if p_dict["update_cache"]:
350
+        get_out = True
351
+        for key in ["name", "upgrade", "security_severity"]:
352
+            if p_dict[key]:
353
+                get_out = False
354
+                break
355
+        update_package_db(module, get_out, p_dict)
356
+
357
+    if p_dict["upgrade"]:
358
+        upgrade_packages(module, p_dict)
359
+
360
+    if p_dict["state"] == "present":
361
+        install_packages(module, p_dict)
362
+    else:
363
+        remove_packages(module, p_dict)
364
+
365
+
366
+if __name__ == "__main__":
367
+    main()
... ...
@@ -1,43 +1,47 @@
1
-%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
-%{!?python3_version: %define python3_version %(python3 -c "import sys; sys.stdout.write(sys.version[:3])")}
3
-
1
+Summary:        A fast and easy to use template engine written in pure Python
4 2
 Name:           python3-jinja2
5
-Version:        2.11.2
3
+Version:        3.1.2
6 4
 Release:        1%{?dist}
7
-Url:            http://jinja.pocoo.org/
8
-Summary:        A fast and easy to use template engine written in pure Python
9 5
 License:        BSD
10 6
 Group:          Development/Languages/Python
11 7
 Vendor:         VMware, Inc.
12 8
 Distribution:   Photon
13
-Source0:        https://pypi.python.org/packages/71/59/d7423bd5e7ddaf3a1ce299ab4490e9044e8dfd195420fc83a24de9e60726/Jinja2-%{version}.tar.gz
14
-%define sha1    Jinja2=1017138fd4cb627204d3109b75c107c3d6f3f7fb
15
-BuildRequires:  python3
16
-BuildRequires:  python3-libs
17
-BuildRequires:  python3-setuptools
18
-BuildRequires:  python3-markupsafe
19
-Requires:       python3
20
-Requires:       python3-libs
21
-Requires:       python3-markupsafe
22
-BuildArch:      noarch
9
+URL:            https://github.com/pallets/jinja
23 10
 
24
-%description
25
-Jinja2 is a template engine written in pure Python.  It provides a Django
26
-inspired non-XML syntax but supports inline expressions and an optional
27
-sandboxed environment.
11
+Source0: https://github.com/pallets/jinja/archive/refs/tags/jinja-%{version}.tar.gz
12
+%define sha512 jinja=50feebc7eed4c8b5bb0c2951784c1c115e3ee1c0e0c91bbf1884551b1312ef8fce24804a2ca1dfd8c543406529afe4817567c39e7cfd15028b54049853623144
13
+
14
+BuildRequires: python3-devel
15
+BuildRequires: python3-setuptools
16
+BuildRequires: python3-markupsafe >= 2.1.1
28 17
 
18
+%if 0%{?with_check}
19
+BuildRequires: python3-pytest
20
+%endif
21
+
22
+Requires: python3
23
+Requires: python3-markupsafe >= 2.1.1
24
+
25
+BuildArch: noarch
26
+
27
+%description
28
+Jinja2 is a template engine written in pure Python.
29
+It provides a Django inspired non-XML syntax but supports inline
30
+expressions and an optional sandboxed environment.
29 31
 
30 32
 %prep
31
-%setup -q -n Jinja2-%{version}
33
+%autosetup -p1 -n jinja-%{version}
32 34
 
33 35
 %build
34
-python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
36
+%py3_build
35 37
 
36 38
 %install
37
-python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
39
+%py3_install
38 40
 
41
+%if 0%{?with_check}
39 42
 %check
40
-make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
43
+%pytest tests
44
+%endif
41 45
 
42 46
 %files
43 47
 %defattr(-,root,root,-)
... ...
@@ -45,23 +49,25 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
45 45
 %{python3_sitelib}/Jinja2-%{version}-py%{python3_version}.egg-info
46 46
 
47 47
 %changelog
48
-*   Tue Sep 01 2020 Gerrit Photon <photon-checkins@vmware.com> 2.11.2-1
49
--   Automatic Version Bump
50
-*   Fri Jun 19 2020 Tapas Kundu <tkundu@vmware.com> 2.10-2
51
--   Mass removal python2
52
-*   Sun Sep 09 2018 Tapas Kundu <tkundu@vmware.com> 2.10-1
53
--   Update to version 2.10
54
-*   Tue Jun 20 2017 Xiaolin Li <xiaolinl@vmware.com> 2.9.5-6
55
--   Add python3-setuptools and python3-xml to python3 sub package Buildrequires.
56
-*   Thu Jun 15 2017 Dheeraj Shetty <dheerajs@vmware.com> 2.9.5-5
57
--   Change python to python2
58
-*   Mon Jun 12 2017 Kumar Kaushik <kaushikk@vmware.com> 2.9.5-4
59
--   Fixing import error in python3.
60
-*   Wed Apr 26 2017 Dheeraj Shetty <dheerajs@vmware.com> 2.9.5-3
61
--   BuildRequires python-markupsafe , creating subpackage python3-jinja2
62
-*   Tue Apr 25 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.9.5-2
63
--   Fix arch
64
-*   Mon Mar 27 2017 Sarah Choi <sarahc@vmware.com> 2.9.5-1
65
--   Upgrade version to 2.9.5
66
-*   Tue Dec 13 2016 Dheeraj Shetty <dheerajs@vmware.com> 2.8-1
67
--   Initial packaging for Photon
48
+* Mon Sep 05 2022 Shreenidhi Shedi <sshedi@vmware.com> 3.1.2-1
49
+- Upgrade to v3.1.2, needed for ansible-2.13.3
50
+* Tue Sep 01 2020 Gerrit Photon <photon-checkins@vmware.com> 2.11.2-1
51
+- Automatic Version Bump
52
+* Fri Jun 19 2020 Tapas Kundu <tkundu@vmware.com> 2.10-2
53
+- Mass removal python2
54
+* Sun Sep 09 2018 Tapas Kundu <tkundu@vmware.com> 2.10-1
55
+- Update to version 2.10
56
+* Tue Jun 20 2017 Xiaolin Li <xiaolinl@vmware.com> 2.9.5-6
57
+- Add python3-setuptools and python3-xml to python3 sub package Buildrequires.
58
+* Thu Jun 15 2017 Dheeraj Shetty <dheerajs@vmware.com> 2.9.5-5
59
+- Change python to python2
60
+* Mon Jun 12 2017 Kumar Kaushik <kaushikk@vmware.com> 2.9.5-4
61
+- Fixing import error in python3.
62
+* Wed Apr 26 2017 Dheeraj Shetty <dheerajs@vmware.com> 2.9.5-3
63
+- BuildRequires python-markupsafe , creating subpackage python3-jinja2
64
+* Tue Apr 25 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.9.5-2
65
+- Fix arch
66
+* Mon Mar 27 2017 Sarah Choi <sarahc@vmware.com> 2.9.5-1
67
+- Upgrade version to 2.9.5
68
+* Tue Dec 13 2016 Dheeraj Shetty <dheerajs@vmware.com> 2.8-1
69
+- Initial packaging for Photon
... ...
@@ -1,56 +1,63 @@
1
-%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
-
3 1
 Summary:        A XML/HTML/XHTML Markup safe string for Python.
4 2
 Name:           python3-markupsafe
5
-Version:        1.1.1
3
+Version:        2.1.1
6 4
 Release:        1%{?dist}
7 5
 License:        BSD
8 6
 Group:          Development/Languages/Python
9 7
 Vendor:         VMware, Inc.
10 8
 Distribution:   Photon
11
-Url:            https://pypi.python.org/pypi/MarkupSafe
12
-Source0:        https://pypi.python.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-%{version}.tar.gz
13
-%define sha1    MarkupSafe=f70e5fd3c120a1b108d4347ea1115e3962c42026
14
-
15
-BuildRequires:  python3
16
-BuildRequires:  python3-devel
17
-BuildRequires:  python3-libs
18
-BuildRequires:  python3-setuptools
19
-BuildRequires:  python3-xml
20
-Requires:       python3
21
-Requires:       python3-libs
9
+URL:            https://github.com/pallets/markupsafe
10
+
11
+Source0: https://github.com/pallets/markupsafe/archive/refs/tags/markupsafe-%{version}.tar.gz
12
+%define sha512 markupsafe=6b06a5f470858409eb186d20edd129be90f31030be91fcc73e989b0a4ee51c3755cce0938edd9a7c73471d307385260f868101b5e11cc4d97c309420b5a573da
13
+
14
+BuildRequires: python3-devel
15
+BuildRequires: python3-setuptools
16
+BuildRequires: python3-xml
17
+
18
+%if 0%{?with_check}
19
+BuildRequires: python3-pytest
20
+%endif
21
+
22
+Requires: python3
22 23
 
23 24
 %description
24 25
 MarkupSafe implements a XML/HTML/XHTML Markup safe string for Python.
25 26
 
26
-
27 27
 %prep
28
-%setup -q -n MarkupSafe-%{version}
28
+%autosetup -p1 -n markupsafe-%{version}
29 29
 
30 30
 %build
31
-python3 setup.py build
31
+%py3_build
32 32
 
33 33
 %install
34
-python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
34
+%py3_install
35
+rm %{buildroot}%{python3_sitearch}/markupsafe/*.c
36
+
37
+%clean
38
+rm -rf %{buildroot}
35 39
 
40
+%if 0%{?with_check}
36 41
 %check
37
-easy_install py
38
-python3 setup.py test
42
+%pytest
43
+%endif
39 44
 
40 45
 %files
41 46
 %defattr(-,root,root,-)
42 47
 %{python3_sitelib}/*
43 48
 
44 49
 %changelog
45
-*   Sun Jul 26 2020 Tapas Kundu <tkundu@vmware.com> 1.1.1-1
46
--   Update to 1.1.1
47
-*   Fri Jun 19 2020 Tapas Kundu <tkundu@vmware.com> 1.0-4
48
--   Mass removal python2
49
-*   Wed Jun 07 2017 Xiaolin Li <xiaolinl@vmware.com> 1.0-3
50
--   Add python3-setuptools and python3-xml to python3 sub package Buildrequires.
51
-*   Thu Jun 01 2017 Dheeraj Shetty <dheerajs@vmware.com> 1.0-2
52
--   Removed erroneous version line
53
-*   Thu Mar 30 2017 Sarah Choi <sarahc@vmware.com> 1.0-1
54
--   Upgrade version to 1.0
55
-*   Thu Mar 02 2017 Xiaolin Li <xiaolinl@vmware.com> 0.23-1
56
--   Initial packaging for Photon
50
+* Mon Sep 05 2022 Shreenidhi Shedi <sshedi@vmware.com> 2.1.1-1
51
+- Upgrade to 2.1.1, required for python3-jinja2
52
+* Sun Jul 26 2020 Tapas Kundu <tkundu@vmware.com> 1.1.1-1
53
+- Update to 1.1.1
54
+* Fri Jun 19 2020 Tapas Kundu <tkundu@vmware.com> 1.0-4
55
+- Mass removal python2
56
+* Wed Jun 07 2017 Xiaolin Li <xiaolinl@vmware.com> 1.0-3
57
+- Add python3-setuptools and python3-xml to python3 sub package Buildrequires.
58
+* Thu Jun 01 2017 Dheeraj Shetty <dheerajs@vmware.com> 1.0-2
59
+- Removed erroneous version line
60
+* Thu Mar 30 2017 Sarah Choi <sarahc@vmware.com> 1.0-1
61
+- Upgrade version to 1.0
62
+* Thu Mar 02 2017 Xiaolin Li <xiaolinl@vmware.com> 0.23-1
63
+- Initial packaging for Photon
... ...
@@ -1,18 +1,16 @@
1 1
 Summary:       Python documentation generator
2 2
 Name:          python3-sphinx
3
-Version:       3.3.0
4
-Release:       3%{?dist}
3
+Version:       5.1.1
4
+Release:       1%{?dist}
5 5
 Group:         Development/Tools
6 6
 License:       BSD-2-Clause
7
-URL:           http://www.vmware.com
7
+URL:           www.sphinx-doc.org
8 8
 Vendor:        VMware, Inc.
9 9
 Distribution:  Photon
10 10
 
11
-Source0:       https://pypi.python.org/packages/a7/df/4487783152b14f2b7cd0b0c9afb119b262c584bf972b90ab544b61b74c62/Sphinx-%{version}.tar.gz
12
-%define sha1   Sphinx=15924dc4fce887ce7d42900d82b77ada2c360ad8
11
+Source0: https://github.com/sphinx-doc/sphinx/archive/refs/tags/Sphinx-%{version}.tar.gz
12
+%define sha512 Sphinx=82cb4c435b0f6cee6bf80b81028f06e425e3d6fb5614e64b1f5a8c715ece80b697b5b55e04f3afe26236bb4590de9cd41008d6480c4b3d895803d83e914afff3
13 13
 
14
-BuildRequires: python3
15
-BuildRequires: python3-libs
16 14
 BuildRequires: python3-devel
17 15
 BuildRequires: python3-setuptools
18 16
 BuildRequires: python3-babel
... ...
@@ -33,9 +31,8 @@ BuildRequires: python3-sphinxcontrib-qthelp
33 33
 BuildRequires: python3-sphinxcontrib-htmlhelp
34 34
 BuildRequires: python3-sphinxcontrib-jsmath
35 35
 BuildRequires: python3-sphinxcontrib-serializinghtml
36
-BuildRequires: python3-packaging
37 36
 
38
-%if 0%{?with_check:1}
37
+%if 0%{?with_check}
39 38
 BuildRequires: python3-pytest
40 39
 %endif
41 40
 
... ...
@@ -47,7 +44,6 @@ Requires:      python3-sphinxcontrib-jsmath
47 47
 Requires:      python3-sphinxcontrib-serializinghtml
48 48
 Requires:      python3-packaging
49 49
 Requires:      python3
50
-Requires:      python3-libs
51 50
 Requires:      python3-babel
52 51
 Requires:      python3-docutils
53 52
 Requires:      python3-jinja2
... ...
@@ -82,11 +78,14 @@ mv %{buildroot}%{_bindir}/sphinx-build %{buildroot}%{_bindir}/sphinx-build3
82 82
 mv %{buildroot}%{_bindir}/sphinx-autogen %{buildroot}%{_bindir}/sphinx-autogen3
83 83
 mv %{buildroot}%{_bindir}/sphinx-apidoc %{buildroot}%{_bindir}/sphinx-apidoc3
84 84
 
85
-%if 0%{?with_check:1}
86
-make -k check %{?_smp_mflags} |& tee %{_specdir}/%{name}-check-log || %{nocheck}
85
+%if 0%{?with_check}
86
+%check
87
+pip3 install html5lib
88
+%pytest
87 89
 %endif
88 90
 
89 91
 %clean
92
+rm -rf %{buildroot}
90 93
 
91 94
 %files
92 95
 %defattr(-,root,root)
... ...
@@ -97,6 +96,8 @@ make -k check %{?_smp_mflags} |& tee %{_specdir}/%{name}-check-log || %{nocheck}
97 97
 %{python3_sitelib}/*
98 98
 
99 99
 %changelog
100
+* Mon Sep 05 2022 Shreenidhi Shedi <sshedi@vmware.com> 5.1.1-1
101
+- Upgrade to v5.1.1
100 102
 * Thu Oct 28 2021 Shreenidhi Shedi <sshedi@vmware.com> 3.3.0-3
101 103
 - Bump version as a part of python-babel upgrade
102 104
 * Tue Dec 15 2020 Shreenidhi Shedi <sshedi@vmware.com> 3.3.0-2
103 105
new file mode 100644
... ...
@@ -0,0 +1,31 @@
0
+From 248ff52b3c3d39c20cdaef3052ac7507a407733a Mon Sep 17 00:00:00 2001
1
+From: Takeshi KOMIYA <i.tkomiya@gmail.com>
2
+Date: Sat, 17 Jul 2021 18:55:20 +0900
3
+Subject: [PATCH] Fix #9457: RemovedInSphinx50Warning on testing
4
+
5
+---
6
+ tests/test_htmlhelp.py | 4 ++--
7
+ 1 file changed, 2 insertions(+), 2 deletions(-)
8
+
9
+diff --git a/tests/test_htmlhelp.py b/tests/test_htmlhelp.py
10
+index a74c66a..8774d4b 100644
11
+--- a/tests/test_htmlhelp.py
12
+@@ -21,7 +21,7 @@
13
+ def test_build_htmlhelp(app, status, warning):
14
+     app.build()
15
+ 
16
+-    hhp = (app.outdir / 'pythondoc.hhp').text()
17
++    hhp = (app.outdir / 'pythondoc.hhp').read_text()
18
+     assert 'Compiled file=pythondoc.chm' in hhp
19
+     assert 'Contents file=pythondoc.hhc' in hhp
20
+     assert 'Default Window=pythondoc' in hhp
21
+@@ -84,7 +84,7 @@ def assert_sitemap(node, name, filename):
22
+         assert node[1].attrib == {'name': 'Local', 'value': filename}
23
+ 
24
+     # .hhc file
25
+-    hhc = (app.outdir / 'pythondoc.hhc').text()
26
++    hhc = (app.outdir / 'pythondoc.hhc').read_text()
27
+     tree = HTMLParser(namespaceHTMLElements=False).parse(hhc)
28
+     items = tree.find('.//body/ul')
29
+     assert len(items) == 4
... ...
@@ -1,7 +1,5 @@
1
-%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
-
3 1
 Name:           python3-sphinxcontrib-htmlhelp
4
-Version:        1.0.3
2
+Version:        2.0.0
5 3
 Release:        1%{?dist}
6 4
 Summary:        A platform independent file lock
7 5
 License:        MIT
... ...
@@ -9,15 +7,26 @@ Group:          Development/Languages/Python
9 9
 Vendor:         VMware, Inc.
10 10
 Distribution:   Photon
11 11
 URL:            https://pypi.org/project/sphinxcontrib-htmlhelp
12
-Source0:        https://files.pythonhosted.org/packages/c9/2e/a7a5fef38327b7f643ed13646321d19903a2f54b0a05868e4bc34d729e1f/sphinxcontrib-htmlhelp-%{version}.tar.gz
13
-%define sha1    sphinxcontrib-htmlhelp=fc695250bc781777203b3a97a7aa7b0eab8a2c51
14
-BuildArch:      noarch
15 12
 
16
-BuildRequires:  python3
17
-BuildRequires:  python3-devel
18
-BuildRequires:  python3-setuptools
13
+Source0: https://files.pythonhosted.org/packages/eb/85/93464ac9bd43d248e7c74573d58a791d48c475230bcf000df2b2700b9027/sphinxcontrib-htmlhelp-%{version}.tar.gz
14
+%define sha512 sphinxcontrib-htmlhelp=6ed673966615f3e818e00de4b7e59c27f0a0d7b494294f804540777c580480870c36002c08d8ad626b7b41a676fe40edc0b0b5ffc6ad8080f38f59c24e157636
15
+
16
+%if 0%{?with_check}
17
+Patch0: fix-tests.patch
18
+%endif
19
+
20
+BuildArch: noarch
21
+
22
+BuildRequires: python3-devel
23
+BuildRequires: python3-setuptools
24
+
25
+%if 0%{?with_check}
26
+BuildRequires: python3-sphinx
27
+BuildRequires: python3-pytest
28
+BuildRequires: python3-pip
29
+%endif
19 30
 
20
-Requires:       python3
31
+Requires: python3
21 32
 
22 33
 Provides: python3.9dist(sphinxcontrib-htmlhelp)
23 34
 
... ...
@@ -32,13 +41,16 @@ the same lock object twice, it will not block.
32 32
 %autosetup -p1 -n sphinxcontrib-htmlhelp-%{version}
33 33
 
34 34
 %build
35
-python3 setup.py build
35
+%py3_build
36 36
 
37 37
 %install
38
-python3 setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
38
+%py3_install
39 39
 
40
+%if 0%{?with_check}
40 41
 %check
41
-%{__python3} test.py
42
+pip3 install html5lib
43
+%pytest
44
+%endif
42 45
 
43 46
 %files
44 47
 %defattr(-,root,root,-)
... ...
@@ -48,5 +60,7 @@ python3 setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
48 48
 %{python3_sitelib}/sphinxcontrib/
49 49
 
50 50
 %changelog
51
+* Mon Sep 05 2022 Shreenidhi Shedi <sshedi@vmware.com> 2.0.0-1
52
+- Upgrade to v2.0.0
51 53
 * Mon Dec 14 2020 Shreenidhi Shedi <sshedi@vmware.com> 1.0.3-1
52 54
 - initial version
... ...
@@ -1,7 +1,5 @@
1
-%{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2
-
3 1
 Name:           python3-sphinxcontrib-serializinghtml
4
-Version:        1.1.4
2
+Version:        1.1.5
5 3
 Release:        1%{?dist}
6 4
 Summary:        A platform independent file lock
7 5
 License:        MIT
... ...
@@ -9,13 +7,19 @@ Group:          Development/Languages/Python
9 9
 Vendor:         VMware, Inc.
10 10
 Distribution:   Photon
11 11
 URL:            https://pypi.org/project/sphinxcontrib-serializinghtml
12
-Source0:        https://files.pythonhosted.org/packages/ac/86/021876a9dd4eac9dae0b1d454d848acbd56d5574d350d0f835043b5ac2cd/sphinxcontrib-serializinghtml-%{version}.tar.gz
13
-%define sha1    sphinxcontrib-serializinghtml=7d782d9f8fef0a5663fc7732d72847e711f0f18b
14
-BuildArch:      noarch
15 12
 
16
-BuildRequires:  python3
17
-BuildRequires:  python3-devel
18
-BuildRequires:  python3-setuptools
13
+Source0: https://files.pythonhosted.org/packages/ac/86/021876a9dd4eac9dae0b1d454d848acbd56d5574d350d0f835043b5ac2cd/sphinxcontrib-serializinghtml-%{version}.tar.gz
14
+%define sha512 sphinxcontrib-serializinghtml=c5aabe4d29fd0455c269f8054089fdd61e1de5c35aa407740fc3baae4cfb3235d9fd5515c0489b0becd12abc8f18d0f42aa169ed315c00f30ba87e64ce851667
15
+
16
+BuildArch: noarch
17
+
18
+BuildRequires: python3-devel
19
+BuildRequires: python3-setuptools
20
+
21
+%if 0%{?with_check}
22
+BuildRequires: python3-sphinx
23
+BuildRequires: python3-pytest
24
+%endif
19 25
 
20 26
 Requires:       python3
21 27
 
... ...
@@ -32,13 +36,15 @@ the same lock object twice, it will not block.
32 32
 %autosetup -p1 -n sphinxcontrib-serializinghtml-%{version}
33 33
 
34 34
 %build
35
-python3 setup.py build
35
+%py3_build
36 36
 
37 37
 %install
38
-python3 setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
38
+%py3_install
39 39
 
40
+%if 0%{?with_check}
40 41
 %check
41
-%{__python3} test.py
42
+%pytest
43
+%endif
42 44
 
43 45
 %files
44 46
 %defattr(-,root,root,-)
... ...
@@ -48,5 +54,7 @@ python3 setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
48 48
 %{python3_sitelib}/sphinxcontrib/
49 49
 
50 50
 %changelog
51
+* Mon Sep 05 2022 Shreenidhi Shedi <sshedi@vmware.com> 1.1.5-1
52
+- Upgrade to v1.1.5
51 53
 * Mon Dec 14 2020 Shreenidhi Shedi <sshedi@vmware.com> 1.1.4-1
52 54
 - initial version
... ...
@@ -4,9 +4,12 @@ NCPUS=$(nproc)
4 4
 SCRIPTS_DIR="$(dirname ${0})"
5 5
 
6 6
 echo "Sanity check for all json files ..."
7
-find . ! \( -path './stage' -prune \)  -name '*\.json' -type f | \
7
+find . ! \( -path './stage' -prune \) -name '*\.json' -type f | \
8 8
   xargs -r -P${NCPUS} -n32 python3 ${SCRIPTS_DIR}/validate_json.py
9 9
 
10 10
 echo "Checking all python code is compilable ..."
11
-find . ! \( -path './stage' -prune \)  -name '*\.py' -type f | \
11
+find . ! \( -path './stage' -prune \) -name '*\.py' -type f | \
12 12
   xargs -r -P${NCPUS} -n32 python3 -m py_compile
13
+
14
+# delete all __pycache__ dirs created after running py_compile
15
+find . ! \( -path './stage' -prune \) -type d -name "__pycache__" | xargs rm -rf