From bc72a4d7c078ef147b5202944855d9ed7967c2d9 Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Sat, 6 Oct 2007 10:16:31 +0000 Subject: [PATCH] - don't check if to refresh cd/dvd repos even on user request unless forced --- src/zypper-sources.cc | 14 +++++++++++++- src/zypper-utils.cc | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/zypper-sources.cc b/src/zypper-sources.cc index c05171c..6a6fb47 100644 --- a/src/zypper-sources.cc +++ b/src/zypper-sources.cc @@ -560,19 +560,32 @@ int refresh_repos(vector & arguments) 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(repo, force_download); } + // db rebuild if (!(error || copts.count("download-only"))) { bool force_build = @@ -657,7 +670,6 @@ std::string timestamp () // ---------------------------------------------------------------------------- -//! \todo handle zypp exceptions static int add_repo(RepoInfo & repo) { diff --git a/src/zypper-utils.cc b/src/zypper-utils.cc index e1cbe2d..d90ebb6 100644 --- a/src/zypper-utils.cc +++ b/src/zypper-utils.cc @@ -52,6 +52,7 @@ ostream& report_a_bug (ostream& stm) bool is_changeable_media(const zypp::Url & url) { + MIL << "Checking if this is a changeable medium" << endl; bool is_cd = false; try { @@ -63,7 +64,7 @@ bool is_changeable_media(const zypp::Url & url) catch (const media::MediaException & e) { ZYPP_CAUGHT(e); - WAR << "Could not determine if the URL points to a changeable media" << endl; + WAR << "Could not determine if the URL points to a changeable medium" << endl; } return is_cd; -- 2.7.4