YUMPackageImpl.cc

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00013 #include "zypp/source/yum/YUMPackageImpl.h"
00014 #include "zypp/base/String.h"
00015 #include "zypp/base/Logger.h"
00016 
00017 using namespace std;
00018 using namespace zypp::detail;
00019 using namespace zypp::parser::yum;
00020 
00022 namespace zypp
00023 { 
00024 
00025   namespace source
00026   { 
00027     namespace yum
00028     {
00030       //
00031       //        CLASS NAME : YUMPackageImpl
00032       //
00034 
00037       YUMPackageImpl::YUMPackageImpl(
00038         Source_Ref source_r,
00039         const zypp::parser::yum::YUMPrimaryData & parsed,
00040         const zypp::parser::yum::YUMFileListData & filelist,
00041         const zypp::parser::yum::YUMOtherData & other
00042       )
00043       : _summary(parsed.summary),
00044         _description(parsed.description),
00045         _license_to_confirm(parsed.license_to_confirm), // TODO add to metadata
00046         _buildtime(strtol(parsed.timeBuild.c_str(), 0, 10)),
00047         _buildhost(parsed.buildhost),
00048         _url(parsed.url),
00049         _vendor( parsed.vendor),
00050         _license( parsed.license),
00051         _packager(parsed.packager),
00052         _group(parsed.group),
00053         _changelog(), // TODO
00054         _type(parsed.type),
00055         _authors(parsed.authors),
00056         _keywords( parsed.keywords),
00057         _mediaNumber(strtol(parsed.media.c_str(), 0, 10)),
00058         _checksum(parsed.checksumType,
00059                   parsed.checksum),
00060         _filenames(),
00061         _location(parsed.location),
00062         _delta_rpms(),
00063         _patch_rpms(),
00064 
00065         _install_only(parsed.installOnly),
00066         _source(source_r)
00067 #if 0
00068       : _size_package(strtol(parsed.sizePackage.c_str(), 0, 10)),
00069         _size_archive(strtol(parsed.sizeArchive.c_str(), 0, 10)),
00070         _size_installed(strtol(parsed.sizeInstalled.c_str(), 0, 10)),
00071         _sourcepkg(parsed.sourcerpm),
00072         _dir_sizes(parsed.dirSizes),
00073 #endif
00074       {
00075         for (std::list<FileData>::const_iterator it = filelist.files.begin();
00076              it != filelist.files.end();
00077              it++)
00078         {
00079           _filenames.push_back(it->name);
00080         }
00081         for (std::list<zypp::parser::yum::ChangelogEntry>::const_iterator
00082                 it = other.changelog.begin();
00083              it != other.changelog.end();
00084              it++)
00085         {
00086           _changelog.push_back(ChangelogEntry(strtol(it->date.c_str(), 0, 10),
00087                                               it->author,
00088                                               it->entry));
00089         }
00090       }
00091 
00092       YUMPackageImpl::YUMPackageImpl(
00093         Source_Ref source_r,
00094         const zypp::parser::yum::YUMPatchPackage & parsed
00095       )
00096       : _summary(parsed.summary),
00097         _description(parsed.description),
00098         _license_to_confirm(parsed.license_to_confirm),
00099         _buildtime(strtol(parsed.timeBuild.c_str(), 0, 10)),
00100         _buildhost(parsed.buildhost),
00101         _url(parsed.url),
00102         _vendor( parsed.vendor),
00103         _license( parsed.license),
00104         _packager( parsed.packager),
00105         _group(parsed.group),
00106         _changelog(), // TODO
00107         _type(parsed.type),
00108         _authors(parsed.authors),
00109         _keywords( parsed.keywords),
00110         _mediaNumber(strtol(parsed.media.c_str(), 0, 10)),
00111         _checksum(parsed.checksumType,
00112                   parsed.checksum),
00113         _filenames(),
00114   _location( parsed.plainRpms.empty() ? Pathname() : parsed.plainRpms.front().filename),
00115         _delta_rpms(),
00116         _patch_rpms(),
00117 
00118         _install_only(parsed.installOnly),
00119         _source(source_r)
00120 #if 0
00121       : _size_package( strtol(parsed.sizePackage.c_str(), 0, 10)),
00122         _size_archive( strtol(parsed.sizeArchive.c_str(), 0, 10)),
00123         _size_installed( strtol(parsed.sizeInstalled.c_str(), 0, 10)),
00124         _sourcepkg( parsed.sourcerpm),
00125         _dir_sizes(parsed.dirSizes),
00126 #endif
00127       {
00128         for (std::list<FileData>::const_iterator it = parsed.files.begin();
00129              it != parsed.files.end();
00130              it++)
00131         {
00132           _filenames.push_back(it->name);
00133         }
00134         for (std::list<zypp::parser::yum::YUMPatchRpm>::const_iterator it
00135                 = parsed.patchRpms.begin();
00136              it != parsed.patchRpms.end();
00137              it++)
00138         {
00139           std::list<BaseVersion> base_versions;
00140           for (std::list<YUMBaseVersion>::const_iterator bit
00141                         = it->baseVersions.begin();
00142                bit != it->baseVersions.end();
00143                bit++)
00144           {
00145             Edition base_edition(bit->ver, bit->rel, bit->epoch);
00146             BaseVersion base_version(base_edition,
00147                                      CheckSum("md5", bit->md5sum),
00148                                      strtol(bit->buildtime.c_str(), 0, 10));
00149             base_versions.push_back(base_version);
00150           }
00151           PatchRpm patch(Arch(it->arch),
00152                          it->filename,
00153                          strtol(it->downloadsize.c_str(), 0, 10),
00154                          CheckSum("md5", it->md5sum),
00155                          strtol(it->buildtime.c_str(), 0, 10),
00156                          base_versions,
00157                          strtol(it->media.c_str(), 0, 10)
00158           );
00159           _patch_rpms.push_back(patch);
00160 
00161         }
00162         for (std::list<zypp::parser::yum::YUMDeltaRpm>::const_iterator it
00163                 = parsed.deltaRpms.begin();
00164              it != parsed.deltaRpms.end();
00165              it++)
00166         {
00167           Edition base_edition(it->baseVersion.ver,
00168                                it->baseVersion.rel,
00169                                it->baseVersion.epoch);
00170           BaseVersion base_version(base_edition,
00171                                    CheckSum("md5", it->baseVersion.md5sum),
00172                                    strtol(it->baseVersion.buildtime.c_str(),
00173                                         0, 10));
00174           DeltaRpm delta(Arch(it->arch),
00175                          it->filename,
00176                          strtol(it->downloadsize.c_str(), 0, 10),
00177                          CheckSum("md5", it->md5sum),
00178                          strtol(it->buildtime.c_str(), 0, 10),
00179                          base_version,
00180                          strtol(it->media.c_str(), 0, 10)
00181           );
00182           _delta_rpms.push_back(delta);
00183         }
00184         for (std::list<zypp::parser::yum::ChangelogEntry>::const_iterator
00185                 it = parsed.changelog.begin();
00186              it != parsed.changelog.end();
00187              it++)
00188         {
00189           _changelog.push_back(ChangelogEntry(strtol(it->date.c_str(), 0, 10),
00190                                               it->author,
00191                                               it->entry));
00192         }
00193       }
00194 
00195 
00197       TranslatedText YUMPackageImpl::summary() const
00198       { return _summary; }
00199 
00201       TranslatedText YUMPackageImpl::description() const
00202       { return _description; }
00203 
00205       TranslatedText YUMPackageImpl::licenseToConfirm() const
00206       { return _license_to_confirm; }
00207 
00209       ByteCount YUMPackageImpl::size() const
00210 #warning fixme
00211       { return 0; }
00212 
00214       Date YUMPackageImpl::buildtime() const
00215       { return _buildtime; }
00216 
00218       std::string YUMPackageImpl::buildhost() const
00219       { return _buildhost; }
00220 
00222       Date YUMPackageImpl::installtime() const
00223       { return PackageImplIf::installtime(); }
00224 
00226       std::string YUMPackageImpl::distribution() const
00227 #warning fixme
00228       { return string(); }
00229 
00231       Vendor YUMPackageImpl::vendor() const
00232       { return _vendor; }
00233 
00235       Label YUMPackageImpl::license() const
00236       { return _license; }
00237 
00239       std::string YUMPackageImpl::packager() const
00240       { return _packager; }
00241 
00243       PackageGroup YUMPackageImpl::group() const
00244       { return _group; }
00245 
00247       Changelog YUMPackageImpl::changelog() const
00248       { return _changelog; }
00249 
00251       Pathname YUMPackageImpl::location() const
00252       { return _location; }
00253 
00256       std::string YUMPackageImpl::url() const
00257       { return _url; }
00258 
00260       std::string YUMPackageImpl::os() const
00261       // metadata doesn't priovide this attribute
00262       { return PackageImplIf::os(); }
00263 
00265       Text YUMPackageImpl::prein() const
00266       // metadata doesn't priovide this attribute
00267       { return PackageImplIf::prein(); }
00268 
00270       Text YUMPackageImpl::postin() const
00271       // metadata doesn't priovide this attribute
00272       { return PackageImplIf::postin(); }
00273 
00275       Text YUMPackageImpl::preun() const
00276       // metadata doesn't priovide this attribute
00277       { return PackageImplIf::preun(); }
00278 
00280       Text YUMPackageImpl::postun() const
00281       // metadata doesn't priovide this attribute
00282       { return PackageImplIf::postun(); }
00283 
00285       ByteCount YUMPackageImpl::sourcesize() const
00286 #warning fixme
00287       { return 0; }
00288 
00290       ByteCount YUMPackageImpl::archivesize() const
00291 #warning fixme
00292       { return 0; }
00293 
00295       std::list<std::string> YUMPackageImpl::authors() const
00296       { return _authors; }
00297 
00299       std::list<std::string> YUMPackageImpl::filenames() const
00300       { return _filenames; }
00301 
00303       std::string YUMPackageImpl::type() const
00304       { return _type; }
00305 
00307       std::list<std::string> YUMPackageImpl::keywords() const
00308       { return _keywords; }
00309 
00310       bool YUMPackageImpl::installOnly() const
00311       { return _install_only; }
00312 
00313       unsigned YUMPackageImpl::sourceMediaNr() const
00314       { return _mediaNumber; }
00315 
00316       CheckSum YUMPackageImpl::checksum() const
00317       { return _checksum; }
00318 
00319       std::list<DeltaRpm> YUMPackageImpl::deltaRpms() const
00320       { return _delta_rpms; }
00321 
00322       std::list<PatchRpm> YUMPackageImpl::patchRpms() const
00323       { return _patch_rpms; }
00324 
00325       Source_Ref YUMPackageImpl::source() const
00326       { return _source; }
00327 
00328     } // namespace yum
00330   } // namespace source
00333 } // namespace zypp

Generated on Mon Jun 5 19:10:38 2006 for zypp by  doxygen 1.4.6