Added macros for Build/Requires tags using Python dist tags
https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
This commit is contained in:
parent
516c55eed7
commit
123ad4b49f
|
@ -6,3 +6,58 @@
|
||||||
%__python3_other /bin/true
|
%__python3_other /bin/true
|
||||||
%py3_other_build /bin/true
|
%py3_other_build /bin/true
|
||||||
%py3_other_install /bin/true
|
%py3_other_install /bin/true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# === Macros for Build/Requires tags using Python dist tags ===
|
||||||
|
# - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||||
|
# - These macros need to be in macros.python-srpm, because BuildRequires tags
|
||||||
|
# get rendered as runtime requires into the metadata of SRPMs.
|
||||||
|
|
||||||
|
# Converts Python dist name to a canonical format
|
||||||
|
%py_dist_name() %{lua:\
|
||||||
|
name = rpm.expand("%{?1:%{1}}");\
|
||||||
|
canonical = string.gsub(string.lower(name), "%W+", "-");\
|
||||||
|
print(canonical);\
|
||||||
|
}
|
||||||
|
|
||||||
|
# Creates Python 2 dist tag(s) after converting names to canonical format
|
||||||
|
# Needs to first put all arguments into a list, because invoking a different
|
||||||
|
# macro (%py_dist_name) overwrites them
|
||||||
|
%py2_dist() %{lua:\
|
||||||
|
args = {}\
|
||||||
|
arg = 1\
|
||||||
|
while (true) do\
|
||||||
|
name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
|
||||||
|
if (name == nil or name == '') then\
|
||||||
|
break\
|
||||||
|
end\
|
||||||
|
args[arg] = name\
|
||||||
|
arg = arg + 1\
|
||||||
|
end\
|
||||||
|
for arg, name in ipairs(args) do\
|
||||||
|
canonical = rpm.expand("%py_dist_name " .. name);\
|
||||||
|
print("python2dist(" .. canonical .. ") ");\
|
||||||
|
end\
|
||||||
|
}
|
||||||
|
|
||||||
|
# Creates Python 3 dist tag(s) after converting names to canonical format
|
||||||
|
# Needs to first put all arguments into a list, because invoking a different
|
||||||
|
# macro (%py_dist_name) overwrites them
|
||||||
|
%py3_dist() %{lua:\
|
||||||
|
args = {}\
|
||||||
|
arg = 1\
|
||||||
|
while (true) do\
|
||||||
|
name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
|
||||||
|
if (name == nil or name == '') then\
|
||||||
|
break\
|
||||||
|
end\
|
||||||
|
args[arg] = name\
|
||||||
|
arg = arg + 1\
|
||||||
|
end\
|
||||||
|
for arg, name in ipairs(args) do\
|
||||||
|
canonical = rpm.expand("%py_dist_name " .. name);\
|
||||||
|
print("python3dist(" .. canonical .. ") ");\
|
||||||
|
end\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Name: python-rpm-macros
|
Name: python-rpm-macros
|
||||||
Version: 3
|
Version: 3
|
||||||
Release: 15%{?dist}
|
Release: 16%{?dist}
|
||||||
Summary: The unversioned Python RPM macros
|
Summary: The unversioned Python RPM macros
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
|
@ -69,6 +69,10 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} \
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jan 17 2017 Tomas Orsava <torsava@redhat.com> - 3-16
|
||||||
|
- Added macros for Build/Requires tags using Python dist tags:
|
||||||
|
https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||||
|
|
||||||
* Thu Nov 24 2016 Orion Poplawski <orion@cora.nwra.com> 3-15
|
* Thu Nov 24 2016 Orion Poplawski <orion@cora.nwra.com> 3-15
|
||||||
- Make expanded macros start on the same line as the macro
|
- Make expanded macros start on the same line as the macro
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue