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

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

2020-10-19 Thread Miro Hrončok
Indeed, either 1 string or 1 list (table) sounds more natural to me. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

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

2020-10-13 Thread Miro Hrončok
> There's ample potential for bikeshedding here (eg what to call the global > table) Indeed :) `m` is nice and short, but possibly a bit too much? What about including it in the `rpm` namespace as `rpm.m`? -- You are receiving this because you are subscribed to this thread. Reply to this

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

2020-10-13 Thread Miro Hrončok
@hroncok commented on this pull request. > @@ -142,9 +210,23 @@ def convert(name, operator, version_id): def normalize_name(name): Happy to adapt that script when we integrate this. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or

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

2020-10-12 Thread Miro Hrončok
@hroncok commented on this pull request. > +@classmethod +def normalize_name(klass, name): +"""https://www.python.org/dev/peps/pep-0503/#normalized-names""; +return re.sub(r'[-_.]+', '-', name).lower() + +@classmethod +def legacy_normalize_name(klass, name): +

Re: [Rpm-maint] [rpm-software-management/rpm] Add support for passing real local arguments to Lua scriptlets (#1383)

2020-10-09 Thread Miro Hrončok
The provided example looks excellent, thank you! -- 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/1383#issuecomment-706087800___

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: pass parametric macro options and arguments to Lua natively (#1092)

2020-10-08 Thread Miro Hrončok
I assume option without argument would be true while option with argument would be string with its value? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: pass parametric macro options and arguments to Lua natively (#1092)

2020-10-06 Thread Miro Hrončok
Do you have an example of usage? It's hard to find for me in the tests. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

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

2020-09-24 Thread Miro Hrončok
@hroncok commented on this pull request. > 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

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

2020-09-24 Thread Miro Hrončok
@hroncok commented on this pull request. > 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

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

2020-09-24 Thread Miro Hrončok
@hroncok commented on this pull request. > 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

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

2020-09-24 Thread Miro Hrončok
@hroncok commented on this pull request. > 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

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

2020-09-24 Thread Miro Hrončok
@hroncok commented on this pull request. > if normalized_names_require_pep503: -dep_normalized_name = normalize_name(dep.project_name) +dep_normalized_name = normalize_name(dep.name) else:

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

2020-09-24 Thread Miro Hrončok
@hroncok commented on this pull request. > else: -dep_normalized_name = dep.key +dep_normalized_name = dep.key.replace('_', '-') The code allows both naming conventions. We need to preserve that. ideally, we would have our

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

2020-09-23 Thread Miro Hrončok
@hroncok commented on this pull request. > else: -dep_normalized_name = dep.key +dep_normalized_name = dep.key.replace('_', '-') Be careful with manual replaces for normalized names. There are two regexes that this code

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

2020-09-22 Thread Miro Hrončok
@hroncok commented on this pull request. > -names = list(py_deps.keys()) -names.sort() -for name in names: +for name in sorted(list(py_deps.keys())): ```suggestion for name in sorted(py_deps.keys()): ``` -- You are receiving this because you are subscribed to this

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

2020-09-22 Thread Miro Hrončok
@hroncok commented on this pull request. > from warnings import warn +try: +from importlib.metadata import PathDistribution +from pathlib import Path +except ImportError: +from importlib_metadata import PathDistribution +from pathlib2 import Path I'd rather have those two

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: elfdeps: Filter Python subdirectories (#1227)

2020-09-01 Thread Miro Hrončok
I was thinking how to handle this today. I've only figured out *wrong* solutions: 1. Modify `%__global_provides_exclude_from` to include `%{_libdir}/python\d+\.\d+/.+\.so`. This obviously has several problems: I cannot really do it from Python macros, so the information would need to be kept

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Lua rpm.error() function (#1218)

2020-09-01 Thread Miro Hrončok
Also, `rpm.with("foo")` and `rpm.without("foo")` would be lovely. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Prevent automatic garbage collection in git based %autosetup macros (#1336)

2020-08-20 Thread Miro Hrončok
Right? It happened here BTW https://koschei.fedoraproject.org/package/pypy3?collection=f33 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

[Rpm-maint] [rpm-software-management/rpm] Prevent automatic garbage collection in git based %autosetup macros (#1336)

2020-08-19 Thread Miro Hrončok
The garbage collection happens in background, based on heuristic. This means that sometimes, when subsequent commands run, some files might disappear in the middle of an action. For example, when a find is used in %prep: + /usr/bin/git commit -m ... --author rpm-build rpm-build Auto

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

2020-08-14 Thread Miro Hrončok
Note that the tests are with https://fedoraproject.org/wiki/Changes/PythonExtras which was not yet backported here. Take [something](https://src.fedoraproject.org/rpms/python-rpm-generators/commits/master) before [this

Re: [Rpm-maint] [rpm-software-management/rpm] Disable Python hash seed randomization in brp-python-bytecompile (#1320)

2020-07-24 Thread Miro Hrončok
As always, I suggest to put the description to the commit message, not just the PR description. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Disable Python hash seed randomization in brp-python-bytecompile (#1320)

2020-07-24 Thread Miro Hrončok
@hroncok approved this pull request. I've already approved this in Fedora and I've asked @frenzymadness to bring it here as well. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

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

2020-07-23 Thread Miro Hrončok
@torsava PTAL on the code and possibly run it trough the tests. I ma not happy that we would need to rething the bootstrap sequence of setuptools/pyparsing/six/packaging but OTOH setutpools indeed bundles all of those. -- You are receiving this because you are subscribed to this thread. Reply

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

2020-07-23 Thread Miro Hrončok
> and you've not noticed because setuptools vendors it. We have noticed ;) -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

[Rpm-maint] [rpm-software-management/rpm] pythondistdeps.py: Adapt Python version marker workaround for setuptools 42+ (#1308)

2020-07-10 Thread Miro Hrončok
See https://bugzilla.redhat.com/show_bug.cgi?id=1853597#c11 pkg_resources from setuptools 42+ no longer only use platform.python_version(), but also platform.python_version_tuple() -- this was updated in packaging 19.1+. This fix makes it work again with both new and old setuptools, hopefully

Re: [Rpm-maint] [rpm-software-management/rpm] Sync python dependency conversion with pyreq2rpm. (#1299)

2020-07-06 Thread Miro Hrončok
See my review in https://github.com/gordonmessmer/pyreq2rpm/pull/7 The changes here make sense, yes. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Sync python dependency conversion with pyreq2rpm. (#1299)

2020-07-06 Thread Miro Hrončok
@hroncok approved this pull request. -- 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/1299#pullrequestreview-443152346___

Re: [Rpm-maint] [rpm-software-management/rpm] Files in %_docdir are not passed to dependency generators (#1297)

2020-07-01 Thread Miro Hrončok
Ah I wanted to add links. See https://lists.fedoraproject.org/archives/list/de...@lists.fedoraproject.org/thread/KY2PV6ENHUIO6OYOL3LWSNYEZJIAUHPZ/#KY2PV6ENHUIO6OYOL3LWSNYEZJIAUHPZ -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on

Re: [Rpm-maint] [rpm-software-management/rpm] Files in %_docdir are not passed to dependency generators (#1297)

2020-07-01 Thread Miro Hrončok
See also https://github.com/rpm-software-management/rpm/issues/713#issuecomment-652366245 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Have file attributes for %license and %doc (#713)

2020-07-01 Thread Miro Hrončok
I think that for most common cases, [people don't want dependency generators for `%doc` and `%license`](https://bugzilla.redhat.com/show_bug.cgi?id=964126). Hence it might make sense to not process such files by default at all and add an attr flag that can enable to process them, such as: ```

Re: [Rpm-maint] [rpm-software-management/rpm] Files in %_docdir are not passed to dependency generators (#1297)

2020-07-01 Thread Miro Hrončok
This was done in 816c7cf3fdae5c45de02a42a2245549778e2ca80 I wonder if you would accept applying the regex as the default value for `%__NAME_exclude_path` instead. That should still [fix the original problem](https://bugzilla.redhat.com/show_bug.cgi?id=964126) while it would allow dependency

[Rpm-maint] [rpm-software-management/rpm] Files in %_docdir are not passed to dependency generators (#1297)

2020-07-01 Thread Miro Hrončok
There is this default: https://github.com/rpm-software-management/rpm/blob/262d4855cd460048d106eb948fc677e6e435ed6e/macros.in#L208-L213 It prevents *any* dependency generator to see files in `%_docdir`. While I agree that this makes a good default as the majority of the dependency generators

Re: [Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-25 Thread Miro Hrončok
> To be clear, `%__foo_path` and `%__foo_magic` filters are a union, not an > intersection? That's actually somewhat surprising behavior... Union by default but can be switched with `magic_and_path` flag in `%__foo_flags` to intersection. -- You are receiving this because you are subscribed

Re: [Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-25 Thread Miro Hrončok
Ack. I'll ping people. -- 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/1272#issuecomment-649284471___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-24 Thread Miro Hrončok
Is this good to be merged? -- 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/1272#issuecomment-649113390___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] Discussion: How to handle Python extras (#1061)

2020-06-23 Thread Miro Hrončok
We have proposed this in Fedora: https://fedoraproject.org/wiki/Changes/PythonExtras -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-06-18 Thread Miro Hrončok
Would you accept a pull request that that adds a `rpmlua` executable and makes it behave more or less like my Python script? Note that my C skills are rusty and my autotools skills are almost nonexistent, so I will probably need some guidance. -- You are receiving this because you are

Re: [Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-18 Thread Miro Hrončok
Commit message amended. -- 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/1272#issuecomment-645958035___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-18 Thread Miro Hrončok
Indeed! This makes much more sense now, thanks. I'll amend the commit message. Before (file-5.38-6.fc33): ``` sh-5.0# file -z -e tokens /opt/usr/lib/python3.8/site-packages/{__pycache__/,}file* /opt/usr/lib/python3.8/site-packages/__pycache__/file.cpython-38.opt-1.pyc: data

Re: [Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-18 Thread Miro Hrončok
> sounds more like a libmagic change than rpm one. Let me test that actually. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-17 Thread Miro Hrončok
Downstream discovery in https://src.fedoraproject.org/rpms/python-rpm-generators/pull-request/20 I wonder, what changed in RPM? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

[Rpm-maint] [rpm-software-management/rpm] Fix python(abi) requires generator, it picked files from almost good directories (#1272)

2020-06-17 Thread Miro Hrončok
The %__python_magic filter suddenly got suppressed by the magic filter. Hence, the generator started to pick files like: /opt/usr/lib/python3.X/... Required python(abi). We dont need to filter the files by file magic, so we drop it. Previously, it seems that the behavior was flaky. The

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-06-13 Thread Miro Hrončok
This gets the job done: ```python librpm = cdll.LoadLibrary("librpm.so.9") # Load general configuration (such as macros defined in standard places) # Second argument is target platform, NULL is the default librpm.rpmReadConfigFiles(librpm.rpmcliRcfile, None) ``` -- You are receiving this

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-06-04 Thread Miro Hrončok
My script doesn't seem to see system defined macros. Do I need to call something explicitly to load them? ``` $ rpmlua RPM Interactive Lua 5.3 Interpreter > print(rpm.expand("%python3")) %python3 > rpm.define("test b") > print(rpm.expand("%test")) b > $ rpm --eval "%{lua:rpm.interactive()}"

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: Various updates and fixes (no test suite) (#1242)

2020-05-26 Thread Miro Hrončok
> I would move `import re` to the top imports and just be done with it. We can discuss this in a separate issue. It hasn't changed here. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-05-26 Thread Miro Hrončok
As a short term thing, we just need to merge in the code, so other changes don't diverge too much. Not having the tests here is something that I'd rather avoid -- how do we expect everybody to remember that the tests are somewhere else? -- You are receiving this because you are subscribed to

Re: [Rpm-maint] [rpm-software-management/rpm] Discussion: How to handle Python extras (#1061)

2020-05-19 Thread Miro Hrončok
Here's my idea: ```lua %python_extras_subpkg(n:i:f:) %{expand:%{lua: local value_n = rpm.expand('%{-n*}') local value_i = rpm.expand('%{-i*}') local value_f = rpm.expand('%{-f*}') local args = rpm.expand('%{*}') if value_n == '' then rpm.expand('%{error:%%%0: missing

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)

2020-05-19 Thread Miro Hrončok
@hroncok commented on this pull request. > @@ -241,15 +241,17 @@ newline is deleted). Note the 2nd % needed to escape > the arguments to Expression expansion can be performed using "%[expression]". An expression consists of terms that can be combined using -operators. Rpm supports two

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)

2020-05-19 Thread Miro Hrončok
So, this basically compares evrs, correct? -- 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/1233#issuecomment-630815654___

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: elfdeps: Filter Python subdirectories (#1227)

2020-05-18 Thread Miro Hrončok
However of course, in this particular case, we only want the provides to be filtered, not requires. If `/usr/lib64/python3.8/site-packages/libiscsi.cpython-38-x86_64-linux-gnu.so` links to `libiscsi.so.0`, we still want the package to require it. So setting a negative path filter in `elf.attr`

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: elfdeps: Filter Python subdirectories (#1227)

2020-05-18 Thread Miro Hrončok
``` %__NAME_path_exclude ``` ? -- 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/1227#issuecomment-630211602___ Rpm-maint

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: elfdeps: Filter Python subdirectories (#1227)

2020-05-18 Thread Miro Hrončok
anti-classifier directive is totally fine by me. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

[Rpm-maint] [rpm-software-management/rpm] RFE: elfdeps: Filter Python subdirectories (#1227)

2020-05-17 Thread Miro Hrončok
I'd like the [elfdeps](https://github.com/rpm-software-management/rpm/blob/master/tools/elfdeps.c) to filter out certain directories, namely anything in `/usr/lib(64)?/pythonX.Y/`. Context: - historically, all Python extension modules needed to use `%filter_provides_in

Re: [Rpm-maint] [rpm-software-management/rpm] RFC: support rpm version comparison in expression parser (#1220)

2020-05-15 Thread Miro Hrončok
`%{version:1.2.3}` would be my choice as well, if only it would not be confusing with `%{version}`. That' why I proposed `%{ver:5.6}` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
While `@1.2@ < @1.0@` looks quite OK, when combined with macros, it's not very readable either: ```spec %if @%{php_version}@ < @5.6@ ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFC: support rpm version comparison in expression parser (#1220)

2020-05-14 Thread Miro Hrončok
Listed in https://github.com/rpm-software-management/rpm/issues/1217#issuecomment-628526414 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-05-14 Thread Miro Hrončok
Here is my draft blog post about how to get a nicer console https://hackmd.io/@hroncok/SyNjuxcqL -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFC: support rpm version comparison in expression parser (#1220)

2020-05-14 Thread Miro Hrončok
Thank you! -- 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/1220#issuecomment-628557926___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-05-14 Thread Miro Hrončok
Since the high level discussion of whether this shall be split or not, can we please merge this for now to avoid the base diverging? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
Reopened #1217. -- 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/1217#event-3335805799___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
Closed #1217. -- 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/1217#event-3335805261___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
So, here are couple examples. I haven't checked if they don't collide with existing syntax. ```spec # int comparison, fallbacks to version comparison if at least one operand has nondigits? %if %{php_version} < 5.6 # string comparison, produces incorrect results some time %if "%{php_version}" <

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient %version without tilde macro (#1219)

2020-05-14 Thread Miro Hrončok
technically, since we are at RPM level, I wouldn't mind having this syntax: %{version//~} To remove whatever symbols I like. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
also "01" == "1" -- 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/1217#issuecomment-628493078___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
right. ok then, comparing `""` as stings works for me \o/ Obviously, that'll be 4.16+ only, so in Fedora terms, rawhide+. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient %version without tilde macro (#1219)

2020-05-14 Thread Miro Hrončok
> As for passing passing empty strings (or strings with spaces etc) as a macro > argument, use %{quote:} Thanks. Ugly, but works. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient %version without tilde macro (#1219)

2020-05-14 Thread Miro Hrončok
I get your point. But before we come ou with a concept of native "pre/post tag", I think we should have a way to address this in a common way. I like `%{bare_version}` (not "ursine" please). -- You are receiving this because you are subscribed to this thread. Reply to this email directly or

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: pass parametric macro options and arguments to Lua natively (#1092)

2020-05-14 Thread Miro Hrončok
I was about to explore this as well, thanks for filing this. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
OTOH this is backwards incompatible and a bit weird. What if `""` would still compare strings, but without `""` would compare versions? That is backwards compatible with comparing integers. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-05-14 Thread Miro Hrončok
I meant something a bit more sophisticated. I have so far: ```python #!/usr/bin/python3 import sys from ctypes import cdll, c_char_p librpmio = cdll.LoadLibrary("librpmio.so.9") adjust_path = b""" if os.getenv("LUA_PATH") then package.path = os.getenv("LUA_PATH") .. ";" .. package.path

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-05-14 Thread Miro Hrončok
I have it all figured out. Blog post coming. Would you consider adding something like the above to rpm itself? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-05-13 Thread Miro Hrončok
This gets the job done: ```python from ctypes import cdll, c_char_p librpmio = cdll.LoadLibrary("librpmio.so.9") librpmio.rpmluaRunScript(None, c_char_p(b"rpm.interactive()"), None) ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it

[Rpm-maint] [rpm-software-management/rpm] RFE: Convenient %version without tilde macro (#1219)

2020-05-13 Thread Miro Hrončok
@ignatenkobrain has has created this in Fedora's rust-srpm-macros: ```lua %version_no_tilde() %{lua: local sep = rpm.expand('%1') local ver = rpm.expand('%2') \ if sep == '%1' then sep = '-' end \ if ver == '%2' then ver = rpm.expand('%version') end ver

[Rpm-maint] [rpm-software-management/rpm] RFE: Lua rpm.error() function (#1218)

2020-05-13 Thread Miro Hrončok
I'd kindly like to request that the following Lua/RPM code: ```lua rpm.expand("%{error:...}") ``` Could be made simpler with something like: ```lua rpm.error("...") ``` Please do let me know if there is an existing better idiom for this. (Possibly also with `warn` and `echo`.) -- You are

[Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-13 Thread Miro Hrončok
Hello. I had a recent discussion with @Conan-Kudo about version comparison in spec conditionals. https://lists.fedoraproject.org/archives/list/python-de...@lists.fedoraproject.org/message/467NMLL3DTRZQBEX5LPFU6ZD5P56SSF3/ So I dug a bit and found the excellent `rpm.vercmp()` Lua function.

Re: [Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-05-13 Thread Miro Hrončok
Can I do anything to have the interneter not in the macro expansion mode? Dne st 13. 5. 2020 11:03 uživatel Michael Schroeder < notificati...@github.com> napsal: > This happens because you're in a macro expansion, so all the output is > collected and returned to the macro engine. > > — > You are

[Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

2020-05-12 Thread Miro Hrončok
I'd liek to use the interactive Lua console, however, it doesn't seem to be very... interactive. ``` $ rpm --eval "%{lua:rpm.interactive()}" RPM Interactive Lua 5.3 Interpreter > ``` So far so good... ``` > print"a" > ``` Nothing... ``` > print"a" > print"a" > print"a" > print"a" > ```

Re: [Rpm-maint] [rpm-software-management/rpm] Discussion: splitting language specifics out of rpm core (#1199)

2020-05-04 Thread Miro Hrončok
> For example a Bugzilla, where a bug can be easily reassigned to a different > component . GitHub can do this as well (it's a beta feature). -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Discussion: splitting language specifics out of rpm core (#1199)

2020-04-28 Thread Miro Hrončok
> I know that Miro has expressed concerns about splitting language-specific > tools into different repos because it tends to be more difficult to get those > tools into broad use if they're separate releases. I believe that was Neal. -- You are receiving this because you are subscribed to

[Rpm-maint] [rpm-software-management/rpm] Don't define global variables from Python generator (#1200)

2020-04-28 Thread Miro Hrončok
I havent tested this yet, but I believe this should work. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1200 -- Commit Summary -- * Dont define global variables from Python generator -- File Changes -- M

Re: [Rpm-maint] [rpm-software-management/rpm] Discussion: splitting language specifics out of rpm core (#1199)

2020-04-28 Thread Miro Hrončok
> Well, nothing prevents you having extensive testsuite for python, rust and > whatnot in one repo. Bad maintainability? -- I think we need to have some sort of distro-wide SIGs that can own things. I will take Python as an example (and we can pyoneer (hehe) this with Python and see what

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-04-27 Thread Miro Hrončok
@hroncok commented on this pull request. > @@ -11,6 +11,10 @@ # RPM python dependency generator, using .egg-info/.egg-link/.dist-info data # +# Please know: +# - Notes from an attempted rewrite from pkg_resources to importlib.metadata in +# 2020 can be found in the message of the commit

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-04-27 Thread Miro Hrončok
@hroncok commented on this pull request. > @@ -11,6 +11,10 @@ # RPM python dependency generator, using .egg-info/.egg-link/.dist-info data # +# Please know: +# - Notes from an attempted rewrite from pkg_resources to importlib.metadata in +# 2020 can be found in the message of the commit

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-04-27 Thread Miro Hrončok
@hroncok commented on this pull request. > + + +if __name__ == "__main__": +"""To allow this script to be importable (and its classes/functions + reused), actions are performed only when run as a main script.""" + +parser = argparse.ArgumentParser(prog=argv[0]) +group =

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-04-27 Thread Miro Hrončok
Totally fine by me. @torsava @Conan-Kudo @gordonmessmer @ignatenkobrain @s-t-e-v-e-n-k WDYT? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-04-27 Thread Miro Hrončok
> We talk about upstreaming changes like this, but to me the situation looks > pretty much the opposite: this has an active upstream of its own and we're > merely syncing it from time to time, which is doing double work for ... I > don't know what. We are happy to maintain this ourselves. The

Re: [Rpm-maint] [rpm-software-management/rpm] scripts/pythondistdeps: New test suite and various updates and fixes (#1195)

2020-04-24 Thread Miro Hrončok
@hroncok approved this pull request. FWIW I've reviewed this before the PR was opened. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RPM generators errors are ignored (#1183)

2020-04-20 Thread Miro Hrončok
@torsava OK, let's wait for the next unexpected error. But wrapping everything in try-except and failing with useful error message is not a bad idea. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] RPM generators errors are ignored (#1183)

2020-04-20 Thread Miro Hrončok
The almost-backwards-compatible way would be to have a specific exit code that should abort the build. E.g. "exit with 66 to abort the build". Technically, I think it is possible to abort the build by generating an invalid dependency, but that is hardly an API. -- You are receiving this

Re: [Rpm-maint] [rpm-software-management/rpm] Handle all-zero versions without crashing. (#1184)

2020-04-20 Thread Miro Hrončok
Fedora backport: https://src.fedoraproject.org/rpms/python-rpm-generators/pull-request/12 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Python dist RPM generators errors are silently ignored (#1183)

2020-04-20 Thread Miro Hrončok
Thanks. -- 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/1183#issuecomment-616505628___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] Python dist RPM generators errors are silently ignored + 0 version fail (#1183)

2020-04-20 Thread Miro Hrončok
That fixes the particular problem. But the two remaining points still stand: - the exception when the conversion fails is not telling anything useful - the rpmbuild continues (can we abort the build from a dependency generator?) -- You are receiving this because you are subscribed to this

Re: [Rpm-maint] [rpm-software-management/rpm] Handle all-zero versions without crashing. (#1184)

2020-04-20 Thread Miro Hrončok
Thank you. -- 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/1184#issuecomment-616501841___ Rpm-maint mailing list

Re: [Rpm-maint] [rpm-software-management/rpm] Python dist RPM generators errors are silently ignored + 0 version fail (#1183)

2020-04-20 Thread Miro Hrončok
It seems that it's not the local version modifier that breaks this, but version `0`. See https://github.com/fedora-python/pyp2rpm/pull/233 -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:

Re: [Rpm-maint] [rpm-software-management/rpm] Python dist RPM generators errors are silently ignored + local version identifiers fail (#1183)

2020-04-19 Thread Miro Hrončok
cc @torsava @gordonmessmer -- 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/1183#issuecomment-616091048___ Rpm-maint mailing

[Rpm-maint] [rpm-software-management/rpm] Python dist RPM generators errors are silently ignored + local version identifiers fail (#1183)

2020-04-19 Thread Miro Hrončok
>From >https://lists.fedoraproject.org/archives/list/de...@lists.fedoraproject.org/thread/JWCV2PG2EG5TCPMJAHWM7B54SMHT6A4V/ And from https://koji.fedoraproject.org/koji/buildinfo?buildID=1495361 The upstream version is "weird". The RPM dist generator fails with: ``` Traceback (most recent call

Re: [Rpm-maint] [rpm-software-management/rpm] Reimplement pythondeps.sh as parametric macro generators (#1153)

2020-04-14 Thread Miro Hrončok
@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 +--

[Rpm-maint] [rpm-software-management/rpm] Adjust %__python_path (#1179)

2020-04-14 Thread Miro Hrončok
- sync with Fedora - only match direct Python sitedir, no /opt/.../lib/python3.7 stuff - prep for multiple digits Python major releases (e.g. 12.1) - use the value of %_prefix See also: https://src.fedoraproject.org/rpms/python-rpm-generators/c/8eef42cbaa6ff0e5c006959fc06ec115ed5ca37b

  1   2   3   >