libzypp 17.31.23
DeltaCandidates.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9extern "C"
10{
11#include <solv/knownid.h>
12}
13
14#include <iostream>
15#include <zypp/base/Logger.h>
16#include <zypp/Repository.h>
18#include <zypp/sat/Pool.h>
19
20
21using std::endl;
22using namespace zypp::packagedelta;
23
25namespace zypp
26{
28 namespace repo
29 {
30
33 {
34 public:
36 {}
37
38 Impl( const std::list<Repository> & repos, const std::string & pkgname = "" )
40 {}
41
42 std::list<Repository> repos;
43 std::string pkgname;
44
45 private:
46 friend Impl * rwcowClone<Impl>( const Impl * rhs );
48 Impl * clone() const
49 { return new Impl( *this ); }
50 };
52
54 inline std::ostream & operator<<( std::ostream & str, const DeltaCandidates::Impl & obj )
55 {
56 return str << "DeltaCandidates::Impl";
57 }
58
60 //
61 // class DeltaCandidates
62 //
64
66 : _pimpl( new Impl )
67 {}
68
69
70 DeltaCandidates::DeltaCandidates(const std::list<Repository> & repos,
71 const std::string & pkgname)
72 : _pimpl( new Impl(repos, pkgname) )
73 {}
74
76 {}
77
78 std::list<DeltaRpm> DeltaCandidates::deltaRpms(const Package::constPtr & package) const
79 {
80 std::list<DeltaRpm> candidates;
81
82 DBG << "package: " << package << endl;
83 for_( rit, _pimpl->repos.begin(), _pimpl->repos.end() )
84 {
85 sat::LookupRepoAttr q( sat::SolvAttr::repositoryDeltaInfo, *rit );
86 for_( it, q.begin(), q.end() )
87 {
88 if ( _pimpl->pkgname.empty()
89 || it.subFind( sat::SolvAttr(DELTA_PACKAGE_NAME) ).asString() == _pimpl->pkgname )
90 {
91 DeltaRpm delta( it );
92 //DBG << "checking delta: " << delta << endl;
93 if ( ! package
94 || ( package->name() == delta.name()
95 && package->edition() == delta.edition()
96 && package->arch() == delta.arch() ) )
97 {
98 DBG << "got delta candidate: " << delta << endl;
99 candidates.push_back( delta );
100 }
101 }
102 }
103 }
104 return candidates;
105 }
106
107 std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj )
108 {
109 return str << *obj._pimpl;
110 }
111
113 } // namespace repo
116} // namespace zypp
RepoInfoList repos
Definition: RepoManager.cc:285
TraitsType::constPtrType constPtr
Definition: Package.h:38
const Edition & edition() const
Definition: PackageDelta.h:65
const std::string & name() const
Definition: PackageDelta.h:64
const Arch & arch() const
Definition: PackageDelta.h:66
Candidate delta and patches for a package.
std::list< packagedelta::DeltaRpm > deltaRpms(const Package::constPtr &package) const
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
friend std::ostream & operator<<(std::ostream &str, const DeltaCandidates &obj)
iterator end() const
Iterator behind the end of query results.
Definition: LookupAttr.cc:239
iterator begin() const
Iterator to the begin of query results.
Definition: LookupAttr.cc:236
Lightweight repository attribute value lookup.
Definition: LookupAttr.h:258
Solvable attribute keys.
Definition: SolvAttr.h:41
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
DeltaCandidates implementation.
Impl(const std::list< Repository > &repos, const std::string &pkgname="")
std::list< Repository > repos
Impl * clone() const
clone for RWCOW_pointer
std::ostream & operator<<(std::ostream &str, const DeltaCandidates::Impl &obj)
Stream output.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
#define DBG
Definition: Logger.h:95