Refresh repositories specified by their alias or number. If no repositories are specified, all enabled repositories will be refreshed.
.IP
Refreshing a repository means downloading metadata of resolvables from media (if needed), storing it in local cache (typically under /var/cache/zypp/raw/<alias> directory) and preparsing the metadata into an sqlite database (/var/cache/zypp/zypp.db).
+.TP
+.I \-f, \-\-force
+Force a complete refresh of specified repositories. This option will cause both the download of raw metadata and parsing of the metadata to be forced even if everything indicates a refresh is not needed.
+.TP
+.I \-b, \-\-force\-build
+Force only reparsing of cached metadata and rebuilding of the database. Raw metadata download will not be forced.
+.TP
+.I \-d, \-\-force\-download
+Force only download of current copy of repository metadata. Parsing and rebuild of the database will not be forced.
+.TP
+.I \-B, \-\-build\-only
+Only parse the metadata and build the database, don't download raw metadata into the cache. This will enable you to repair damaged database from cached data without accessing network at all.
+.TP
+.I \-D, \-\-download\-only
+Only download the raw metadata, don't parse it or build the database.
.SH "GLOBAL OPTIONS"
+
.TP
.I \-h, \-\-help
Help. If a \fBcommand\fR is specified together with --help option, command specific help is displayed.
// do the refresh
try
{
- cout_n << format(_("Refreshing '%s'")) % it->alias() << endl;
- manager.refreshMetadata(repo, RepoManager::RefreshIfNeeded);
+ if (!copts.count("build-only"))
+ {
+ bool force_download =
+ copts.count("force") || copts.count("force-download");
+
+ cout_n << format(_("Refreshing '%s'")) % it->alias();
+ if (force_download)
+ cout_n << " " << _("(forced)");
+ cout_n << endl;
+
+ MIL << "calling refreshMetadata" << (force_download ? ", forced" : "")
+ << endl;
+
+ manager.refreshMetadata(repo, force_download ?
+ RepoManager::RefreshForced : RepoManager::RefreshIfNeeded);
+ }
- cout_v << _("Creating repository cache...") << endl;
- manager.buildCache(repo, RepoManager::BuildIfNeeded);
+ if (!copts.count("download-only"))
+ {
+ bool force_build =
+ copts.count("force") || copts.count("force-build");
+
+ cout_v << _("Creating repository cache");
+ if (force_build)
+ cout_v << " " << _("(forced)");
+ cout_v << endl;
+
+ MIL << "calling buildCache" << (force_build ? ", forced" : "") << endl;
+
+ manager.buildCache(repo, force_build ?
+ RepoManager::BuildForced : RepoManager::BuildIfNeeded);
+ }
//cout_n << _("DONE") << endl << endl;
}
}
else if (command == ZypperCommand::REFRESH) {
static struct option refresh_options[] = {
+ {"force", no_argument, 0, 'f'},
+ {"force-build", no_argument, 0, 'b'},
+ {"force-download", no_argument, 0, 'd'},
+ {"build-only", no_argument, 0, 'B'},
+ {"download-only", no_argument, 0, 'D'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}
};
"Refresh repositories specified by their alias or number."
" If none are specified, all enabled repositories will be refreshed.\n"
"\n"
- "This command has no additional options.\n"
+ " Command options:\n"
+ "-f, --force Force a complete refresh\n"
+ "-b, --force-build Force rebuild of the database\n"
+ "-d, --force-download Force download of raw metadata\n"
+ "-B, --build-only Only build the database, don't download metadata.\n"
+ "-D, --download-only Only download raw metadata, don't build the database\n"
);
}
else if (command == ZypperCommand::LIST_UPDATES) {