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(),
00045         _buildtime(strtol(parsed.timeBuild.c_str(), 0, 10)),
00046         _buildhost(parsed.buildhost),
00047         _url(parsed.url),
00048         _vendor( parsed.vendor),
00049         _license( parsed.license),
00050         _packager(parsed.packager),
00051         _group(parsed.group),
00052         _changelog(), // TODO
00053         _type(parsed.type),
00054         _license_to_confirm(), // TODO add to metadata
00055         _authors(parsed.authors),
00056         _keywords( parsed.keywords),
00057         _mediaid(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         _description.setText(parsed.description);
00076         _license_to_confirm = parsed.license_to_confirm.asString();
00077         for (std::list<FileData>::const_iterator it = filelist.files.begin();
00078              it != filelist.files.end();
00079              it++)
00080         {
00081           _filenames.push_back(it->name);
00082         }
00083         for (std::list<zypp::parser::yum::ChangelogEntry>::const_iterator
00084                 it = other.changelog.begin();
00085              it != other.changelog.end();
00086              it++)
00087         {
00088           _changelog.push_back(ChangelogEntry(strtol(it->date.c_str(), 0, 10),
00089                                               it->author,
00090                                               it->entry));
00091         }
00092       }
00093 
00094       YUMPackageImpl::YUMPackageImpl(
00095         Source_Ref source_r,
00096         const zypp::parser::yum::YUMPatchPackage & parsed
00097       )
00098       : _summary(parsed.summary),
00099         _description(),
00100         _buildtime(strtol(parsed.timeBuild.c_str(), 0, 10)),
00101         _buildhost(parsed.buildhost),
00102         _url(parsed.url),
00103         _vendor( parsed.vendor),
00104         _license( parsed.license),
00105         _packager( parsed.packager),
00106         _group(parsed.group),
00107         _changelog(), // TODO
00108         _type(parsed.type),
00109         _license_to_confirm(),
00110         _authors(parsed.authors),
00111         _keywords( parsed.keywords),
00112         _mediaid(strtol(parsed.media.c_str(), 0, 10)),
00113         _checksum(parsed.checksumType,
00114                   parsed.checksum),
00115         _filenames(),
00116   _location( parsed.plainRpms.empty() ? Pathname() : parsed.plainRpms.front().filename),
00117         _delta_rpms(),
00118         _patch_rpms(),
00119 
00120         _install_only(parsed.installOnly),
00121         _source(source_r)
00122 #if 0
00123       : _size_package( strtol(parsed.sizePackage.c_str(), 0, 10)),
00124         _size_archive( strtol(parsed.sizeArchive.c_str(), 0, 10)),
00125         _size_installed( strtol(parsed.sizeInstalled.c_str(), 0, 10)),
00126         _sourcepkg( parsed.sourcerpm),
00127         _dir_sizes(parsed.dirSizes),
00128 #endif
00129       {
00130         _description.setText(parsed.description);
00131         _license_to_confirm = parsed.license_to_confirm.asString();
00132         for (std::list<FileData>::const_iterator it = parsed.files.begin();
00133              it != parsed.files.end();
00134              it++)
00135         {
00136           _filenames.push_back(it->name);
00137         }
00138         for (std::list<zypp::parser::yum::YUMPatchRpm>::const_iterator it
00139                 = parsed.patchRpms.begin();
00140              it != parsed.patchRpms.end();
00141              it++)
00142         {
00143           std::list<BaseVersion> base_versions;
00144           for (std::list<YUMBaseVersion>::const_iterator bit
00145                         = it->baseVersions.begin();
00146                bit != it->baseVersions.end();
00147                bit++)
00148           {
00149             Edition base_edition(bit->ver, bit->rel, bit->epoch);
00150             BaseVersion base_version(base_edition,
00151                                      CheckSum("md5", bit->md5sum),
00152                                      strtol(bit->buildtime.c_str(), 0, 10));
00153             base_versions.push_back(base_version);
00154           }
00155           PatchRpm patch(Arch(it->arch),
00156                          it->filename,
00157                          strtol(it->downloadsize.c_str(), 0, 10),
00158                          CheckSum("md5", it->md5sum),
00159                          strtol(it->buildtime.c_str(), 0, 10),
00160                          base_versions
00161           );
00162           _patch_rpms.push_back(patch);
00163 
00164         }
00165         for (std::list<zypp::parser::yum::YUMDeltaRpm>::const_iterator it
00166                 = parsed.deltaRpms.begin();
00167              it != parsed.deltaRpms.end();
00168              it++)
00169         {
00170           Edition base_edition(it->baseVersion.ver,
00171                                it->baseVersion.rel,
00172                                it->baseVersion.epoch);
00173           BaseVersion base_version(base_edition,
00174                                    CheckSum("md5", it->baseVersion.md5sum),
00175                                    strtol(it->baseVersion.buildtime.c_str(),
00176                                         0, 10));
00177           DeltaRpm delta(Arch(it->arch),
00178                          it->filename,
00179                          strtol(it->downloadsize.c_str(), 0, 10),
00180                          CheckSum("md5", it->md5sum),
00181                          strtol(it->buildtime.c_str(), 0, 10),
00182                          base_version
00183           );
00184           _delta_rpms.push_back(delta);
00185         }
00186         for (std::list<zypp::parser::yum::ChangelogEntry>::const_iterator
00187                 it = parsed.changelog.begin();
00188              it != parsed.changelog.end();
00189              it++)
00190         {
00191           _changelog.push_back(ChangelogEntry(strtol(it->date.c_str(), 0, 10),
00192                                               it->author,
00193                                               it->entry));
00194         }
00195       }
00196 
00197 
00199       TranslatedText YUMPackageImpl::summary() const
00200       { return _summary; }
00201 
00203       TranslatedText YUMPackageImpl::description() const
00204       { return _description; }
00205 
00206       ByteCount YUMPackageImpl::size() const
00207 #warning fixme
00208       { return 0; }
00209 
00211       Date YUMPackageImpl::buildtime() const
00212       { return _buildtime; }
00213 
00215       std::string YUMPackageImpl::buildhost() const
00216       { return _buildhost; }
00217 
00219       Date YUMPackageImpl::installtime() const
00220       { return PackageImplIf::installtime(); }
00221 
00223       std::string YUMPackageImpl::distribution() const
00224 #warning fixme
00225       { return string(); }
00226 
00228       Vendor YUMPackageImpl::vendor() const
00229       { return _vendor; }
00230 
00232       Label YUMPackageImpl::license() const
00233       { return _license; }
00234 
00236       std::string YUMPackageImpl::packager() const
00237       { return _packager; }
00238 
00240       PackageGroup YUMPackageImpl::group() const
00241       { return _group; }
00242 
00244       Changelog YUMPackageImpl::changelog() const
00245       { return _changelog; }
00246 
00248       Pathname YUMPackageImpl::location() const
00249       { return _location; }
00250 
00253       std::string YUMPackageImpl::url() const
00254       { return _url; }
00255 
00257       std::string YUMPackageImpl::os() const
00258       // metadata doesn't priovide this attribute
00259       { return PackageImplIf::os(); }
00260 
00262       Text YUMPackageImpl::prein() const
00263       // metadata doesn't priovide this attribute
00264       { return PackageImplIf::prein(); }
00265 
00267       Text YUMPackageImpl::postin() const
00268       // metadata doesn't priovide this attribute
00269       { return PackageImplIf::postin(); }
00270 
00272       Text YUMPackageImpl::preun() const
00273       // metadata doesn't priovide this attribute
00274       { return PackageImplIf::preun(); }
00275 
00277       Text YUMPackageImpl::postun() const
00278       // metadata doesn't priovide this attribute
00279       { return PackageImplIf::postun(); }
00280 
00282       ByteCount YUMPackageImpl::sourcesize() const
00283 #warning fixme
00284       { return 0; }
00285 
00287       ByteCount YUMPackageImpl::archivesize() const
00288 #warning fixme
00289       { return 0; }
00290 
00292       std::list<std::string> YUMPackageImpl::authors() const
00293       { return _authors; }
00294 
00296       std::list<std::string> YUMPackageImpl::filenames() const
00297       { return _filenames; }
00298 
00299       License YUMPackageImpl::licenseToConfirm() const
00300       { return _license_to_confirm; }
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::mediaId() const
00314       { return _mediaid; }
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 #if 0
00329 
00330       unsigned YUMPackageImpl::packageSize() const
00331       { return _size_package; }
00333       unsigned YUMPackageImpl::archiveSize() const
00334       { return _size_archive; }
00336       unsigned YUMPackageImpl::installedSize() const
00337       { return _size_installed; }
00338 // FIXME do not understand items below
00340       bool YUMPackageImpl::providesSources() const
00341       {
00342         return false;
00343       }
00345       std::string YUMPackageImpl::instSrcLabel() const
00346       {
00347         return "";
00348       }
00350       std::string YUMPackageImpl::instSrcVendor() const
00351       {
00352         return "";
00353       }
00355       unsigned YUMPackageImpl::instSrcRank() const
00356       {
00357         return 0;
00358       }
00360       std::string YUMPackageImpl::buildhost() const
00361       {
00362         return _buildhost;
00363       }
00365       std::string YUMPackageImpl::distribution() const
00366       {
00367         return "";
00368       }
00370       std::string YUMPackageImpl::vendor() const
00371       {
00372         return _vendor;
00373       }
00375       std::string YUMPackageImpl::license() const
00376       {
00377         return _license;
00378       }
00380       std::list<std::string> YUMPackageImpl::licenseToConfirm() const
00381       {
00382         return std::list<std::string>();
00383       }
00385       std::string YUMPackageImpl::packager() const
00386       {
00387         return _packager;
00388       }
00390       std::string YUMPackageImpl::group() const
00391       {
00392         return _group;
00393       }
00395       std::list<std::string> YUMPackageImpl::changelog() const
00396       {}
00398       std::string YUMPackageImpl::url() const
00399       {
00400         return _url;
00401       }
00403       std::string YUMPackageImpl::os() const
00404       {}
00406       std::list<std::string> YUMPackageImpl::prein() const
00407       {}
00409       std::list<std::string> YUMPackageImpl::postin() const
00410       {}
00412       std::list<std::string> YUMPackageImpl::preun() const
00413       {}
00415       std::list<std::string> YUMPackageImpl::postun() const
00416       {}
00418       std::string YUMPackageImpl::sourcepkg() const
00419       { return _sourcepkg; }
00421       std::list<std::string> YUMPackageImpl::authors() const
00422       { return _authors; }
00424       std::list<std::string> YUMPackageImpl::filenames() const
00425       {}
00427       std::string YUMPackageImpl::location() const
00428       {}
00430       std::string YUMPackageImpl::md5sum() const
00431       {}
00433       std::string YUMPackageImpl::externalUrl() const
00434       {}
00436       std::list<Edition> YUMPackageImpl::patchRpmBaseVersions() const
00437       {}
00439       unsigned YUMPackageImpl::patchRpmSize() const
00440       {}
00442       bool YUMPackageImpl::forceInstall() const
00443       {}
00445       std::string YUMPackageImpl::patchRpmMD5() const
00446       {}
00448       bool YUMPackageImpl::isRemote() const
00449       {}
00451       bool YUMPackageImpl::prefererCandidate() const
00452       {}
00453 
00454 #endif
00455 
00456     } // namespace yum
00458   } // namespace source
00461 } // namespace zypp

Generated on Thu May 4 16:03:27 2006 for zypp by  doxygen 1.4.6