libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libzypp
Welcome to libzypp
Code Pitfalls - Frequently made mistakes
Code Snippets
Environment Variables
Testing for provided features.
Notes on revisions
Extending ZYpp: Plugins and Hooks
Services
Solver - Vendor protection
Writing and tunning testcases
Libzypp and threads
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
zypp
base
media
misc
parser
pool
repo
susetags
yum
Applydeltarpm.cc
Applydeltarpm.h
DeltaCandidates.cc
DeltaCandidates.h
Downloader.cc
Downloader.h
MediaInfoDownloader.cc
MediaInfoDownloader.h
PackageDelta.cc
PackageDelta.h
PackageProvider.cc
PackageProvider.h
PluginServices.cc
PluginServices.h
RepoException.cc
RepoException.h
RepoInfoBase.cc
RepoInfoBase.h
RepoInfoBaseImpl.h
RepoMirrorList.cc
RepoMirrorList.h
RepoProvideFile.cc
RepoProvideFile.h
RepoType.cc
RepoType.h
RepoVariables.cc
RepoVariables.h
ServiceRepos.cc
ServiceRepos.h
ServiceType.cc
ServiceType.h
SrcPackageProvider.cc
SrcPackageProvider.h
SUSEMediaVerifier.cc
SUSEMediaVerifier.h
sat
solver
target
thread
ui
url
ws
zypp_detail
APIConfig.h
Arch.cc
Arch.h
AutoDispose.h
Bit.h
ByteCount.cc
ByteCount.h
Callback.h
Capabilities.cc
Capabilities.h
Capability.cc
Capability.h
CapMatch.cc
CapMatch.h
Changelog.cc
Changelog.h
CheckSum.cc
CheckSum.h
CountryCode.cc
CountryCode.h
Date.cc
Date.h
Dep.cc
Dep.h
Digest.cc
Digest.h
DiskUsage.cc
DiskUsage.h
DiskUsageCounter.cc
DiskUsageCounter.h
DownloadMode.cc
DownloadMode.h
Edition.cc
Edition.h
ExternalProgram.cc
ExternalProgram.h
Fetcher.cc
Fetcher.h
FileChecker.cc
FileChecker.h
Filter.h
Glob.cc
Glob.h
HistoryLog.cc
HistoryLog.h
HistoryLogData.cc
HistoryLogData.h
IdString.cc
IdString.h
IdStringType.h
InstanceId.cc
InstanceId.h
KeyContext.h
KeyRing.cc
KeyRing.h
KVMap.h
LanguageCode.cc
LanguageCode.h
Locale.cc
Locale.h
Locks.cc
Locks.h
ManagedFile.h
MediaProducts.cc
MediaProducts.h
MediaSetAccess.cc
MediaSetAccess.h
Misc.h
OnMediaLocation.cc
OnMediaLocation.h
Package.cc
Package.h
PackageKeyword.h
Patch.cc
Patch.h
PathInfo.cc
PathInfo.h
Pathname.cc
Pathname.h
Pattern.cc
Pattern.h
PluginFrame.cc
PluginFrame.h
PluginFrameException.cc
PluginFrameException.h
PluginScript.cc
PluginScript.h
PluginScriptException.cc
PluginScriptException.h
PoolItem.cc
PoolItem.h
PoolItemBest.cc
PoolItemBest.h
PoolQuery.cc
PoolQuery.h
PoolQueryResult.cc
PoolQueryResult.h
PoolQueryUtil.tcc
ProblemSolution.cc
ProblemSolution.h
ProblemTypes.h
Product.cc
Product.h
ProgressData.cc
ProgressData.h
ProvideFilePolicy.cc
ProvideFilePolicy.h
PublicKey.cc
PublicKey.h
Range.cc
Range.h
Rel.cc
Rel.h
RelCompare.h
RepoInfo.cc
RepoInfo.h
RepoManager.cc
RepoManager.h
Repository.cc
Repository.h
RepoStatus.cc
RepoStatus.h
ResFilters.h
ResKind.cc
ResKind.h
ResObject.cc
ResObject.h
ResObjects.h
Resolvable.cc
Resolvable.h
Resolver.cc
Resolver.h
ResolverProblem.cc
ResolverProblem.h
ResPool.cc
ResPool.h
ResPoolProxy.cc
ResPoolProxy.h
ResStatus.cc
ResStatus.h
ResTraits.h
ServiceInfo.cc
ServiceInfo.h
Signature.cc
Signature.h
SrcPackage.cc
SrcPackage.h
SysContent.cc
SysContent.h
Target.cc
Target.h
TmpPath.cc
TmpPath.h
TriBool.h
Url.cc
Url.h
Vendor.h
VendorAttr.cc
VendorAttr.h
VendorSupportOptions.cc
VendorSupportOptions.h
ZConfig.cc
ZConfig.h
ZYpp.cc
ZYpp.h
ZYppCallbacks.h
ZYppCommit.h
ZYppCommitPolicy.cc
ZYppCommitPolicy.h
ZYppCommitResult.cc
ZYppCommitResult.h
ZYppFactory.cc
ZYppFactory.h
File Members
RepoVariables.cc
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
9
10
#include "
zypp/base/LogTools.h
"
11
#include "
zypp/base/String.h
"
12
13
#include "
zypp/ZConfig.h
"
14
#include "
zypp/Target.h
"
15
#include "
zypp/Arch.h
"
16
#include "
zypp/repo/RepoVariables.h
"
17
#include "
zypp/base/NonCopyable.h
"
18
20
namespace
zypp
21
{
23
namespace
repo
24
{
26
namespace
27
{
30
struct
ReplacerData :
private
zypp::base::NonCopyable
31
{
32
const
std::string & sysarch()
const
33
{
34
if
(
_sysarch
.empty() )
35
initArchStr();
36
return
_sysarch
;
37
}
38
39
const
std::string & basearch()
const
40
{
41
if
(
_basearch
.empty() )
42
initArchStr();
43
return
_basearch
;
44
}
45
46
const
std::string & releasever()
const
47
{
48
if
(
_releasever
.empty() )
49
_releasever
=
Target::distributionVersion
( Pathname()
/*guess*/
);
50
return
_releasever
;
51
}
52
53
private
:
54
void
initArchStr()
const
55
{
56
Arch arch(
ZConfig::instance
().systemArchitecture() );
57
_sysarch
= arch.asString();
58
_basearch
= arch.baseArch().asString();
59
}
60
private
:
61
mutable
std::string
_sysarch
;
62
mutable
std::string
_basearch
;
63
mutable
std::string
_releasever
;
64
};
65
71
std::string replacer(
const
std::string & value_r )
72
{
73
static
ReplacerData
_data
;
74
75
std::string ret( value_r );
76
// Don't need to capture static (non automatic) _data in lambda
77
ret =
str::replaceAllFun
( ret,
"$arch"
, []()-> std::string {
return
_data.sysarch(); } );
78
ret =
str::replaceAllFun
( ret,
"$basearch"
, []()-> std::string {
return
_data.basearch(); } );
79
ret =
str::replaceAllFun
( ret,
"$releasever"
, []()-> std::string {
return
_data.releasever(); } );
80
return
ret;
81
}
82
83
}
// namespace
85
86
std::string
RepoVariablesStringReplacer::operator()
(
const
std::string & value )
const
87
{
88
return
replacer( value );
89
}
90
91
Url
RepoVariablesUrlReplacer::operator()
(
const
Url
& value )
const
92
{
93
Url
newurl( value );
94
newurl.
setPathData
( replacer( value.
getPathData
() ) );
95
newurl.
setQueryString
( replacer( value.
getQueryString
() ) );
96
return
newurl;
97
}
98
99
}
// namespace repo
101
}
// namespace zypp
zypp
repo
RepoVariables.cc
Generated by
1.8.1