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