Author: dmacvicar Date: Mon Jul 30 23:55:39 2007 New Revision: 6313 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6313&view=rev Log: arch and basearch working Modified: trunk/libzypp/tests/repo/RepoVariables_test.cc trunk/libzypp/zypp/RepoInfo.cc trunk/libzypp/zypp/RepoInfo.h trunk/libzypp/zypp/RepoManager.cc trunk/libzypp/zypp/repo/PackageProvider.cc trunk/libzypp/zypp/repo/RepoVariables.cc Modified: trunk/libzypp/tests/repo/RepoVariables_test.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/repo/RepoVariables_... ============================================================================== --- trunk/libzypp/tests/repo/RepoVariables_test.cc (original) +++ trunk/libzypp/tests/repo/RepoVariables_test.cc Mon Jul 30 23:55:39 2007 @@ -7,13 +7,13 @@ #include <boost/test/parameterized_test.hpp> #include <boost/test/unit_test_log.hpp> +#include "zypp/ZYppFactory.h" #include "zypp/Url.h" #include "zypp/PathInfo.h" #include "zypp/TmpPath.h" #include "zypp/ZConfig.h" #include "zypp/repo/RepoVariables.h" - using std::cout; using std::endl; using std::string; @@ -28,6 +28,10 @@ BOOST_CHECK_EQUAL(replacer("http://foo/$arch/bar"), "http://foo/"+ ZConfig::instance().systemArchitecture().asString() + "/bar"); + + getZYpp()->setArchitecture(Arch("i686")); + BOOST_CHECK_EQUAL(replacer("http://foo/$arch/bar/$basearch"), + "http://foo/i686/bar/i386"); } test_suite* Modified: trunk/libzypp/zypp/RepoInfo.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoInfo.cc?rev=6313... ============================================================================== --- trunk/libzypp/zypp/RepoInfo.cc (original) +++ trunk/libzypp/zypp/RepoInfo.cc Mon Jul 30 23:55:39 2007 @@ -186,7 +186,10 @@ { return _pimpl->alias; } std::string RepoInfo::name() const - { return _pimpl->name; } + { + repo::RepoVariablesStringReplacer replacer; + return replacer(_pimpl->name); + } Pathname RepoInfo::filepath() const { return _pimpl->filepath; } @@ -204,7 +207,19 @@ { return _pimpl->gpgkey_url; } std::set<Url> RepoInfo::baseUrls() const - { return _pimpl->baseUrls; } + { + RepoInfo::url_set replaced_urls; + repo::RepoVariablesUrlReplacer replacer; + for ( url_set::const_iterator it = _pimpl->baseUrls.begin(); + it != _pimpl->baseUrls.end(); + ++it ) + { + replaced_urls.insert(replacer(*it)); + } + return replaced_urls; + + return _pimpl->baseUrls; + } Pathname RepoInfo::path() const { return _pimpl->path; } @@ -233,9 +248,8 @@ { str << "--------------------------------------" << std::endl; str << "- alias : " << alias() << std::endl; - std::set<Url> url_set(baseUrls()); - for ( std::set<Url>::const_iterator it = url_set.begin(); - it != url_set.end(); + for ( urls_const_iterator it = baseUrlsBegin(); + it != baseUrlsEnd(); ++it ) { str << "- url : " << *it << std::endl; @@ -253,23 +267,24 @@ std::ostream & RepoInfo::dumpRepoOn( std::ostream & str ) const { + // we save the original data without variable replacement str << "[" << alias() << "]" << endl; - str << "name=" << name() << endl; + str << "name=" << _pimpl->name << endl; - if ( ! baseUrls().empty() ) + if ( ! _pimpl->baseUrls.empty() ) str << "baseurl="; - for ( urls_const_iterator it = baseUrlsBegin(); - it != baseUrlsEnd(); + for ( url_set::const_iterator it = _pimpl->baseUrls.begin(); + it != _pimpl->baseUrls.end(); ++it ) { str << *it << endl; } - if ( ! path().empty() ) + if ( ! _pimpl->path.empty() ) str << "path="<< path() << endl; - if ( ! (mirrorListUrl().asString().empty()) ) - str << "mirrorlist=" << mirrorListUrl() << endl; + if ( ! (_pimpl->mirrorlist_url.asString().empty()) ) + str << "mirrorlist=" << _pimpl->mirrorlist_url << endl; str << "type=" << type().asString() << endl; str << "enabled=" << (enabled() ? "1" : "0") << endl; Modified: trunk/libzypp/zypp/RepoInfo.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoInfo.h?rev=6313&... ============================================================================== --- trunk/libzypp/zypp/RepoInfo.h (original) +++ trunk/libzypp/zypp/RepoInfo.h Mon Jul 30 23:55:39 2007 @@ -17,6 +17,7 @@ #include <set> #include "zypp/base/PtrTypes.h" #include "zypp/base/Iterator.h" +#include "zypp/base/Deprecated.h" #include "zypp/Pathname.h" #include "zypp/Url.h" @@ -88,7 +89,7 @@ * * \deprecated IMO superfluous as we provide begin/end iterator. */ - std::set<Url> baseUrls() const; + ZYPP_DEPRECATED std::set<Url> baseUrls() const; /** * \short Repository path Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=6... ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Mon Jul 30 23:55:39 2007 @@ -170,7 +170,7 @@ static void assert_urls( const RepoInfo &info ) { - if (info.baseUrls().empty()) + if (info.baseUrlsEmpty()) ZYPP_THROW(RepoNoUrlException()); } Modified: trunk/libzypp/zypp/repo/PackageProvider.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/PackageProvider... ============================================================================== --- trunk/libzypp/zypp/repo/PackageProvider.cc (original) +++ trunk/libzypp/zypp/repo/PackageProvider.cc Mon Jul 30 23:55:39 2007 @@ -90,10 +90,10 @@ Url url; RepoInfo info = _package->repository().info(); // FIXME we only support the first url for now. - if ( info.baseUrls().empty() ) + if ( info.baseUrlsEmpty() ) ZYPP_THROW(Exception("No url in repository.")); else - url = * info.baseUrls().begin(); + url = * info.baseUrlsBegin(); MIL << "provide Package " << _package << endl; ScopedGuard guardReport( newReport() ); @@ -125,10 +125,10 @@ Url url; RepoInfo info = _package->repository().info(); // FIXME we only support the first url for now. - if ( info.baseUrls().empty() ) + if ( info.baseUrlsEmpty() ) ZYPP_THROW(Exception("No url in repository.")); else - url = * info.baseUrls().begin(); + url = * info.baseUrlsBegin(); // check whether to process patch/delta rpms if ( MediaManager::downloads(url) ) Modified: trunk/libzypp/zypp/repo/RepoVariables.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoVariables.c... ============================================================================== --- trunk/libzypp/zypp/repo/RepoVariables.cc (original) +++ trunk/libzypp/zypp/repo/RepoVariables.cc Mon Jul 30 23:55:39 2007 @@ -62,9 +62,22 @@ "$arch", ZConfig::instance().systemArchitecture().asString() ); // $basearch - ZConfig::instance().systemArchitecture(); - ZConfig::instance(); + Arch::CompatSet cset( Arch::compatSet( ZConfig::instance().systemArchitecture() ) ); + Arch::CompatSet::const_iterator it = cset.end(); + --it; + // now at noarch + --it; + + Arch basearch = *it; + if ( basearch == Arch_noarch ) + { + basearch = ZConfig::instance().systemArchitecture(); + } + + newvalue = gsub( newvalue, + "$basearch", + basearch.asString() ); return newvalue; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org