[Rpm-maint] [rpm-software-management/rpm] Reimplement pythondeps.sh as parametric macro generators (#1153)
Miro Hrončok
notifications at github.com
Wed Apr 1 08:31:24 UTC 2020
@hroncok commented on this pull request.
> @@ -1,4 +1,28 @@
-%__python_provides %{_rpmconfigdir}/pythondeps.sh --provides
-%__python_requires %{_rpmconfigdir}/pythondeps.sh --requires
+%__python_provides() %{lua:
+ -- Match buildroot/payload paths of the form
+ -- /PATH/OF/BUILDROOT/usr/bin/pythonMAJOR.MINOR
+ -- generating a line of the form
+ -- python(abi) = MAJOR.MINOR
+ -- (Don't match against -config tools e.g. /usr/bin/python2.6-config)
+ local path = rpm.expand('%1')
+ if path:match('/usr/bin/python%d+%.%d+$') then
I am pretty sure this will also match `/var/lib/testing/framewrok/usr/bin/python3.8`, but that's **consistent with the previous behavior**. I was thinking about:
```lua
local buildroot = rpm.expand('%buildroot')
if path:match(buildroot .. '/usr/bin/python%d+%.%d+$')
```
But `%buildroot` can contain special characters (pluses, dots, etc.) and unfortunately there is no `escape` method in Lua.
If we want to go that road, I can work on that in a followup PR, hacking up [my own escape thing](https://stackoverflow.com/questions/9790688/escaping-strings-for-gsub).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1153#pullrequestreview-385369865
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200401/ed0dabcb/attachment.html>
More information about the Rpm-maint
mailing list