Re: [Rpm-maint] [rpm-software-management/rpm] Add rpmLogOnce to filter log message (Issue #3395)

2024-10-29 Thread Panu Matilainen
Hmm, so you could of course easily count the times you get called per each key, and then optionally emit a "repeated X times" when on reset so you'd basically get the #3336 behavior and the more regular log suppression style from the same thing. The lifetime could be handled by throwing in a co

Re: [Rpm-maint] [rpm-software-management/rpm] Add rpmLogOnce to filter log message (Issue #3395)

2024-10-29 Thread Florian Festi
#3336 calls for this to be independent of the process life time. The issue here is that the whole logging system is bound to the process as it is build on top of a global variable. The right thing IMHO would be adding this functionality to the global log context for now and deal with the issue

Re: [Rpm-maint] [rpm-software-management/rpm] Add rpmLogOnce to filter log message (Issue #3395)

2024-10-29 Thread Florian Festi
OK; let's start with the second thing first. void rpmlogOnce (uint64_t ctx, const char * key, int code, const char *fmt, ...); void rpmlogReset(uint64_t ctx, int suppress); Look fine to me. `suppress` probably morphing into a enum for the different modes of operation. -- Reply to this email d

[Rpm-maint] [rpm-software-management/rpm] Implement a native C++ macro API + use it to replace manual macro locking (PR #3408)

2024-10-29 Thread Panu Matilainen
This started with the innocent intention of making a couple of C++ string expand variants available, but then I got carried away... There are no added tests because this is all covered by existing functionality testing. You can view, comment on, or merge this pull request online at: https://

Re: [Rpm-maint] [rpm-software-management/rpm] Add rpmLogOnce to filter log message (Issue #3395)

2024-10-29 Thread Florian Festi
Hmm, "last warning repeated 123 times" works fine if there is only one message repeated all over. There surely are cases like this in rpmbuild. But for things like the signature results they are interwoven with other messages. Same is probably true with for other things. E.g. warnings for non de

Re: [Rpm-maint] [rpm-software-management/rpm] Add rpmLogOnce to filter log message (Issue #3395)

2024-10-29 Thread Panu Matilainen
Yeah there are two separate things there: for the "last warning repeated 123 times" you'd want to have automatically detected and supressed on all rpmlog() calls. The other case - the original case this ticket started with - is the case where the caller needs to be aware and do their own suppres

Re: [Rpm-maint] [rpm-software-management/rpm] How to expand user possibly non-existent user constructed variable name? (Discussion #3411)

2024-10-29 Thread Vít Ondruch
Actually, it seems that I have found a cure: ~~~ $ rpm -D "name foo" -D "string_io_prerelease .dev" --eval '%{expand:%{%{quote:?}%{gsub %{name} - _}_prerelease}}' $ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval '%{expand:%{%{quote:?}%{gsub %{name} - _}_prerelease}}' .dev ~~~ Bu

[Rpm-maint] [rpm-software-management/rpm] Regression: addtional output in rpmspec with -q (Issue #3413)

2024-10-29 Thread Miroslav Suchý
**Describe the bug** When I run: ``` rpmspec -q --qf '%{license}\n' '--define=_sourcedir .' ~/spdx/cfn-lint/cfn-lint.spec 2>/dev/null ``` on this spec file https://src.fedoraproject.org/rpms/cfn-lint/blob/rawhide/f/cfn-lint.spec I get: ``` Reading /var/tmp/rpm-tmp.bSC32X MIT-0 AND MIT MIT-0 AND

[Rpm-maint] [rpm-software-management/rpm] `%{sub:...}` macro does not work with `%{expand:...}` (Issue #3412)

2024-10-29 Thread Vít Ondruch
The subject is likely wrong, because I don't understand the mechanism. But for some reason, it does not seem that the value provided by `%{expand:...}` is properly used by `%{sub:...}` **Expected behavior** ~~~ $ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval '%{sub %{expand:%{%

Re: [Rpm-maint] [rpm-software-management/rpm] `%{sub:...}` macro does not work with `%{expand:...}` (Issue #3412)

2024-10-29 Thread Vít Ondruch
This works: ~~~ $ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval '%{sub %{expand:%{%{expand %{quote:?}}%{gsub %{name} - _}_prerelease}} 2 -1}' dev ~~~ So this is likely related to #3411. Is there chance to make it somehow more straight forward? BTW this also works: ~~~ $ rpm -D

[Rpm-maint] [rpm-software-management/rpm] `%{gsub:...}` throws error (Issue #3410)

2024-10-29 Thread Vít Ondruch
>From >[documentation](https://github.com/rpm-software-management/rpm/blob/ebc406862053815528c00095f9f991d649fa33a0/docs/manual/macros.md?plain=1#L119), > I would think this should work: ~~~ $ rpm --eval "%{gsub:foo o i}" error: lua script failed: [string "gsub"]:1: bad argument #2 to 'gsub' (str

Re: [Rpm-maint] [rpm-software-management/rpm] Add rpmLogOnce to filter log message (Issue #3395)

2024-10-29 Thread Panu Matilainen
Right, there could be more than two modes of operation for reset, so "suppress" might be overly limiting as a name - see what comes up. -- Reply to this email directly or view it on GitHub: https://github.com/rpm-software-management/rpm/issues/3395#issuecomment-2444252967 You are receiving this

Re: [Rpm-maint] [rpm-software-management/rpm] Add rpmLogOnce to filter log message (Issue #3395)

2024-10-29 Thread Panu Matilainen
Let's look at the bigger picture here a bit, because #3336 is an isolated use-case and rather unusual at that so it's actually not that interesting in itself. The typical case of log suppression we'd want is of the "last message repeated 123 times" kind rather than silence *all* the following me

[Rpm-maint] [rpm-software-management/rpm] How to expand user possibly non-existent user constructed variable name? (Discussion #3411)

2024-10-29 Thread Vít Ondruch
I have this snippet: ~~~ $ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval "%{expand:%{%{gsub %{name} - _}_prerelease}}" .dev ~~~ But if the `name` does not match to the next definition, the non existing variable is printed out: ~~~ $ rpm -D "name foo" -D "string_io_prerelease .d

[Rpm-maint] [rpm-software-management/rpm] A halloween story 👻 (Discussion #3409)

2024-10-29 Thread Panu Matilainen
As you may know, RPM packages may contain something called ghost files. Or rather, the point is that the files that are not there. While this may sound weird to the uninitiated, this is actually quite common need. Consider for example a log file that gets created when a software you packaged run

Re: [Rpm-maint] [rpm-software-management/rpm] Implement a native C++ macro API + use it to replace manual macro locking (PR #3408)

2024-10-29 Thread Panu Matilainen
Got carried away enough that I forgot to explain a key benefit: This gives the caller the ability to control locking, so if you need to do 1000 expands in a loop you no longer need to go through lock+unlock cycles for each as it is with the C versions. Gaining those benefits of course requires c