// METHOD NAME : Parser::parse
// METHOD TYPE : void
//
- void ProductMetadataParser::parse( const Pathname & file_r )
+ void ProductMetadataParser::parse( const Pathname & file_r, Source_Ref source_r )
{
std::ifstream file(file_r.asString().c_str());
ERR << excpt_r << endl;
throw "Cannot create product object";
}
+
+ prodImpl->_source = source_r;
}
void ProductMetadataParser::parseLine( const string &key, const string &modif, const string &value, map< string, list<string> > &container)
str::split( value, std::back_inserter(container), " ");
}
- Product::Ptr parseContentFile( const Pathname & file_r )
+ Product::Ptr parseContentFile( const Pathname & file_r, Source_Ref source_r )
{
ProductMetadataParser p;
- p.parse( file_r );
+ p.parse( file_r, source_r );
return p.result;
}
/////////////////////////////////////////////////////////////////
* Please access the parser using this method.
* Returns a product from a content file \a file_r
*/
- Product::Ptr parseContentFile( const Pathname & file_r );
+ Product::Ptr parseContentFile( const Pathname & file_r, Source_Ref source_r );
///////////////////////////////////////////////////////////////////
//
* \throw ParseException
* \todo more doc on Ecaptions.
*/
- void parse( const Pathname & file_r);
+ void parse( const Pathname & file_r, Source_Ref source_r);
/* Parse a key.modifier (std::list of std::strings)
* That means, translatable tag with multiple values
* the default modifier will get the modifier of default (LABEL.de, LABEL as LANGUAGE.default)
#include "zypp/source/susetags/PackagesLangParser.h"
#include "zypp/source/susetags/SelectionTagFileParser.h"
#include "zypp/source/susetags/PatternTagFileParser.h"
+#include "zypp/source/susetags/ProductMetadataParser.h"
#include "zypp/SourceFactory.h"
#include "zypp/ZYppCallbacks.h"
report->startData( url() );
+ Pathname p = provideFile(_path + "content");
+
+ SourceFactory factory;
+
+ try {
+ DBG << "Going to parse content file " << p << endl;
+
+ Product::Ptr product = parseContentFile( p, factory.createFrom(this) );
+
+ MIL << "Product: " << product->displayName() << endl;
+ _store.insert( product );
+ }
+ catch (Exception & excpt_r) {
+ ERR << "cannot parse content file" << endl;
+ }
+
#warning We use suse instead of <DATADIR> for now
- Pathname p = provideFile(_path + "suse/setup/descr/packages");
+ p = provideFile(_path + "suse/setup/descr/packages");
DBG << "Going to parse " << p << endl;
PkgContent content( parsePackages( source_r, this, p ) );