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
ServiceRepos.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <sstream>
3
#include "
zypp/base/Logger.h
"
4
#include "
zypp/repo/ServiceRepos.h
"
5
#include "
zypp/repo/RepoException.h
"
6
#include "
zypp/media/MediaException.h
"
7
#include "
zypp/parser/RepoFileReader.h
"
8
#include "
zypp/media/MediaManager.h
"
9
#include "
zypp/parser/RepoindexFileReader.h
"
10
#include "
zypp/ExternalProgram.h
"
11
12
using
std::stringstream;
13
using
std::endl;
14
15
namespace
zypp
16
{
17
namespace
repo
18
{
19
20
class
ServiceRepos::Impl
21
{
22
public
:
23
Impl
()
24
{
25
}
26
27
virtual
~Impl
()
28
{
29
}
30
};
31
32
class
RIMServiceRepos
:
public
ServiceRepos::Impl
33
{
34
public
:
35
ServiceRepos::ProcessRepo
_callback
;
36
37
RIMServiceRepos
(
const
ServiceInfo
&service,
38
const
ServiceRepos::ProcessRepo
& callback,
39
const
ProgressData::ReceiverFnc
&progress =
ProgressData::ReceiverFnc
() )
40
:
_callback
(callback)
41
{
42
// repoindex.xml must be fetched always without using cookies (bnc #573897)
43
Url
serviceUrl( service.
url
() );
44
serviceUrl.
setQueryParam
(
"cookies"
,
"0"
);
45
46
// download the repo index file
47
media::MediaManager
mediamanager;
48
media::MediaAccessId
mid = mediamanager.
open
( serviceUrl );
49
mediamanager.
attach
( mid );
50
mediamanager.
provideFile
( mid,
"repo/repoindex.xml"
);
51
Pathname path = mediamanager.
localPath
(mid,
"repo/repoindex.xml"
);
52
parser::RepoindexFileReader
reader(path,
_callback
);
53
mediamanager.
release
( mid );
54
mediamanager.
close
( mid );
55
}
56
57
~RIMServiceRepos
()
58
{
59
60
}
61
};
62
63
class
PluginServiceRepos
:
public
ServiceRepos::Impl
64
{
65
public
:
66
ServiceRepos::ProcessRepo
_callback
;
67
68
PluginServiceRepos
(
const
ServiceInfo
&service,
69
const
ServiceRepos::ProcessRepo
& callback,
70
const
ProgressData::ReceiverFnc
&progress =
ProgressData::ReceiverFnc
() )
71
:
_callback
(callback)
72
{
73
Url
serviceUrl( service.
url
() );
74
stringstream buffer;
75
76
ExternalProgram::Arguments
args;
77
args.reserve( 3 );
78
args.push_back(
"/bin/sh"
);
79
args.push_back(
"-c"
);
80
args.push_back( serviceUrl.getPathName() );
81
ExternalProgramWithStderr
prog( args );
82
prog >> buffer;
83
84
if
( prog.
close
() != 0 )
85
{
86
// ServicePluginInformalException:
87
// Ignore this error but we'd like to report it somehow...
88
std::string errbuffer;
89
prog.
stderrGetUpTo
( errbuffer,
'\0'
);
90
ERR
<<
"Capture plugin error:["
<< endl << errbuffer << endl <<
']'
<< endl;
91
ZYPP_THROW
(
repo::ServicePluginInformalException
(errbuffer));
92
}
93
94
parser::RepoFileReader
parser(buffer,
_callback
);
95
}
96
97
~PluginServiceRepos
()
98
{}
99
};
100
101
102
ServiceRepos::ServiceRepos
(
const
ServiceInfo
&service,
103
const
ServiceRepos::ProcessRepo
& callback,
104
const
ProgressData::ReceiverFnc
&progress)
105
: _impl( (service.type() ==
ServiceType
::PLUGIN) ? (
ServiceRepos
::
Impl
*)(new
PluginServiceRepos
(service, callback, progress)) : (
ServiceRepos
::
Impl
*)(new
RIMServiceRepos
(service, callback, progress)))
106
{
107
}
108
109
ServiceRepos::~ServiceRepos
()
110
{
111
}
112
113
114
}
115
}
zypp
repo
ServiceRepos.cc
Generated by
1.8.1