Author: jkupec
Date: Fri Apr 18 17:50:32 2008
New Revision: 9707
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9707&view=rev
Log:
- allow to force repository per-package using:
zypper install :packagename (fate #302919)
- implies --name, libzypp/solver support needed for --capability
- TODO: check the arguments first and report non-existing repos
Modified:
trunk/zypper/src/zypper-misc.cc
trunk/zypper/src/zypper-misc.h
Modified: trunk/zypper/src/zypper-misc.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=9707&r1=9706&r2=9707&view=diff
==============================================================================
--- trunk/zypper/src/zypper-misc.cc (original)
+++ trunk/zypper/src/zypper-misc.cc Fri Apr 18 17:50:32 2008
@@ -84,10 +84,11 @@
// 2. best arch
// 3. best edition
- // check the version if it's specified
- if (!version.empty() && version != provider->edition().asString()) {
- DBG << format ("Skipping version %s (requested: %s)")
- % provider->edition().asString() % version << endl;
+ // check the repository alias if it's specified
+ if (!_repo.empty() && _repo != provider->repository().info().alias())
+ {
+ DBG << format ("Skipping repository %s (requested: %s)")
+ % provider->repository().info().alias() % _repo << endl;
return true;
}
@@ -131,10 +132,11 @@
// TODO edition, arch
static void mark_for_install(Zypper & zypper,
const ResObject::Kind &kind,
- const std::string &name)
+ const std::string &name,
+ const std::string & repo = "")
{
// name and kind match:
- ProvideProcess installer (ZConfig::instance().systemArchitecture(), "" /*version*/);
+ ProvideProcess installer (ZConfig::instance().systemArchitecture(), repo);
DBG << "Iterating over [" << kind << "]" << name << endl;
invokeOnEach(
God->pool().byIdentBegin(kind, name),
@@ -240,10 +242,11 @@
mark_by_name (Zypper & zypper,
bool install_not_remove,
const ResObject::Kind &kind,
- const string &name )
+ const string &name,
+ const string & repo = "")
{
if (install_not_remove)
- mark_for_install(zypper, kind, name);
+ mark_for_install(zypper, kind, name, repo);
else
mark_for_uninstall(zypper, kind, name);
}
@@ -439,14 +442,24 @@
str.erase(0, 1);
}
+ string::size_type pos;
+
//! \todo force repo with ':'
+ if ((pos = str.rfind(':')) != string::npos)
+ {
+ repo = str.substr(0, pos);
+ str = str.substr(pos + 1);
+ force_by_name = true; // until there is a solver API for this
+ }
- //! \todo force arch with '@'
+ //! \todo force arch with '.' or '@'???
+ if ((pos = str.find('.')) != string::npos)
+ { }
// mark by name by force
if (force_by_name)
{
- mark_by_name (zypper, install_not_remove, kind, str);
+ mark_by_name (zypper, install_not_remove, kind, str, repo);
continue;
}
Modified: trunk/zypper/src/zypper-misc.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.h?rev=9707&r1=9706&r2=9707&view=diff
==============================================================================
--- trunk/zypper/src/zypper-misc.h (original)
+++ trunk/zypper/src/zypper-misc.h Fri Apr 18 17:50:32 2008
@@ -91,12 +91,12 @@
zypp::PoolItem item;
zypp::PoolItem installed_item;
zypp::ResStatus::TransactByValue whoWantsIt;
- std::string version;
+ std::string _repo;
zypp::Arch _architecture;
- ProvideProcess(zypp::Arch arch, const std::string &vers)
+ ProvideProcess(zypp::Arch arch, const std::string & repo)
: whoWantsIt(zypp::ResStatus::USER)
- , version(vers)
+ , _repo(repo)
, _architecture( arch )
{ }
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org