From 24f4eab862e44beec0b175d45261a84b4adb17c9 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Wed, 2 Jul 2014 11:49:01 +0200 Subject: [PATCH] Add global option plus-content --- doc/zypper.8 | 6 ++++++ src/Zypper.cc | 35 +++++++++++++++++++++++++++++++++-- src/Zypper.h | 1 + 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/doc/zypper.8 b/doc/zypper.8 index 81866be..da52a9f 100644 --- a/doc/zypper.8 +++ b/doc/zypper.8 @@ -1816,6 +1816,12 @@ Use an additional repository for this operation. The repository aliased tmp# and named by the specified URI will be added for this operation and removed at the end. You can specify this option multiple times. .TP +.I \ \ \ \ \-\-plus\-content +Additionaly use disabled repositories providing a specific keyword. Disabled repositories are refreshed +and those providing the specifies keyword are temporarily endabled. To enable for example repositories +which may provide additional \fB-debuginfo\fR or \fB-debugsource\fR packages use \fI--plus-content debug\fR. +You can specify this option multiple times. +.TP .I \ \ \ \ \-\-disable\-repositories Do not read metadata from repositories. This option will prevent loading of packages from repositories, thus making zypper work only with the installed diff --git a/src/Zypper.cc b/src/Zypper.cc index 65f141c..e435b2e 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -188,8 +188,10 @@ void print_main_help(Zypper & zypper) static string help_global_repo_options = _(" Repository Options:\n" "\t--no-gpg-checks\t\tIgnore GPG check failures and continue.\n" "\t--gpg-auto-import-keys\tAutomatically trust and import new repository\n" - "\t\t\t\tsigning keys.\n" + "\t\t\t\tsigning keys.\n" "\t--plus-repo, -p \tUse an additional repository.\n" + "\t--plus-content \tAdditionally use disabled repositories providing a specific keyword.\n" + "\t\t\t\tTry '--plus-content debug' to enable repos indicating to provide debug packages.\n" "\t--disable-repositories\tDo not read meta-data from repositories.\n" "\t--no-refresh\t\tDo not refresh the repositories.\n" "\t--no-cd\t\t\tIgnore CD/DVD repositories.\n" @@ -394,6 +396,7 @@ void Zypper::processGlobalOptions() {"disable-system-resolvables", no_argument, 0, 0 }, // REPO OPTIONS {"plus-repo", required_argument, 0, 'p'}, + {"plus-content", required_argument, 0, 0 }, {"disable-repositories", no_argument, 0, 0 }, {"no-refresh", no_argument, 0, 0 }, {"no-cd", no_argument, 0, 0 }, @@ -748,7 +751,7 @@ void Zypper::processGlobalOptions() } } - // additional repositories + // additional repositories by URL if (gopts.count("plus-repo")) { switch (command().toEnum()) @@ -798,6 +801,34 @@ void Zypper::processGlobalOptions() } } + // additional repositories by content (keywords) + if ( gopts.count("plus-content") ) + { + switch ( command().toEnum()) + { + case ZypperCommand::ADD_REPO_e: + case ZypperCommand::REMOVE_REPO_e: + case ZypperCommand::MODIFY_REPO_e: + case ZypperCommand::RENAME_REPO_e: + //case ZypperCommand::REFRESH_e: + case ZypperCommand::CLEAN_e: + case ZypperCommand::REMOVE_LOCK_e: + case ZypperCommand::LIST_LOCKS_e: + { + out().warning(boost::str(format( + // TranslatorExplanation The %s is "--option-name" + _("The %s option has no effect here, ignoring.")) + % "--plus-content")); + break; + } + default: + { + const std::list & content( gopts["plus-content"] ); + _rdata.additional_content_repos.insert( content.begin(), content.end() ); + } + } + } + if (gopts.count("ignore-unknown")) _gopts.ignore_unknown = true; diff --git a/src/Zypper.h b/src/Zypper.h index aef000f..d0474ec 100644 --- a/src/Zypper.h +++ b/src/Zypper.h @@ -131,6 +131,7 @@ struct RuntimeData std::list repos; std::list additional_repos; + std::set additional_content_repos; int patches_count; int security_patches_count; /** -- 2.7.4