1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
13 #include "zypp/base/String.h"
14 #include "zypp/repo/RepoException.h"
15 #include "zypp/ZConfig.h"
16 #include "RepoVariables.h"
25 RepoVariablesStringReplacer::RepoVariablesStringReplacer()
28 RepoVariablesStringReplacer::~RepoVariablesStringReplacer()
31 std::string RepoVariablesStringReplacer::operator()( const std::string &value ) const
33 string newvalue(value);
36 newvalue = str::gsub( newvalue,
38 ZConfig::instance().systemArchitecture().asString() );
41 Arch::CompatSet cset( Arch::compatSet( ZConfig::instance().systemArchitecture() ) );
42 Arch::CompatSet::const_iterator it = cset.end();
48 if ( basearch == Arch_noarch )
50 basearch = ZConfig::instance().systemArchitecture();
53 newvalue = str::gsub( newvalue,
55 basearch.asString() );
59 //////////////////////////////////////////////////////////////////////
61 RepoVariablesUrlReplacer::RepoVariablesUrlReplacer()
64 RepoVariablesUrlReplacer::~RepoVariablesUrlReplacer()
68 Url RepoVariablesUrlReplacer::operator()( const Url &value ) const
70 RepoVariablesStringReplacer replacer;
71 string transformed = replacer(value.asString());
74 newurl = Url(transformed);
76 catch ( const Exception &e )
79 // just return what we got
88 // vim: set ts=2 sts=2 sw=2 et ai: