[Rpm-maint] [rpm-software-management/rpm] Odd handing of URLs containing a ? in Source*:/Patch*: lines (#1407)

2020-10-21 Thread Bernhard Rosenkraenzer
When using an URL containing a ? in Source*:/Patch*: lines, the file name 
assumed by rpm is truncated to the bits after the ?, not not the filename 
preceding it.
This makes it hard to e.g. reference a patch being "stolen" from Arch Linux 
since e.g.
Patch1: 
https://aur.archlinux.org/cgit/aur.git/plain/chromium-skia-harmony.patch?h=chromium-vaapi
Patch2: 
https://aur.archlinux.org/cgit/aur.git/plain/fix-invalid-end-iterator-usage-in-CookieMonster.patch?h=chromium-vaapi
results in references to 2 files called "chromium-vaapi", when any regular 
parsing of the URL would expect it to become chromium-skia-harmony.patch and 
fix-invalid-end-iterator-usage-in-CookieMonster.patch

-- 
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/issues/1407___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Implement a table-like shortcut to rpm macros in Lua (#1398)

2020-10-21 Thread Panu Matilainen
> I'll try to get it into a submittable state tomorrow or so.

...except that nope, didn't see a way to achieve this with a reasonable effort. 
Doesn't necessarily mean there isn't one, but I lost my appetite for now. I 
might revisit at some later time, but if somebody wants to pick up the pieces 
in the meanwhile, feel free.

-- 
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/1398#issuecomment-713348813___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] Add preliminary support for dynamic built-in macro registration (#1406)

2020-10-21 Thread Panu Matilainen
Add the necessary infra to pass and carry dofoo/parse function pointers
in macro entries, define our basic built-in primitives at macro
initialization and adapt the built-in calling logic in expandMacro()
to look up the info from macro entry instead of the builtin table.

This has various nice benefits, such as allowing simple testing whether
rpm supports a given primitive by testing whether said macro is defined.
It also paves way for later implementing various spec constructs as
actual macros instead of the confusing pseudo-macros they are now.
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1406

-- Commit Summary --

  * Add preliminary support for dynamic built-in macro registration

-- File Changes --

M rpmio/macro.c (110)
M tests/rpmmacro.at (2)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1406.patch
https://github.com/rpm-software-management/rpm/pull/1406.diff

-- 
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/1406
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Implement a table-like shortcut to rpm macros in Lua (#1398)

2020-10-21 Thread Panu Matilainen
No worries. I got tangled in the argument/option parsing/passing recursion - 
I've a feeling the mb->args vs argument macros and all isn't quite right as it 
is, and just ran out of steam for now. So I was actually kinda hoping you'd say 
that...

Meanwhile, here's a related step towards making builtins more accessible: #1406 

-- 
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/1398#issuecomment-713513326___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Improved python support: enums are now enums with all additional goodies. (#1309)

2020-10-21 Thread KOLANICH
@KOLANICH pushed 1 commit.

702e756046855d51541c0cf59541cd0a02120e3e  Improved python support: enums are 
now enums with all additional goodies. Can usually be available using 
CamelCased prefix, class members have the prefix stripped.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1309/files/ab8a88455919c191ab85bf5a4a3ab8261679185b..702e756046855d51541c0cf59541cd0a02120e3e
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] pythondistdeps: Switch to importlib.metadata (#1317)

2020-10-21 Thread Miro HronĨok
@hroncok commented on this pull request.

Those are my final thoughts. They are not serious, but I thought I'd share them 
as suggestions.

> +try:
+from importlib.metadata import PathDistribution
+except ImportError:
+from importlib_metadata import PathDistribution
+
+try:
+from pathlib import Path
+except ImportError:
+from pathlib2 import Path
+
+
+class Req(Requirement):
+def __init__(self, requirement_string):
+super(Req, self).__init__(requirement_string)
+self.normalized_name = normalize_name(self.name)
+self.legacy_normalized_name = legacy_normalize_name(self.name)

It's confusing for me to not see the functions defined before this class.

>  from warnings import warn
 
+try:
+from importlib.metadata import PathDistribution
+except ImportError:
+from importlib_metadata import PathDistribution
+
+try:
+from pathlib import Path
+except ImportError:
+from pathlib2 import Path
+
+
+class Req(Requirement):

This naming is confusing to me. Why not import Requirement as Requirement_ and 
call this Requirement?

> +super(Distribution, self).__init__(Path(path))
+self.name = self.metadata['Name']
+self.normalized_name = normalize_name(self.name)
+self.legacy_normalized_name = legacy_normalize_name(self.name)
+self.requirements = [Req(r) for r in self.requires or []]
+self.extras = [
+v for k, v in self.metadata.items() if k == 'Provides-Extra']
+self.py_version = self._parse_py_version(path)
+
+def _parse_py_version(self, path):
+# Try to parse the Python version from the path the metadata
+# resides at (e.g. /usr/lib/pythonX.Y/site-packages/...)
+res = re.search(r"/python(?P\d+\.\d+)/", path)
+if res:
+return res.group('pyver')
+# If that hasn't worked, attempt to parse it from the directory name

```suggestion
# If that hasn't worked, attempt to parse it from the metadata 
directory name
```

> +return chain.from_iterable(
+[self.requirements_for_extra(extra) for extra in self.extras])

```suggestion
return chain(self.requirements_for_extra(e) for e in self.extras)
```

(untested)

> @@ -143,10 +201,30 @@ def convert(name, operator, version_id):
 
 def normalize_name(name):
 """https://www.python.org/dev/peps/pep-0503/#normalized-names""";
-import re

Why is this no longer lazy? Because the performance impact was negligible?

>  
 if args.majorver_provides or args.majorver_provides_versions or \
 args.majorver_only or args.legacy_provides or args.legacy:
 # Get the Python major version
 pyver_major = dist.py_version.split('.')[0]
 if args.provides:
 # If egg/dist metadata says package name is python, we provide 
python(abi)
-if dist.key == 'python':
+if dist.legacy_normalized_name == 'python':

```suggestion
if dist.normalized_name == 'python':
```

This does the same, but reads easier.

> @@ -324,7 +363,7 @@ def normalize_name(name):
 if args.requires or (args.recommends and dist.extras):
 name = 'python(abi)'
 # If egg/dist metadata says package name is python, we don't 
add dependency on python(abi)
-if dist.key == 'python':
+if dist.legacy_normalized_name == 'python':

```suggestion
if dist.normalized_name == 'python':
```

>  (lower.endswith('.egg') or
  lower.endswith('.egg-info'))):
-# stick them first so any more specific requirement 
overrides it
-deps.insert(0, Requirement.parse('setuptools'))
+groups = set([ep.group for ep in dist.entry_points])

```suggestion
groups = {ep.group for ep in dist.entry_points}
```

Unless we want to support Python 2.6 which I'd rather not (and most likely we 
already don't).

>  (lower.endswith('.egg') or
  lower.endswith('.egg-info'))):
-# stick them first so any more specific requirement 
overrides it
-deps.insert(0, Requirement.parse('setuptools'))
+groups = set([ep.group for ep in dist.entry_points])
+if set(["console_scripts", "gui_scripts"]) & groups:

```suggestion
if {"console_scripts", "gui_scripts"} & groups:
```

> -py_deps[name] = []
-spec = ('==', spec[1])
-if spec not in py_deps[name]:
-py_deps[name].append(spec)
-
-names = list(py_deps.keys())
-names.sort()
-for name in names:
+for dep in dist.requirements + dist.extra_requirements:
+for spec in dep.specifier:
+ 

Re: [Rpm-maint] [rpm-software-management/rpm] Implement a table-like shortcut to rpm macros in Lua (#1398)

2020-10-21 Thread Michael Schroeder
Sorry, I didn't want to discourage you. I'll open a pull request with that 
rpmExpandThisMacro() implementation.

-- 
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/1398#issuecomment-713382429___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Added a high-level wrapper. (#1311)

2020-10-21 Thread KOLANICH
@KOLANICH pushed 1 commit.

f7fd783f8146f1e151296ba3659355dcb9943bcb  Added a high-level wrapper.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1311/files/090ad798d700b4f166f19ec55e8120e0716e606d..f7fd783f8146f1e151296ba3659355dcb9943bcb
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint