[zypp-commit] r5575 - in /trunk/libzypp/devel/devel.jkupec: YUMParser.cc YUMParser.h
Author: jkupec Date: Mon May 21 04:54:55 2007 New Revision: 5575 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5575&view=rev Log: comments Modified: trunk/libzypp/devel/devel.jkupec/YUMParser.cc trunk/libzypp/devel/devel.jkupec/YUMParser.h Modified: trunk/libzypp/devel/devel.jkupec/YUMParser.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/YUMParser.cc?rev=5575&r1=5574&r2=5575&view=diff ============================================================================== --- trunk/libzypp/devel/devel.jkupec/YUMParser.cc (original) +++ trunk/libzypp/devel/devel.jkupec/YUMParser.cc Mon May 21 04:54:55 2007 @@ -51,8 +51,10 @@ _ticks.sendTo(progress); } + // ------------------------------------------------------------------------- - bool YUMParser::repomd_CB( const OnMediaLocation &loc, const YUMResourceType &dtype ) + bool YUMParser::repomd_CB( + const OnMediaLocation & loc, const YUMResourceType & dtype) { DBG << "Adding " << dtype << " (" << loc.filename() << ") to YUMParser jobs " << endl; @@ -62,6 +64,7 @@ return true; } + // ------------------------------------------------------------------------- bool YUMParser::primary_CB(const data::Package_Ptr & package_r) { @@ -77,8 +80,10 @@ return true; } + // ------------------------------------------------------------------------- - bool YUMParser::patches_CB(const OnMediaLocation &loc, const string & patch_id) + bool YUMParser::patches_CB( + const OnMediaLocation & loc, const string & patch_id) { DBG << "Adding patch " << loc.filename() << " to YUMParser jobs " << endl; @@ -87,6 +92,7 @@ return true; } + // ------------------------------------------------------------------------- bool YUMParser::patch_CB(const data::Patch_Ptr & patch) { @@ -100,8 +106,10 @@ return true; } + // ------------------------------------------------------------------------- - bool YUMParser::other_CB(const data::Resolvable_Ptr & res_ptr, const Changelog & changelog) + bool YUMParser::other_CB( + const data::Resolvable_Ptr & res_ptr, const Changelog & changelog) { _consumer.consumeChangelog(_catalog_id, res_ptr, changelog); /* @@ -115,8 +123,10 @@ return true; } + // ------------------------------------------------------------------------- - bool YUMParser::filelist_CB(const data::Resolvable_Ptr & res_ptr, const data::Filenames & filenames) + bool YUMParser::filelist_CB( + const data::Resolvable_Ptr & res_ptr, const data::Filenames & filenames) { _consumer.consumeFilelist(_catalog_id, res_ptr, filenames); /* @@ -130,6 +140,7 @@ return true; } + // ------------------------------------------------------------------------- void YUMParser::start(const Pathname &cache_dir) { @@ -146,10 +157,12 @@ _ticks.toMax(); } + // ------------------------------------------------------------------------- void YUMParser::doJobs(const Pathname &cache_dir) { - for(list<YUMParserJob>::const_iterator it = _jobs.begin(); it != _jobs.end(); ++it) + for(list<YUMParserJob>::const_iterator it = _jobs.begin(); + it != _jobs.end(); ++it) { YUMParserJob job = *it; Modified: trunk/libzypp/devel/devel.jkupec/YUMParser.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/YUMParser.h?rev=5575&r1=5574&r2=5575&view=diff ============================================================================== --- trunk/libzypp/devel/devel.jkupec/YUMParser.h (original) +++ trunk/libzypp/devel/devel.jkupec/YUMParser.h Mon May 21 04:54:55 2007 @@ -48,30 +48,121 @@ /** + * YUM metada parser. + * + * Reads repomd.xml file to get the list of files to parse and enques them + * as YUMParserJobs. Then uses *FileReader classes to parse the files and + * a \ref ResolvableDataConsumer to process the read data (typically to + * store them in a database). + * + * + * \code * + * cache::CacheStore store(dbdir); + * data::RecordId catalog_id = store.lookupOrAppendCatalog(sourceurl, "/"); + * + * YUMParser parser(catalog_id, store, &progress_function); + * parser.start(source_cache_dir); + * + * store.commit(); + * + * \code + * + * TODO make the parser configurable, e.g. exclude(FILELISTS_e)? + * + * \see RepomdFileReader, PrimaryFileReader, OtherFileReader + * \see FilelistsFileReader, PatchesFileReader, PatchFileReader */ class YUMParser { public: + + /** + * CTOR + * + * \param catalog_id repository identifier + * \param consumer consumer of parsed data + * \param progress progress reporting function + */ YUMParser( const data::RecordId & catalog_id, data::ResolvableDataConsumer & consumer, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); - void start(const zypp::Pathname & path); + /** + * Starts parsing of repository cache dir located at \a path. + * + * This method uses RepomdFileReader to get a list of parser jobs + * and calls \ref doJobs(Pathname) to do them. + * + * \param path location of the raw repository cache + */ + void start(const Pathname & path); private: - void doJobs(const zypp::Pathname & path); - + /** + * Iterates through parser \ref _jobs and executes them using + * *FileReader classes. + * + * \param path location of the raw repository cache + */ + void doJobs(const Pathname & path); + + /** + * Callback for processing data returned from \ref RepomdFileReader. + * Adds returned files to parser job list (\ref _jobs). + * + * \param loc location of discovered data file + * \param dtype YUM data type + */ bool repomd_CB(const OnMediaLocation & loc, const YUMResourceType & dtype); + + /** + * Callback for processing packages returned from \ref PrimaryFileReader. + * Uses \ref _consumer to process read package data. + * + * \param package_r pointer to package data + */ bool primary_CB(const data::Package_Ptr & package_r); + + /** + * Callback for processing data returned from \ref PatchesFileReader. + * Adds discovered patch*.xml files to parser \ref _jobs. + * + * \param loc location of discovered patch file + * \param patch_id (not used so far) + */ bool patches_CB(const OnMediaLocation &loc, const std::string & patch_id); + + /** + * Callback for processing data returned from \ref PatchFileReader. + * Uses \ref _consumer to process read patch data. + * + * \param patch pointer to patch data + */ bool patch_CB(const data::Patch_Ptr & patch); + + /** + * Callback for processing data returned from \ref OtherFileReader. + * Uses \ref _consumer to process read changelog data. + * + * \param res_ptr resolvable to which the changelog belongs + * \param changelog read changelog + */ bool other_CB(const data::Resolvable_Ptr & res_ptr, const Changelog & changelog); + + /** + * Callback for processing data returned from \ref FilelistsFileReader. + * Uses \ref _consumer to process read filelist. + * + * \param res_ptr resolvable to which the filelist belongs. + * \param filenames the read filelist + */ bool filelist_CB(const data::Resolvable_Ptr & res_ptr, const data::Filenames & filenames); private: + /** Object for processing the read data */ data::ResolvableDataConsumer & _consumer; /** ID of the repository record in the DB (catalogs.id) */ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
jkupec@svn.opensuse.org