From c854859e208ae310daab32ddb21b28f6894c0417 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Tue, 22 May 2007 16:04:40 +0000 Subject: [PATCH] - class to create resolvables from data, for unit tests. --- devel/devel.dmacvicar/CMakeLists.txt | 4 + devel/devel.dmacvicar/YUMReader_tp.cc | 129 +++++++++++ zypp2/CMakeLists.txt | 10 +- zypp2/repository/memory/DPackageImpl.cc | 242 +++++++++++++++++++++ .../memory/{DataPackageImpl.h => DPackageImpl.h} | 52 +++-- zypp2/repository/memory/DPatternImpl.cc | 81 +++++++ zypp2/repository/memory/DPatternImpl.h | 64 ++++++ zypp2/repository/memory/DProductImpl.cc | 111 ++++++++++ zypp2/repository/memory/DProductImpl.h | 102 +++++++++ zypp2/repository/memory/DSrcPackageImpl.cc | 77 +++++++ zypp2/repository/memory/DSrcPackageImpl.h | 66 ++++++ zypp2/repository/memory/DataPackageImpl.cc | 221 ------------------- 12 files changed, 922 insertions(+), 237 deletions(-) create mode 100644 devel/devel.dmacvicar/YUMReader_tp.cc create mode 100644 zypp2/repository/memory/DPackageImpl.cc rename zypp2/repository/memory/{DataPackageImpl.h => DPackageImpl.h} (76%) create mode 100644 zypp2/repository/memory/DPatternImpl.cc create mode 100644 zypp2/repository/memory/DPatternImpl.h create mode 100644 zypp2/repository/memory/DProductImpl.cc create mode 100644 zypp2/repository/memory/DProductImpl.h create mode 100644 zypp2/repository/memory/DSrcPackageImpl.cc create mode 100644 zypp2/repository/memory/DSrcPackageImpl.h delete mode 100644 zypp2/repository/memory/DataPackageImpl.cc diff --git a/devel/devel.dmacvicar/CMakeLists.txt b/devel/devel.dmacvicar/CMakeLists.txt index 2b167df..19409f0 100644 --- a/devel/devel.dmacvicar/CMakeLists.txt +++ b/devel/devel.dmacvicar/CMakeLists.txt @@ -24,6 +24,10 @@ ADD_EXECUTABLE(yum-downloader YUMDownloader_tp.cc) TARGET_LINK_LIBRARIES(yum-downloader zypp ) TARGET_LINK_LIBRARIES(yum-downloader zypp2 ) +ADD_EXECUTABLE(yum-reader YUMReader_tp.cc) +TARGET_LINK_LIBRARIES(yum-reader zypp ) +TARGET_LINK_LIBRARIES(yum-reader zypp2 ) + ADD_EXECUTABLE(cachedsource CachedSource_tp.cc) TARGET_LINK_LIBRARIES(cachedsource zypp ) TARGET_LINK_LIBRARIES(cachedsource zypp2 ) diff --git a/devel/devel.dmacvicar/YUMReader_tp.cc b/devel/devel.dmacvicar/YUMReader_tp.cc new file mode 100644 index 0000000..788f40e --- /dev/null +++ b/devel/devel.dmacvicar/YUMReader_tp.cc @@ -0,0 +1,129 @@ +#include "zypp/ZYpp.h" +#include "zypp/ZYppFactory.h" +#include "zypp/base/Logger.h" +#include "zypp/base/LogControl.h" +#include "zypp/CapFactory.h" +#include "zypp/data/ResolvableDataConsumer.h" +#include "zypp/base/Measure.h" +#include "zypp/detail/ResObjectFactory.h" +#include "zypp2/parser/yum/YUMParser.h" +#include "zypp2/repository/memory/DPackageImpl.h" + + +#undef ZYPP_BASE_LOGGER_LOGGROUP +#define ZYPP_BASE_LOGGER_LOGGROUP "yumparsertest" + +using namespace std; +using namespace zypp; +using namespace zypp::parser::yum; +using zypp::debug::Measure; +using namespace zypp::repository::memory; + +bool progress_function(ProgressData::value_type p) +{ + cout << "Parsing YUM source [" << p << "%]" << endl; +// cout << "\rParsing YUM source [" << p << "%]" << flush; + return true; +} + +class ResolvableConsumer : public data::ResolvableDataConsumer +{ + public: + + typedef detail::ResImplTraits::Ptr PkgImplPtr; + typedef detail::ResImplTraits::Ptr SrcPkgImplPtr; + + ResolvableConsumer() + { + + } + + void collectDeps( Dependencies &deps, const data::Dependencies &data_deps) + { + CapFactory factory; + for ( data::Dependencies::const_iterator i = data_deps.begin(); i != data_deps.end(); ++i ) + { + data::DependencyList list(i->second); + zypp::Dep deptype(i->first); + for ( data::DependencyList::const_iterator it = list.begin(); it != list.end(); ++it ) + { + deps[deptype].insert(factory.fromImpl(*it)); + } + } + } + + virtual ~ResolvableConsumer() + { + + } + + virtual void consumePackage( const data::RecordId &catalog_id, data::Package_Ptr ptr ) + { + PkgImplPtr impl = PkgImplPtr( new DPackageImpl(ptr) ); + Dependencies deps; + collectDeps( deps, ptr->deps ); + + Package::Ptr pkg = detail::makeResolvableFromImpl( NVRAD( ptr->name, ptr->edition, ptr->arch, deps), impl ); + _store.insert(pkg); + } + virtual void consumeProduct( const data::RecordId &catalog_id, data::Product_Ptr ) + { + } + virtual void consumePatch( const data::RecordId &catalog_id, data::Patch_Ptr ) + { + } + virtual void consumeMessage( const data::RecordId &catalog_id, data::Message_Ptr ) + { + + } + + virtual void consumeScript( const data::RecordId &catalog_id, data::Script_Ptr ) + { + + } + + virtual void consumeChangelog( const data::RecordId & catalog_id, const data::Resolvable_Ptr &, const Changelog & ) + { + + } + + virtual void consumeFilelist( const data::RecordId & catalog_id, const data::Resolvable_Ptr &, const data::Filenames & ) + {} + + //virtual void consumeSourcePackage( const data::SrcPackage_Ptr ) = 0; + ResStore _store; +}; + + +int main(int argc, char **argv) +{ + base::LogControl::instance().logfile("yumparsertest.log"); + + if (argc < 2) + { + cout << "usage: yumparsertest path/to/yumsourcedir" << endl << endl; + return 1; + } + + try + { + ZYpp::Ptr z = getZYpp(); + + MIL << "creating PrimaryFileParser" << endl; + Measure parse_primary_timer("primary.xml.gz parsing"); + ResolvableConsumer store; + parser::yum::YUMParser parser( 0, store, &progress_function); + parser.start(argv[1]); + parse_primary_timer.stop(); + + cout << endl; + } + catch ( const Exception &e ) + { + cout << "Oops! " << e.msg() << std::endl; + } + + return 0; +} + +// vim: set ts=2 sts=2 sw=2 et ai: diff --git a/zypp2/CMakeLists.txt b/zypp2/CMakeLists.txt index 31cf9ed..7e3b4d2 100644 --- a/zypp2/CMakeLists.txt +++ b/zypp2/CMakeLists.txt @@ -99,11 +99,17 @@ SET( zypp2_repository_cached_HEADERS ) SET( zypp2_repository_data_SRCS - repository/memory/DataPackageImpl.cc + repository/memory/DPackageImpl.cc + repository/memory/DPatternImpl.cc + repository/memory/DProductImpl.cc + repository/memory/DSrcPackageImpl.cc ) SET( zypp2_repository_data_HEADERS - repository/memory/DataPackageImpl.h + repository/memory/DPackageImpl.h + repository/memory/DPatternImpl.h + repository/memory/DProductImpl.h + repository/memory/DSrcPackageImpl.h ) SET( zypp2_parser_yum_SRCS diff --git a/zypp2/repository/memory/DPackageImpl.cc b/zypp2/repository/memory/DPackageImpl.cc new file mode 100644 index 0000000..1ce6897 --- /dev/null +++ b/zypp2/repository/memory/DPackageImpl.cc @@ -0,0 +1,242 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp2/repository/memory/DPackageImpl.cc + * +*/ + +#include "zypp2/repository/memory/DPackageImpl.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +namespace repository +{ ///////////////////////////////////////////////////////////////// +namespace memory +{ ///////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// +// METHOD NAME : PackageImpl::PackageImpl +// METHOD TYPE : Ctor +// +DPackageImpl::DPackageImpl(data::Package_Ptr ptr) + : + _summary(ptr->summary), + _description(ptr->description), + _insnotify(ptr->insnotify), + _delnotify(ptr->delnotify), + _license_to_confirm(ptr->licenseToConfirm), + _group(ptr->group), + _keywords(), + _authors(ptr->authors), + _size(ptr->installedSize), + _archivesize(ptr->repositoryLocation.fileSize), + _vendor(ptr->vendor), + _license(ptr->license), + _buildtime(ptr->buildTime), + _media_number(ptr->repositoryLocation.mediaNr), + _location(ptr->repositoryLocation.filePath), + _diskusage(), + _checksum(ptr->repositoryLocation.fileChecksum) +{ +} + +/////////////////////////////////////////////////////////////////// +// +// METHOD NAME : PackageImpl::~PackageImpl +// METHOD TYPE : Dtor +// +DPackageImpl::~DPackageImpl() +{} + +TranslatedText DPackageImpl::summary() const +{ + return _summary; +} + +TranslatedText DPackageImpl::description() const +{ + return _description; +} + +TranslatedText DPackageImpl::insnotify() const +{ + return _insnotify; +} + +TranslatedText DPackageImpl::delnotify() const +{ + return _delnotify; +} + +TranslatedText DPackageImpl::licenseToConfirm() const +{ + return _license_to_confirm; +} + +Source_Ref DPackageImpl::source() const +{ + return Source_Ref::noSource; +} + +unsigned DPackageImpl::sourceMediaNr() const +{ + return _media_number; +} + +CheckSum DPackageImpl::checksum() const +{ + return _checksum; +} + +Date DPackageImpl::buildtime() const +{ + return _buildtime; +} + +string DPackageImpl::buildhost() const +{ + return string(); +} + +Date DPackageImpl::installtime() const +{ + return Date(); +} // it was never installed + +string DPackageImpl::distribution() const +{ + return string(); +} + +Vendor DPackageImpl::vendor() const +{ + return string(); +} + +Label DPackageImpl::license() const +{ + return _license; +} + +string DPackageImpl::packager() const +{ + return string(); +} + +PackageGroup DPackageImpl::group() const +{ + return _group; +} + +DPackageImpl::Keywords DPackageImpl::keywords() const +{ + return _keywords; +} + +Changelog DPackageImpl::changelog() const +{ + return Changelog(); +} + +Pathname DPackageImpl::location() const +{ + return _location; +} + +string DPackageImpl::url() const +{ + return string(); +} + +string DPackageImpl::os() const +{ + return string(); +} + +Text DPackageImpl::prein() const +{ + return Text(); +} + +Text DPackageImpl::postin() const +{ + return Text(); +} + +Text DPackageImpl::preun() const +{ + return Text(); +} + +Text DPackageImpl::postun() const +{ + return Text(); +} + +ByteCount DPackageImpl::size() const +{ + return _size; +} + +ByteCount DPackageImpl::sourcesize() const +// FIXME +{ + return 0; +} + +ByteCount DPackageImpl::archivesize() const +{ + return _archivesize; +} + +DiskUsage DPackageImpl::diskusage() const +{ + return _diskusage; +} + +list DPackageImpl::authors() const +{ + return list(); +} + +list DPackageImpl::filenames() const +{ + return list(); +} + +list DPackageImpl::deltaRpms() const +{ + return detail::PackageImplIf::deltaRpms(); +} + +list DPackageImpl::patchRpms() const +{ + return detail::PackageImplIf::patchRpms(); +} + +bool DPackageImpl::installOnly() const +{ + return false; +} + +///////////////////////////////////////////////////////////////// +} // namespace memory +/////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////// +} // namespace +/////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// + diff --git a/zypp2/repository/memory/DataPackageImpl.h b/zypp2/repository/memory/DPackageImpl.h similarity index 76% rename from zypp2/repository/memory/DataPackageImpl.h rename to zypp2/repository/memory/DPackageImpl.h index 911aba6..9d90136 100644 --- a/zypp2/repository/memory/DataPackageImpl.h +++ b/zypp2/repository/memory/DPackageImpl.h @@ -6,13 +6,15 @@ | /_____||_| |_| |_| | | | \---------------------------------------------------------------------*/ +/** \file zypp/source/memory/DPackageImpl.h + * +*/ +#ifndef ZYPP_SOURCE_MEMORYPACKAGEIMPL_H +#define ZYPP_SOURCE_MEMORYPACKAGEIMPL_H -#ifndef ZYPP_REPO_DataPACKAGEIMPL_H -#define ZYPP_REPO_DataPACKAGEIMPL_H - -#include "zypp/data/ResolvableData.h" #include "zypp/detail/PackageImplIf.h" #include "zypp/Source.h" +#include "zypp/data/ResolvableData.h" #include "zypp/DiskUsage.h" #include "zypp/CheckSum.h" @@ -22,17 +24,21 @@ namespace zypp /////////////////////////////////////////////////////////////////// namespace repository { ///////////////////////////////////////////////////////////////// - namespace data + namespace memory { ///////////////////////////////////////////////////////////////// + DEFINE_PTR_TYPE(DImpl); + /////////////////////////////////////////////////////////////////// // - // CLASS NAME : DataPackageImpl + // CLASS NAME : PackageImpl // - struct DataPackageImpl : public zypp::detail::PackageImplIf + /** + */ + struct DPackageImpl : public zypp::detail::PackageImplIf { - DataPackageImpl( zypp::data::Package_Ptr ); - virtual ~DataPackageImpl(); + DPackageImpl( data::Package_Ptr ptr ); + virtual ~DPackageImpl(); /** \name ResObject attributes. */ //@{ @@ -54,7 +60,7 @@ namespace zypp virtual Label license() const; virtual std::string packager() const; virtual PackageGroup group() const; - virtual Keywords keywords() const; + virtual Keywords keywords() const; virtual Changelog changelog() const; virtual Pathname location() const; virtual std::string url() const; @@ -72,14 +78,32 @@ namespace zypp virtual std::list deltaRpms() const; virtual std::list patchRpms() const; virtual bool installOnly() const; - private: - zypp::data::Package_Ptr _data; + + TranslatedText _summary; + TranslatedText _description; + TranslatedText _insnotify; + TranslatedText _delnotify; + TranslatedText _license_to_confirm; + + PackageGroup _group; + Keywords _keywords; + std::list _authors; + ByteCount _size; + ByteCount _archivesize; + Vendor _vendor; + Label _license; + Date _buildtime; + unsigned _media_number; + Pathname _location; + DiskUsage _diskusage; + CheckSum _checksum; +private: }; /////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// - } // namespace Data + } // namespace memory ///////////////////////////////////////////////////////////////// - } // namespace source + } // namespace repository /////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// } // namespace zypp diff --git a/zypp2/repository/memory/DPatternImpl.cc b/zypp2/repository/memory/DPatternImpl.cc new file mode 100644 index 0000000..9a04e83 --- /dev/null +++ b/zypp2/repository/memory/DPatternImpl.cc @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp2/repository/memory/DPatternImpl.cc + * +*/ +#include "zypp2/repository/memory/DPatternImpl.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +namespace repository +{ ///////////////////////////////////////////////////////////////// +namespace memory +{ +/////////////////////////////////////////////////////////////////// +// +// METHOD NAME : PatternImpl::PatternImpl +// METHOD TYPE : Ctor +// +DPatternImpl::DPatternImpl(data::Pattern_Ptr ptr) +{} + +/////////////////////////////////////////////////////////////////// +// +// METHOD NAME : PatternImpl::~PatternImpl +// METHOD TYPE : Dtor +// +DPatternImpl::~DPatternImpl() +{} + +Source_Ref DPatternImpl::source() const +{ + return Source_Ref::noSource; +} + +TranslatedText DPatternImpl::summary() const +{ + return _summary; +} + +TranslatedText DPatternImpl::description() const +{ + return _description; +} + +TranslatedText DPatternImpl::category() const +{ + return _category; +} + +bool DPatternImpl::userVisible() const +{ + return _visible; +} + +Label DPatternImpl::order() const +{ + return _order; +} + +Pathname DPatternImpl::icon() const +{ + return _icon; +} + +///////////////////////////////////////////////////////////////// +} // namespace detail +/////////////////////////////////////////////////////////////////// +} +///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp2/repository/memory/DPatternImpl.h b/zypp2/repository/memory/DPatternImpl.h new file mode 100644 index 0000000..a016661 --- /dev/null +++ b/zypp2/repository/memory/DPatternImpl.h @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp2/repository/memory/DPatternImpl.h + * +*/ +#ifndef ZYPP_DETAIL_MEMORY_PATTERNIMPL_H +#define ZYPP_DETAIL_MEMORY_PATTERNIMPL_H + +#include "zypp/detail/PatternImplIf.h" +#include "zypp/data/ResolvableData.h" +#include "zypp/Source.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace repository + { ///////////////////////////////////////////////////////////////// + namespace memory + { + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : PatternImpl + // + /** + */ + struct DPatternImpl : public zypp::detail::PatternImplIf + { +public: + DPatternImpl(data::Pattern_Ptr ptr); + virtual ~DPatternImpl(); + + virtual TranslatedText summary() const; + virtual TranslatedText description() const; + virtual TranslatedText category() const; + virtual bool userVisible() const; + virtual Label order() const; + virtual Pathname icon() const; + virtual Source_Ref source() const; + + TranslatedText _summary; + TranslatedText _description; + TranslatedText _category; + bool _visible; + std::string _order; + Pathname _icon; + }; + /////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////// + } // namespace memory + /////////////////////////////////////////////////////////////////// + } // namespace repository + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_DETAIL_PATTERNIMPL_H diff --git a/zypp2/repository/memory/DProductImpl.cc b/zypp2/repository/memory/DProductImpl.cc new file mode 100644 index 0000000..8997afe --- /dev/null +++ b/zypp2/repository/memory/DProductImpl.cc @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp2/repository/memory/DProductImpl.cc + * +*/ +#include "zypp2/repository/memory/DProductImpl.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace repository + { ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace memory + { ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : DProductImpl::DProductImpl + // METHOD TYPE : Ctor + // + DProductImpl::DProductImpl(data::Product_Ptr ptr) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : DProductImpl::~DProductImpl + // METHOD TYPE : Dtor + // + DProductImpl::~DProductImpl() + {} + + + std::string DProductImpl::category() const + { + return _category; + } + + Label DProductImpl::vendor() const + { + return _vendor; + } + + TranslatedText DProductImpl::summary() const + { + return _summary; + } + + Source_Ref DProductImpl::source() const + { + return Source_Ref::noSource; + } + + Url DProductImpl::releaseNotesUrl() const + { + return _release_notes_url; + } + + std::list DProductImpl::updateUrls() const + { + return _update_urls; + } + + std::list DProductImpl::extraUrls() const + { + return _extra_urls; + } + + std::list DProductImpl::optionalUrls() const + { + return _optional_urls; + } + + std::list DProductImpl::flags() const + { + return _flags; + } + + TranslatedText DProductImpl::shortName() const + { + return TranslatedText(_shortlabel); + } + + std::string DProductImpl::distributionName() const + { + return _dist_name; + } + + Edition DProductImpl::distributionEdition() const + { + return _dist_version; + } + + ///////////////////////////////////////////////////////////////// + } // namespace memory + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// + } // namespace repository + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp2/repository/memory/DProductImpl.h b/zypp2/repository/memory/DProductImpl.h new file mode 100644 index 0000000..f6ec5a8 --- /dev/null +++ b/zypp2/repository/memory/DProductImpl.h @@ -0,0 +1,102 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp2/repository/memory/DProductImpl.h + * +*/ +#ifndef ZYPP_DETAIL_MEMORY_PRODUCTIMPL_H +#define ZYPP_DETAIL_MEMORY_PRODUCTIMPL_H + +#include + +#include "zypp/CheckSum.h" +#include "zypp/CapSet.h" +#include "zypp/detail/ProductImplIf.h" +#include "zypp/Source.h" +#include "zypp/data/ResolvableData.h" +#include "zypp/TranslatedText.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace repository + { ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace memory + { ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ProductImpl + // + /** + */ + struct DProductImpl : public zypp::detail::ProductImplIf + { + public: + DProductImpl(data::Product_Ptr ptr); + virtual ~DProductImpl(); + + virtual std::string category() const; + virtual Label vendor() const; + virtual TranslatedText summary() const; + virtual Source_Ref source() const; + virtual Url releaseNotesUrl() const; + + virtual std::list updateUrls() const; + virtual std::list extraUrls() const; + virtual std::list optionalUrls() const; + + virtual std::list flags() const; + virtual TranslatedText shortName() const; + virtual std::string distributionName() const; + virtual Edition distributionEdition() const; + + std::string _category; + + std::string _name; + std::string _version; + std::string _dist_name; + Edition _dist_version; + + std::string _base_product; + std::string _base_version; + std::string _you_type; + std::string _shortlabel; + std::string _vendor; + Url _release_notes_url; + + std::list _update_urls; + std::list _extra_urls; + std::list _optional_urls; + + std::map< std::string, std::list > _arch; // map of 'arch : "arch1 arch2 arch3"', arch1 being 'best', arch3 being 'noarch' (ususally) + std::string _default_base; + Dependencies _deps; + std::list _languages; + TranslatedText _summary; + std::string _description_dir; + std::string _data_dir; + std::list _flags; + std::string _language; + std::string _timezone; + + std::map _descr_files_checksums; + std::map _signing_keys; + }; + /////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////// + } // namespace memory + /////////////////////////////////////////////////////////////////// + } // namespace repository + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_DETAIL_PRODUCTIMPL_H diff --git a/zypp2/repository/memory/DSrcPackageImpl.cc b/zypp2/repository/memory/DSrcPackageImpl.cc new file mode 100644 index 0000000..3ca172f --- /dev/null +++ b/zypp2/repository/memory/DSrcPackageImpl.cc @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp2/repository/memory/DSrcPackageImpl.cc + * +*/ +#include "zypp2/repository/memory/DSrcPackageImpl.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +namespace repository +{ ///////////////////////////////////////////////////////////////// +namespace memory +{ ///////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// +// METHOD NAME : SrcPackageImpl::SrcPackageImpl +// METHOD TYPE : Ctor +// +DSrcPackageImpl::DSrcPackageImpl(data::SrcPackage_Ptr ptr) + : _media_number( 1 ) +{} + +/////////////////////////////////////////////////////////////////// +// +// METHOD NAME : SrcPackageImpl::~SrcPackageImpl +// METHOD TYPE : Dtor +// +DSrcPackageImpl::~DSrcPackageImpl() +{} + + +Pathname DSrcPackageImpl::location() const +{ + return _location; +} + +ByteCount DSrcPackageImpl::archivesize() const +{ + return _archivesize; +} + +DiskUsage DSrcPackageImpl::diskusage() const +{ + return _diskusage; +} + +Source_Ref DSrcPackageImpl::source() const +{ + return Source_Ref::noSource; +} + +unsigned DSrcPackageImpl::sourceMediaNr() const +{ + return _media_number; +} + +///////////////////////////////////////////////////////////////// +} // namespace memory +/////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////// +} // namespace +/////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp2/repository/memory/DSrcPackageImpl.h b/zypp2/repository/memory/DSrcPackageImpl.h new file mode 100644 index 0000000..9b47375 --- /dev/null +++ b/zypp2/repository/memory/DSrcPackageImpl.h @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp2/repository/memory/DSrcPackageImpl.h + * +*/ +#ifndef ZYPP_SOURCE_MEMORYSRCPackageIMPL_H +#define ZYPP_SOURCE_MEMORYSRCPackageIMPL_H + +#include "zypp/detail/SrcPackageImplIf.h" +#include "zypp/Source.h" +#include "zypp/DiskUsage.h" +#include "zypp/data/ResolvableData.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace repository + { ///////////////////////////////////////////////////////////////// + namespace memory + { ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : SrcPackageImpl + // + /** + */ + struct DSrcPackageImpl : public zypp::detail::SrcPackageImplIf + { + DSrcPackageImpl(data::SrcPackage_Ptr ptr); + virtual ~DSrcPackageImpl(); + + /** */ + virtual Pathname location() const; + /** */ + virtual ByteCount archivesize() const; + /** */ + virtual DiskUsage diskusage() const; + /** */ + virtual unsigned sourceMediaNr() const; + +private: + ByteCount _archivesize; + unsigned _media_number; + Pathname _location; + DiskUsage _diskusage; +public: + Source_Ref source() const; + }; + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// + } // namespace memory + ///////////////////////////////////////////////////////////////// + } // namespace repository + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SOURCE_MEMORY_SRCPACKAGEIMPL_H diff --git a/zypp2/repository/memory/DataPackageImpl.cc b/zypp2/repository/memory/DataPackageImpl.cc deleted file mode 100644 index b0adf5e..0000000 --- a/zypp2/repository/memory/DataPackageImpl.cc +++ /dev/null @@ -1,221 +0,0 @@ -/*---------------------------------------------------------------------\ -| ____ _ __ __ ___ | -| |__ / \ / / . \ . \ | -| / / \ V /| _/ _/ | -| / /__ | | | | | | | -| /_____||_| |_| |_| | -| | -\---------------------------------------------------------------------*/ - -//#include "zypp/source/Data/DataImpl.h" -#include "zypp2/repository/memory/DataPackageImpl.h" - -using namespace std; -using zypp::data::Package_Ptr; -/////////////////////////////////////////////////////////////////// -namespace zypp -{ ///////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -namespace repository -{ ///////////////////////////////////////////////////////////////// -namespace data -{ ///////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// -// METHOD NAME : PackageImpl::PackageImpl -// METHOD TYPE : Ctor -// -DataPackageImpl::DataPackageImpl( zypp::data::Package_Ptr data) - : _data(data) -{} - -/////////////////////////////////////////////////////////////////// -// -// METHOD NAME : PackageImpl::~PackageImpl -// METHOD TYPE : Dtor -// -DataPackageImpl::~DataPackageImpl() -{} - -TranslatedText DataPackageImpl::summary() const -{ - return _data->summary; -} - -TranslatedText DataPackageImpl::description() const -{ - return _data->description; -} - -TranslatedText DataPackageImpl::insnotify() const -{ - return TranslatedText(); -} - -TranslatedText DataPackageImpl::delnotify() const -{ - return TranslatedText(); -} - -TranslatedText DataPackageImpl::licenseToConfirm() const -{ - return TranslatedText(); -} - -Source_Ref DataPackageImpl::source() const -{ - return Source_Ref::noSource; -} - -unsigned DataPackageImpl::sourceMediaNr() const -{ - return _data->repositoryLocation.mediaNr; -} - -CheckSum DataPackageImpl::checksum() const -{ - return _data->repositoryLocation.fileChecksum; -} - -Date DataPackageImpl::buildtime() const -{ - return Date(); -} - -std::string DataPackageImpl::buildhost() const -{ - return _data->buildhost; -} - -Date DataPackageImpl::installtime() const -{ - return Date(); -} // it was never installed - -std::string DataPackageImpl::distribution() const -{ - return _data->distribution; -} - -Vendor DataPackageImpl::vendor() const -{ - return _data->vendor; -} - -Label DataPackageImpl::license() const -{ - return _data->license; -} - -std::string DataPackageImpl::packager() const -{ - return std::string(); -} - -PackageGroup DataPackageImpl::group() const -{ - return _data->group; -} - -DataPackageImpl::Keywords DataPackageImpl::keywords() const -{ - return std::set(); -} - -Changelog DataPackageImpl::changelog() const -{ - return Changelog(); -} - -Pathname DataPackageImpl::location() const -{ - return _data->repositoryLocation.filePath; -} - -std::string DataPackageImpl::url() const -{ - return _data->url; -} - -std::string DataPackageImpl::os() const -{ - return _data->operatingSystem; -} - -Text DataPackageImpl::prein() const -{ - return _data->prein; -} - -Text DataPackageImpl::postin() const -{ - return _data->postin; -} - -Text DataPackageImpl::preun() const -{ - return _data->preun; -} - -Text DataPackageImpl::postun() const -{ - return _data->postun; -} - -ByteCount DataPackageImpl::size() const -{ - return _data->repositoryLocation.fileSize; -} - -ByteCount DataPackageImpl::sourcesize() const -// FIXME -{ - return 0; -} - -ByteCount DataPackageImpl::archivesize() const -{ - return 0; -} - -DiskUsage DataPackageImpl::diskusage() const -{ - return DiskUsage(); -} - -std::list DataPackageImpl::authors() const -{ - return _data->authors; -} - -std::list DataPackageImpl::filenames() const -{ - return std::list(); -} - -std::list DataPackageImpl::deltaRpms() const -{ - return detail::PackageImplIf::deltaRpms(); -} - -std::list DataPackageImpl::patchRpms() const -{ - return detail::PackageImplIf::patchRpms(); -} - -bool DataPackageImpl::installOnly() const -{ - return false; -} - -///////////////////////////////////////////////////////////////// -} // namespace Data -/////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////// -} // namespace -/////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////// -} // namespace zypp -/////////////////////////////////////////////////////////////////// -- 2.7.4