libzypp 17.37.17
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 <utility>
16#include <zypp/base/Logger.h>
17#include <zypp/Repository.h>
19#include <zypp/sat/Pool.h>
20
21
22using std::endl;
23using namespace zypp::packagedelta;
24
26namespace zypp
27{
29 namespace repo
30 {
31
34 {
35 public:
37 {}
38
39 Impl( std::list<Repository> &&repos, std::string &&pkgname = "" )
40 : repos(std::move(repos)), pkgname(std::move(pkgname))
41 {}
42
43 std::list<Repository> repos;
44 std::string pkgname;
45
46 private:
47 friend Impl * rwcowClone<Impl>( const Impl * rhs );
49 Impl * clone() const
50 { return new Impl( *this ); }
51 };
52
53
55 inline std::ostream & operator<<( std::ostream & str, const DeltaCandidates::Impl & obj )
56 {
57 return str << "DeltaCandidates::Impl";
58 }
59
61 //
62 // class DeltaCandidates
63 //
65
69
70
71 DeltaCandidates::DeltaCandidates(std::list<Repository> repos,
72 std::string pkgname)
73 : _pimpl( new Impl(std::move(repos), std::move(pkgname)) )
74 {}
75
78
79 std::list<DeltaRpm> DeltaCandidates::deltaRpms(const Package::constPtr & package) const
80 {
81 std::list<DeltaRpm> candidates;
82
83 DBG << "package: " << package << endl;
84 for_( rit, _pimpl->repos.begin(), _pimpl->repos.end() )
85 {
87 for_( it, q.begin(), q.end() )
88 {
89 if ( _pimpl->pkgname.empty()
90 || it.subFind( sat::SolvAttr(DELTA_PACKAGE_NAME) ).asString() == _pimpl->pkgname )
91 {
92 DeltaRpm delta( it );
93 //DBG << "checking delta: " << delta << endl;
94 if ( ! package
95 || ( package->name() == delta.name()
96 && package->edition() == delta.edition()
97 && package->arch() == delta.arch() ) )
98 {
99 DBG << "got delta candidate: " << delta << endl;
100 candidates.push_back( delta );
101 }
102 }
103 }
104 }
105 return candidates;
106 }
107
108 std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj )
109 {
110 return str << *obj._pimpl;
111 }
112
114 } // namespace repo
115
117} // namespace zypp
TraitsType::constPtrType constPtr
Definition Package.h:39
const Edition & edition() const
const std::string & name() const
const Arch & arch() const
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.
iterator begin() const
Iterator to the begin of query results.
Lightweight repository attribute value lookup.
Definition LookupAttr.h:265
Solvable attribute keys.
Definition SolvAttr.h:41
static const SolvAttr repositoryDeltaInfo
Definition SolvAttr.h:181
Definition Arch.h:364
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
DeltaCandidates implementation.
Impl(std::list< Repository > &&repos, std::string &&pkgname="")
friend Impl * rwcowClone(const Impl *rhs)
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:27
#define DBG
Definition Logger.h:99