context: print metadata cache age after loading repos#2666
context: print metadata cache age after loading repos#2666DeveshB-1 wants to merge 1 commit intorpm-software-management:mainfrom
Conversation
|
Failed to load packit config file: For more info, please check out the documentation or contact the Packit team. You can also use our CLI command |
|
The dnf5 tests failing in testing-farm are caused by the new "Last metadata expiration check:" line not being handled by the I've opened rpm-software-management/ci-dnf-stack#1855 to fix The dnf5 code change itself (using |
|
@fnbash do look into this |
|
I can tell by the commits:
|
a18cefb to
cb93a96
Compare
|
I cleaned up the branch and force-pushed it so the PR now reflects only the real change in I also updated the remaining commit message so it describes the code accurately. Per the project policy, I will also label the commit Any ci-dnf-stack / Packit-side work, if still needed, will be handled separately in the appropriate repository. Thanks again for the review. |
DNF4 displayed "Last metadata expiration check: H:MM:SS ago on <date>." after loading repository metadata. DNF5 dropped this output, making it hard for users to know whether they are working with stale repo data. Restore the behaviour by iterating over enabled non-system repos after load_repos() completes. Show the oldest cache age (most stale repo) paired with the newest repomd primary timestamp, matching dnf4 logic. Use libdnf5::utils::sformat for the translated output string. The message is suppressed when no repos have valid timestamps (e.g. all repos were just refreshed from the network and have age 0, or no cache exists yet). Closes: rpm-software-management#1491 Signed-off-by: Devesh B <98201065+DeveshB-1@users.noreply.github.com> Assisted-by: ChatGPT
cb93a96 to
17b6968
Compare
|
Also this change breaks a lot of scenarios in ci-dnf-stack repo. |
m-blaha
left a comment
There was a problem hiding this comment.
Also fix the pre commit hook errors please.
| } | ||
| if (load_available) { | ||
| // Print metadata cache age, mirroring dnf4's "Last metadata expiration check" output. | ||
| // Show oldest age (most stale repo) with the newest repomd timestamp. |
There was a problem hiding this comment.
This is wrong (also in the commit message) - age shows the freshest cache age (minimal age), not the oldest. The newest timestamp is correct.
| } | ||
| } | ||
|
|
||
| if (min_age != std::numeric_limits<int64_t>::max() && max_ts > 0) { |
There was a problem hiding this comment.
dnf4 prints the cache age only when cached metadata were used (i.e. age > 0), not when metadata have been just refreshed - e.g. for dnf4 repoquery xxx --refresh. What do you think? Does such differentiation make sense?
Closes #1491
DNF4 displayed
Last metadata expiration check: H:MM:SS ago on <date>.after loading repository metadata. DNF5 dropped this output, making it hard to know whether you are working with stale repo data.What this does
After
load_repos()completes, iterate over enabled non-system repos and compute:get_age()) — how stale is the most stale repoget_timestamp()) — when was the newest primary metadata writtenPrint the message only when at least one repo has a valid cached timestamp. Matches dnf4 behaviour exactly.
Example output
Design decision (multiple repos)
Follows dnf4: show oldest age + newest timestamp. This answers "how stale is the most stale repo you are using".