[Rpm-maint] [rpm-software-management/rpm] Issue %patchN deprecation warning just once (PR #2388)

Panu Matilainen notifications at github.com
Thu Feb 9 09:12:07 UTC 2023


Static variables are best avoided, for one they wont work correctly for the case where you query/build multiple specs on a single run.

A simple alternative would be adding a special purpose counter to the spec struct, and log a message based on that towards the end of parsePrep() where you can then also log the number of times emitted.

rpmlog() based deduplicator could be handy though, there are some pathological cases elsewhere where we end up flooding other (more) relevant messages due to stupidly repeated errors. But for that, I'd look at only suppressing consecutive identical messages, which has multiple benefits:
- you only ever need to compare the current and previous message
- identical messages over a larger timespan and/or with interleaving other messages are probably something you'd want to see anyhow

Basically, whenever a message is logged, compare to the previous one and if identical, bump a counter. When a non-identical message arrives, log a "previous warning/error suppressed N times", reset counter and proceed with the new message as usual. Bonus points for an additional time-stamp and using that for additional heuristics: if a log message is repeated within N seconds, you probably want to suppress but otherwise you may want to show it regardless.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2388#issuecomment-1423861739
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2388/c1423861739 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20230209/18bc6e5c/attachment.html>


More information about the Rpm-maint mailing list