libzypp: zypp/repo/PackageDelta.cc Source File

libzypp 17.36.6

PackageDelta.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13extern "C"
14{
15#include <solv/knownid.h>
16}
17
18#include <zypp/base/LogTools.h>
19
20#include <zypp/repo/PackageDelta.h>
21#include <zypp/sat/Pool.h>
22
23
24using std::endl;
25using std::string;
26
27
29namespace zypp
30{
32 namespace packagedelta
33 {
34
35 DeltaRpm::DeltaRpm( const sat::LookupAttr::iterator& deltaInfo_r )
36 {
37 if ( deltaInfo_r.inSolvAttr() != sat::SolvAttr::repositoryDeltaInfo )
38 {
39 INT << "Illegal non-repositoryDeltaInfo iterator: " << deltaInfo_r << endl;
40 return;
41 }
42 _repo = deltaInfo_r.inRepo();
43
44 IdString locdir;
45 IdString locname;
46 IdString locevr;
47 IdString locsuffix;
48
49 IdString seqname;
50 IdString seqevr;
51 std::string seqnum;
52
53 for_( it, deltaInfo_r.subBegin(), deltaInfo_r.subEnd() )
54 {
55 switch ( it.inSolvAttr().id() )
56 {
57 case DELTA_PACKAGE_NAME:
58 _name = it.asString();
59 break;
60
61 case DELTA_PACKAGE_EVR:
62 _edition = Edition( it.idStr() );
63 break;
64
65 case DELTA_PACKAGE_ARCH:
66 _arch = Arch( it.idStr() );
67 break;
68
69 case DELTA_LOCATION_DIR:
70 locdir = it.idStr();
71 break;
72
73 case DELTA_LOCATION_NAME:
74 locname = it.idStr();
75 break;
76
77 case DELTA_LOCATION_EVR:
78 locevr = it.idStr();
79 break;
80
81 case DELTA_LOCATION_SUFFIX:
82 locsuffix = it.idStr();
83 break;
84
85 case DELTA_DOWNLOADSIZE:
86 _location.setDownloadSize( ByteCount( it.asUnsignedLL() ) );
87 break;
88
89 case DELTA_CHECKSUM:
90 _location.setChecksum( it.asCheckSum() );
91 break;
92
93 case DELTA_BASE_EVR:
94 _baseversion.setEdition( Edition( it.idStr() ) );
95 break;
96
97 case DELTA_SEQ_NAME:
98 seqname = it.idStr();
99 break;
100
101 case DELTA_SEQ_EVR:
102 seqevr = it.idStr();
103 break;
104
105 case DELTA_SEQ_NUM:
106 seqnum = it.asString();
107 break;
108
109 default:
110 WAR << "Ignore unknown attribute: " << it << endl;
111 }
112 }
113
114 _location.setLocation( str::form( "%s/%s-%s.%s",
115 locdir.c_str(),
116 locname.c_str(),
117 locevr.c_str(),
118 locsuffix.c_str() ) );
119
120 _baseversion.setSequenceinfo( str::form( "%s-%s-%s",
121 seqname.c_str(),
122 seqevr.c_str(),
123 seqnum.c_str() ) );
124 }
125
126 std::ostream & operator<<( std::ostream & str, const DeltaRpm & obj )
127 {
128 return str
129 << "DeltaRpm[" << obj.name() << "-" << obj.edition() << "." << obj.arch()
130 << "](" << obj.location()
131 << '|' << obj.baseversion().edition()
132 << ')';
133 }
134
136 } // namespace packagedelta
137
139} // namespace zypp
PackageDelta.h
Pool.h
zypp::Arch
Architecture.
Definition Arch.h:37
zypp::ByteCount
Store and operate with byte count.
Definition ByteCount.h:32
zypp::Edition
Edition represents [epoch:]version[-release]
Definition Edition.h:61
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:44
zypp::IdString::c_str
const char * c_str() const
Conversion to const char *
Definition IdString.cc:50
zypp::IdString::asString
std::string asString() const
Conversion to std::string
Definition IdString.h:99
zypp::packagedelta::DeltaRpm::BaseVersion::edition
const Edition & edition() const
Definition PackageDelta.h:45
zypp::packagedelta::DeltaRpm::edition
const Edition & edition() const
Definition PackageDelta.h:65
zypp::packagedelta::DeltaRpm::_repo
Repository _repo
Definition PackageDelta.h:85
zypp::packagedelta::DeltaRpm::name
const std::string & name() const
Definition PackageDelta.h:64
zypp::packagedelta::DeltaRpm::location
const OnMediaLocation & location() const
Definition PackageDelta.h:68
zypp::packagedelta::DeltaRpm::_edition
Edition _edition
Definition PackageDelta.h:81
zypp::packagedelta::DeltaRpm::_location
OnMediaLocation _location
Definition PackageDelta.h:83
zypp::packagedelta::DeltaRpm::baseversion
const BaseVersion & baseversion() const
Definition PackageDelta.h:69
zypp::packagedelta::DeltaRpm::arch
const Arch & arch() const
Definition PackageDelta.h:66
zypp::packagedelta::DeltaRpm::_baseversion
BaseVersion _baseversion
Definition PackageDelta.h:84
zypp::packagedelta::DeltaRpm::_name
std::string _name
Definition PackageDelta.h:80
zypp::packagedelta::DeltaRpm::DeltaRpm
DeltaRpm()
Definition PackageDelta.h:58
zypp::packagedelta::DeltaRpm::_arch
Arch _arch
Definition PackageDelta.h:82
zypp::sat::LookupAttr::iterator
Result iterator.
Definition LookupAttr.h:364
zypp::sat::LookupAttr::iterator::subBegin
iterator subBegin() const
Iterator to the begin of a sub-structure.
Definition LookupAttr.cc:471
zypp::sat::LookupAttr::iterator::inSolvAttr
SolvAttr inSolvAttr() const
The current SolvAttr.
Definition LookupAttr.cc:358
zypp::sat::LookupAttr::iterator::subEnd
iterator subEnd() const
Iterator behind the end of a sub-structure.
Definition LookupAttr.cc:493
zypp::sat::LookupAttr::iterator::inRepo
Repository inRepo() const
The current Repository.
Definition LookupAttr.cc:352
zypp::sat::SolvAttr::repositoryDeltaInfo
static const SolvAttr repositoryDeltaInfo
Definition SolvAttr.h:181
str
String related utilities and Regular expression matching.
zypp::packagedelta
Definition PackageDelta.cc:33
zypp::packagedelta::operator<<
std::ostream & operator<<(std::ostream &str, const DeltaRpm &obj)
Definition PackageDelta.cc:126
zypp::str::form
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition String.cc:37
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
WAR
#define WAR
Definition Logger.h:101
INT
#define INT
Definition Logger.h:104
LogTools.h