_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;
return true;
}
+ // -------------------------------------------------------------------------
bool YUMParser::primary_CB(const data::Package_Ptr & package_r)
{
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;
return true;
}
+ // -------------------------------------------------------------------------
bool YUMParser::patch_CB(const data::Patch_Ptr & patch)
{
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);
/*
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);
/*
return true;
}
+ // -------------------------------------------------------------------------
void YUMParser::start(const Pathname &cache_dir)
{
_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;
/**
+ * 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) */