libzypp 17.31.23
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
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
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
139} // namespace zypp
Architecture.
Definition: Arch.h:37
Store and operate with byte count.
Definition: ByteCount.h:31
Edition represents [epoch:]version[-release]
Definition: Edition.h:61
Access to the sat-pools string space.
Definition: IdString.h:43
const char * c_str() const
Conversion to const char *
Definition: IdString.cc:50
std::string asString() const
Conversion to std::string
Definition: IdString.h:98
OnMediaLocation & setDownloadSize(ByteCount val_r)
Set the downloadSize.
OnMediaLocation & setChecksum(CheckSum val_r)
Set the checksum.
OnMediaLocation & setLocation(Pathname filename_r, unsigned medianr_r=1)
Set filename_r and medianr_r (defaults to 1).
BaseVersion & setEdition(const Edition &val_r)
Definition: PackageDelta.h:49
BaseVersion & setSequenceinfo(const std::string &val_r)
Definition: PackageDelta.h:50
const Edition & edition() const
Definition: PackageDelta.h:65
const std::string & name() const
Definition: PackageDelta.h:64
const OnMediaLocation & location() const
Definition: PackageDelta.h:68
const BaseVersion & baseversion() const
Definition: PackageDelta.h:69
const Arch & arch() const
Definition: PackageDelta.h:66
iterator subBegin() const
Iterator to the begin of a sub-structure.
Definition: LookupAttr.cc:470
SolvAttr inSolvAttr() const
The current SolvAttr.
Definition: LookupAttr.cc:357
iterator subEnd() const
Iterator behind the end of a sub-structure.
Definition: LookupAttr.cc:492
Repository inRepo() const
The current Repository.
Definition: LookupAttr.cc:351
static const SolvAttr repositoryDeltaInfo
Definition: SolvAttr.h:169
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:36
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
#define WAR
Definition: Logger.h:97
#define INT
Definition: Logger.h:100