Author: jkupec Date: Thu Jan 24 14:04:14 2008 New Revision: 8362 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8362&view=rev Log: - fixed zypper install three-char-string (zypper thought is was an RPM) - improved RPM install a bit Modified: trunk/zypper/src/zypper-utils.cc trunk/zypper/src/zypper.cc Modified: trunk/zypper/src/zypper-utils.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-utils.cc?rev=8362&r1=8361&r2=8362&view=diff ============================================================================== --- trunk/zypper/src/zypper-utils.cc (original) +++ trunk/zypper/src/zypper-utils.cc Thu Jan 24 14:04:14 2008 @@ -166,19 +166,23 @@ } catch ( const Exception & excpt_r ) { ZYPP_CAUGHT( excpt_r ); - cerr << _("Given URL is invalid.") << endl; - cerr << excpt_r.asUserString() << endl; + cerr << _("Given URL is invalid") << ": " << urlstr + << " (" << excpt_r.asUserString() << ")" << endl; } return u; } // ---------------------------------------------------------------------------- -bool looks_like_rpm_file(const std::string & s) +bool looks_like_rpm_file(const string & s) { - if (s.rfind(".rpm") == s.size() - 4 || - s.find("./") == 0 || - s.find("../") == 0 || + // don't even bother to check strings shorter than 4 chars. + if (s.size() <= 4) + return false; + + if (s.rfind(".rpm") == s.size() - 4 || // ends with .rpm + s.find("./") == 0 || // starts with ./, ../, or / indicating + s.find("../") == 0 || // a local path s.find("/") == 0) return true; @@ -221,7 +225,7 @@ catch (const Exception & e) { report_problem(e, - _("Problem downloading the specified RPM file."), + _("Problem downloading the specified RPM file") + string(":"), _("Please check whether the file is accessible.")); } Modified: trunk/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=8362&r1=8361&r2=8362&view=diff ============================================================================== --- trunk/zypper/src/zypper.cc (original) +++ trunk/zypper/src/zypper.cc Thu Jan 24 14:04:14 2008 @@ -1658,6 +1658,10 @@ if (looks_like_rpm_file(*it)) { DBG << *it << " looks like rpm file" << endl; + cout_v << format( + _("'%s' looks like an RPM file. Will try to download it.")) % *it + << endl; + // download the rpm into the cache //! \todo do we want this or a tmp dir? What about the files cached before? //! \todo optimize: don't mount the same media multiple times for each rpm @@ -1667,7 +1671,7 @@ if (rpmpath.empty()) { - cerr << format(_("Problem with the RPM file specified as %s, skipping.")) + cerr << format(_("Problem with the RPM file specified as '%s', skipping.")) % *it << endl; } else @@ -1719,6 +1723,13 @@ gData.additional_repos.push_back(repo); } + // no rpms and no other arguments either + else if (_arguments.empty()) + { + cout << _("No valid arguments specified.") << endl; + setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); + return; + } //! \todo quit here if the argument list remains empty after founding only invalid rpm args -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org