Author: jkupec Date: Sun Apr 13 23:06:21 2008 New Revision: 9595 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9595&view=rev Log: - allow zypper install foo-bar-version-release (fate #302919, fate #302148) Modified: trunk/zypper/src/zypper-misc.cc Modified: trunk/zypper/src/zypper-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=9595&r1=9594&r2=9595&view=diff ============================================================================== --- trunk/zypper/src/zypper-misc.cc (original) +++ trunk/zypper/src/zypper-misc.cc Sun Apr 13 23:06:21 2008 @@ -499,10 +499,37 @@ if (force_by_name) by_capability = false; else + { // by capability needed? by_capability = force_by_capability || str.find_first_of("=<>") != string::npos; + // try to find foo-bar-1.2.3-2 + if (!by_capability && str.find('-') != string::npos) + { + string::size_type pos = 0; + while ((pos = str.find('-', pos)) != string::npos) + { + string trythis = str; + trythis.replace(pos, 1, 1, '='); + + DBG << "trying: " << trythis << endl; + + Capability cap = safe_parse_cap (zypper, kind, trythis); + sat::WhatProvides q(cap); + + if (!q.empty()) + { + str = trythis; + DBG << str << "might be what we wanted" << endl; + by_capability = true; + break; + } + ++pos; + } + } + } + Capability cap = safe_parse_cap (zypper, kind, str); sat::WhatProvides q(cap); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org