From 40e10381d02976d66ffd6b8974ed5a43422d4208 Mon Sep 17 00:00:00 2001 From: Stanislav Visnovsky Date: Mon, 13 Feb 2006 17:25:48 +0000 Subject: [PATCH] provide Product resolvable for susetags source --- zypp/source/susetags/ProductMetadataParser.cc | 8 +++++--- zypp/source/susetags/ProductMetadataParser.h | 4 ++-- zypp/source/susetags/SuseTagsImpl.cc | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/zypp/source/susetags/ProductMetadataParser.cc b/zypp/source/susetags/ProductMetadataParser.cc index 4b0be26..3e27788 100644 --- a/zypp/source/susetags/ProductMetadataParser.cc +++ b/zypp/source/susetags/ProductMetadataParser.cc @@ -53,7 +53,7 @@ namespace zypp // 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()); @@ -146,6 +146,8 @@ namespace zypp 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 > &container) @@ -177,10 +179,10 @@ namespace zypp 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; } ///////////////////////////////////////////////////////////////// diff --git a/zypp/source/susetags/ProductMetadataParser.h b/zypp/source/susetags/ProductMetadataParser.h index fd13e29..975add5 100644 --- a/zypp/source/susetags/ProductMetadataParser.h +++ b/zypp/source/susetags/ProductMetadataParser.h @@ -36,7 +36,7 @@ namespace zypp * 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 ); /////////////////////////////////////////////////////////////////// // @@ -55,7 +55,7 @@ namespace zypp * \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) diff --git a/zypp/source/susetags/SuseTagsImpl.cc b/zypp/source/susetags/SuseTagsImpl.cc index e96d97e..ded0296 100644 --- a/zypp/source/susetags/SuseTagsImpl.cc +++ b/zypp/source/susetags/SuseTagsImpl.cc @@ -21,6 +21,7 @@ #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" @@ -110,8 +111,24 @@ namespace zypp 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 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 ) ); -- 2.7.4