Skip to content

Commit 8ed97ff

Browse files
committed
Updated script for definition generation and dependencies handling [skip ci]
The current commit has made necessary amendments in `generate-definitions.py` script for more accurate module file creation and dependency handling. Changes include renaming of `requires_found` to `lib_requires_found`, and check before appending a module to `lib_requires`. The 'requires' field in `resty/core.yml` was also split into 'lib_requires' and 'requires' for improved modularity.
1 parent b6b4607 commit 8ed97ff

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

Diff for: generate-definitions.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def setup_logging(level=logging.INFO):
6363
continue
6464
module_name = repo.name.replace('lua-resty-', '')
6565
filename = os.path.join(work_dir, f'resty/{module_name}.yml')
66+
# If module file has been created during this launch (e.g. author1/repo1 and author2/repo1 have same name)
6667
if os.path.exists(filename):
6768
log.warning('Skipping. Definition already exists for this name. Likely a less popular fork')
6869
continue
@@ -129,15 +130,16 @@ def setup_logging(level=logging.INFO):
129130
requires = re.sub(r'0\.0(\d)', r"0.\1", requires)
130131
requires = requires.split(',')
131132
requires_found = []
133+
lib_requires_found = []
132134
for r in requires:
133135
parts = r.split('/')
134136
r = parts[-1].strip()
135137
if r.startswith('lua-resty-'):
136-
requires_found.append(r.replace('lua-', ''))
138+
lib_requires_found.append(r.replace('lua-', ''))
137139
print(requires)
138-
print(requires_found)
139-
if requires_found:
140-
dict_file['requires'] = requires_found
140+
print(lib_requires_found)
141+
if lib_requires_found:
142+
dict_file['lib_requires'] = lib_requires_found
141143

142144
with open(filename, 'w', encoding='utf8') as file:
143145
documents = yaml.dump(dict_file, file)

Diff for: resty/core.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
repo: openresty/lua-resty-core
2-
requires:
2+
lib_requires:
33
- resty-lrucache >= 0.8
4+
requires:
45
- ngx_http_lua_module >= 0.10.25
56
summary: New FFI-based API for lua-nginx-module

Diff for: spec.j2

+16-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
Name: lua-%{luapkgname}
1515
Version: {{ version }}
16-
Release: 3%{?dist}
16+
Release: 4%{?dist}
1717
Summary: {{ summary }}
1818
Group: Development/Libraries
1919
License: BSD
@@ -33,6 +33,12 @@ Requires: lua(abi) = %{luacompatver}
3333

3434
{% if requires is defined and requires is iterable %}
3535
{% for r in requires -%}
36+
Requires: {{ r }}
37+
{% endfor -%}
38+
{%- endif -%}
39+
40+
{% if lib_requires is defined and lib_requires is iterable %}
41+
{% for r in lib_requires -%}
3642
Requires: lua-{{ r }}
3743
{% endfor -%}
3844
{%- endif -%}
@@ -49,16 +55,23 @@ Provides: {{ p }}
4955
{% endfor -%}
5056
{%- endif -%}
5157

52-
BuildArch: noarch
58+
BuildArch: noarch
5359

5460
%description
5561
%{summary}.
5662

5763
%if 0%{?fedora} || 0%{?rhel} > 7
5864
%package -n lua%{luacompatver}-%{luapkgname}
5965
Summary: {{ summary }} for Lua %{luacompatver}
60-
{% if requires is defined and requires is iterable -%}
66+
67+
{% if requires is defined and requires is iterable %}
6168
{% for r in requires -%}
69+
Requires: {{ r }}
70+
{% endfor -%}
71+
{%- endif -%}
72+
73+
{% if lib_requires is defined and lib_requires is iterable -%}
74+
{% for r in lib_requires -%}
6275
Requires: lua%{luacompatver}-{{ r }}
6376
{% endfor -%}
6477
{%- endif -%}
@@ -118,4 +131,3 @@ cp -pr lib/* $RPM_BUILD_ROOT%{luacompatpkgdir}
118131

119132
%changelog
120133
# not maintained
121-

0 commit comments

Comments
 (0)