Author: jkupec Date: Sat Apr 12 14:53:07 2008 New Revision: 9566 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9566&view=rev Log: - expose refresh_repo(Zypper,RepoInfo) Modified: trunk/zypper/src/zypper-repos.cc trunk/zypper/src/zypper-repos.h Modified: trunk/zypper/src/zypper-repos.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-repos.cc?rev=9566&r1=9565&r2=9566&view=diff ============================================================================== --- trunk/zypper/src/zypper-repos.cc (original) +++ trunk/zypper/src/zypper-repos.cc Sat Apr 12 14:53:07 2008 @@ -791,7 +791,7 @@ it != repos.end(); ++it) { RepoInfo repo(*it); - + if (!specified.empty()) { bool found = false; @@ -802,7 +802,7 @@ found = true; break; } - + if (!found) { DBG << repo.alias() << "(#" << ") not specified," @@ -811,7 +811,7 @@ continue; } } - + // skip disabled repos if (!repo.enabled()) { @@ -826,43 +826,9 @@ enabled_repo_count--; continue; } - + // do the refresh - - // raw metadata refresh - bool error = false; - if (!copts.count("build-only")) - { - bool force_download = - copts.count("force") || copts.count("force-download"); - - // without this a cd is required to be present in the drive on each refresh - // (or more 'refresh needed' check) - bool is_cd = is_changeable_media(*repo.baseUrlsBegin()); - if (!force_download && is_cd) - { - MIL << "Skipping refresh of a changeable read-only media." << endl; - continue; - } - - MIL << "calling refreshMetadata" << (force_download ? ", forced" : "") - << endl; - - error = refresh_raw_metadata(zypper, repo, force_download); - } - - // db rebuild - if (!(error || copts.count("download-only"))) - { - bool force_build = - copts.count("force") || copts.count("force-build"); - - MIL << "calling buildCache" << (force_build ? ", forced" : "") << endl; - - error = build_cache(zypper, repo, force_build); - } - - if (error) + if (refresh_repo(zypper, repo)) { zypper.out().error(boost::str(format( _("Skipping repository '%s' because of the above error.")) @@ -906,6 +872,46 @@ // ---------------------------------------------------------------------------- +bool refresh_repo(Zypper & zypper, const zypp::RepoInfo & repo) +{ + // raw metadata refresh + bool error = false; + if (!zypper.cOpts().count("build-only")) + { + bool force_download = + zypper.cOpts().count("force") || zypper.cOpts().count("force-download"); + + // without this a cd is required to be present in the drive on each refresh + // (or more 'refresh needed' check) + bool is_cd = is_changeable_media(*repo.baseUrlsBegin()); + if (!force_download && is_cd) + { + MIL << "Skipping refresh of a changeable read-only media." << endl; + return false; + } + + MIL << "calling refreshMetadata" << (force_download ? ", forced" : "") + << endl; + + error = refresh_raw_metadata(zypper, repo, force_download); + } + + // db rebuild + if (!(error || zypper.cOpts().count("download-only"))) + { + bool force_build = + zypper.cOpts().count("force") || zypper.cOpts().count("force-build"); + + MIL << "calling buildCache" << (force_build ? ", forced" : "") << endl; + + error = build_cache(zypper, repo, force_build); + } + + return error; +} + +// ---------------------------------------------------------------------------- + void clean_repos(Zypper & zypper) { RepoManager manager(zypper.globalOpts().rm_options); Modified: trunk/zypper/src/zypper-repos.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-repos.h?rev=9566&r1=9565&r2=9566&view=diff ============================================================================== --- trunk/zypper/src/zypper-repos.h (original) +++ trunk/zypper/src/zypper-repos.h Sat Apr 12 14:53:07 2008 @@ -8,6 +8,8 @@ #include "zypper.h" +#define TMP_RPM_REPO_ALIAS "_tmpRPMcache_" + /** * Initialize rpm database on target, if not already initialized. */ @@ -33,6 +35,12 @@ */ void refresh_repos(Zypper & zypper); +/** + * Refresh a single repository. + * \return true on error, false otherwise + */ +bool refresh_repo(Zypper & zypper, const zypp::RepoInfo & repo); + /** * Clean caches for all (specified) repositories. -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org