libzypp  11.13.5
PackageDelta.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 extern "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 
24 using std::endl;
25 using std::string;
26 
27 
29 namespace zypp
30 {
31 
32  namespace packagedelta
33  {
34 
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 << "Igore 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  << ',' << obj.baseversion().sequenceinfo()
133  << ')';
134  }
135 
137  } // namespace packagedelta
140 } // namespace zypp