From: Duncan Mac-Vicar P Date: Fri, 3 Aug 2007 15:18:54 +0000 (+0000) Subject: - fix X-Git-Tag: BASE-SuSE-Linux-10_3-Branch~199 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=790970079c3370a8823e01f3d59a5902d9429e34;p=platform%2Fupstream%2Fzypper.git - fix --- diff --git a/VERSION.cmake b/VERSION.cmake index ca3d645..d65dfc4 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -20,4 +20,4 @@ SET(VERSION_MAJOR "0") SET(VERSION_MINOR "8") -SET(VERSION_PATCH "7" +SET(VERSION_PATCH "7") diff --git a/src/zypper-sources.cc b/src/zypper-sources.cc index a1c040f..dfb799d 100644 --- a/src/zypper-sources.cc +++ b/src/zypper-sources.cc @@ -298,7 +298,7 @@ int add_repo(const RepoInfo & repo) { RepoManager manager; - cout_v << format(_("Adding repository '%s'.")) % repo.alias() << endl; + //cout_v << format(_("Adding repository '%s'.")) % repo.alias() << endl; MIL << "Going to add repository: " << repo << endl; try @@ -354,7 +354,8 @@ int add_repo(const RepoInfo & repo) // ---------------------------------------------------------------------------- int add_repo_by_url( const zypp::Url & url, const string & alias, - const string & type, bool enabled, bool refresh ) + const string & type, + tribool enabled, tribool autorefresh) { RepoManager manager; RepoInfo repo; @@ -364,9 +365,12 @@ int add_repo_by_url( const zypp::Url & url, const string & alias, repo.setAlias(alias.empty() ? timestamp() : alias); repo.addBaseUrl(url); - repo.setEnabled(enabled); - repo.setAutorefresh(refresh); - + + if ( enabled != indeterminate ) + repo.setEnabled(enabled); + if ( autorefresh != indeterminate ) + repo.setAutorefresh(autorefresh); + return add_repo(repo); } @@ -374,21 +378,24 @@ int add_repo_by_url( const zypp::Url & url, const string & alias, //! \todo handle zypp exceptions int add_repo_from_file(const std::string & repo_file_url, - bool enabled, bool autorefresh) + tribool enabled, tribool autorefresh) { //! \todo handle local .repo files, validate the URL Url url(repo_file_url); RepoManager manager; list repos = readRepoFile(url); - for (list::iterator it = repos.begin(); + for (list::const_iterator it = repos.begin(); it != repos.end(); ++it) { RepoInfo repo = *it; - repo.setEnabled(enabled); - repo.setAutorefresh(autorefresh); - + MIL << "enabled: " << enabled << " autorefresh: " << autorefresh << endl; + if ( !indeterminate(enabled) ) + repo.setEnabled((enabled == true)); + if ( !indeterminate(autorefresh) ) + repo.setAutorefresh((autorefresh == true)); + MIL << "enabled: " << repo.enabled() << " autorefresh: " << repo.autorefresh() << endl; add_repo(repo); } diff --git a/src/zypper-sources.h b/src/zypper-sources.h index 7907ee0..1b0c3c7 100644 --- a/src/zypper-sources.h +++ b/src/zypper-sources.h @@ -2,7 +2,7 @@ #define ZMART_SOURCES_H #include "zypp/Url.h" - +#include #include "zypper-getopt.h" /** @@ -39,7 +39,7 @@ void refresh_repos(); int add_repo_by_url( const zypp::Url & url, const std::string & alias, const std::string & type = "", - bool enabled = true, bool autorefresh = true ); + boost::tribool enabled = boost::indeterminate, boost::tribool autorefresh = boost::indeterminate); /** * Add repository specified in given repo file on \a repo_file_url. All repos @@ -53,7 +53,7 @@ int add_repo_by_url( const zypp::Url & url, * ZYPPER_EXIT_OK otherwise */ int add_repo_from_file(const std::string & repo_file_url, - bool enabled = true, bool autorefresh = true); + boost::tribool enabled = boost::indeterminate, boost::tribool autorefresh = boost::indeterminate); /** * If ZMD process found, notify user that ZMD is running and that changes