Add --refresh CLI flag
Some checks reported errors
builds.sr.ht/test builds.sr.ht submission failed
builds.sr.ht/main Job completed
builds.sr.ht/epel9 Job failed
builds.sr.ht/mockbuild Job completed

Fixes: #103
This commit is contained in:
Maxwell G 2026-06-25 17:38:46 -05:00
commit 5fbf759625
Signed by: gotmax23
GPG key ID: F79E4E25E8C661F8
2 changed files with 6 additions and 1 deletions

View file

@ -137,6 +137,8 @@ These options have the same meaning across multiple subcommands.
only applies when using the libdnf5 backend or newer versions of dnf4,
which do not load filelists by default to save memory and bandwidth.
*dnf < 4.19.0* always loads filelists.
*--refresh*
Force refresh repository metadata
## whatrequires, whatrecommends, whatsuggests

View file

@ -322,6 +322,9 @@ class Command(metaclass=abc.ABCMeta):
dest="smartcache",
const="always",
)
parser.add_argument(
"--refresh", action="store_true", help="Force refresh repository metadata"
)
# This is mutually exclusive with --smartcache. It's still undocumented
# and subject to change.
cachedir_group.add_argument("--cachedir", help=argparse.SUPPRESS, type=Path)
@ -479,7 +482,7 @@ class Command(metaclass=abc.ABCMeta):
except ConfigError as exc:
return str(exc)
try:
filled = bm.fill_sack()
filled = bm.fill_sack(force_refresh=self.args.refresh)
except self.backend.RepoError as exc:
flog.debug("RepoError: ", exc_info=exc)
return str(exc)