set the source for patterns and selections
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 16 Mar 2006 14:29:38 +0000 (14:29 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 16 Mar 2006 14:29:38 +0000 (14:29 +0000)
zypp/source/susetags/PatternTagFileParser.cc
zypp/source/susetags/PatternTagFileParser.h
zypp/source/susetags/SelectionTagFileParser.cc
zypp/source/susetags/SelectionTagFileParser.h
zypp/source/susetags/SuseTagsImpl.cc
zypp/source/susetags/SuseTagsPatternImpl.cc
zypp/source/susetags/SuseTagsPatternImpl.h
zypp/source/susetags/SuseTagsSelectionImpl.cc
zypp/source/susetags/SuseTagsSelectionImpl.h

index 7f55d53..bdf1556 100644 (file)
@@ -40,7 +40,7 @@ namespace zypp
     namespace susetags
     { /////////////////////////////////////////////////////////////////
 
-      Pattern::Ptr parsePattern( const Pathname & file_r )
+      Pattern::Ptr parsePattern(  Source_Ref source_r, const Pathname & file_r )
       {
         MIL << "Starting to parse pattern " << file_r << std::endl;
         PatternTagFileParser p;
@@ -54,6 +54,8 @@ namespace zypp
           ERR << "Pattern " << file_r << " is broken." << std::endl;
           return 0L;
         }
+        // attach the source
+        p.patImpl->_source = source_r;
         return p.result;
       }
 
index 38d696e..e6cd8f1 100644 (file)
@@ -56,7 +56,7 @@ namespace zypp
       /**
        * returns null if parse fails
        */
-      Pattern::Ptr parsePattern( const Pathname & file_r );
+      Pattern::Ptr parsePattern( Source_Ref source_r, const Pathname & file_r );
       /////////////////////////////////////////////////////////////////
     } // namespace source
     ///////////////////////////////////////////////////////////////////
index 44eeee4..6144540 100644 (file)
@@ -41,7 +41,7 @@ namespace zypp
     namespace susetags
     { /////////////////////////////////////////////////////////////////
 
-      Selection::Ptr parseSelection( const Pathname & file_r )
+      Selection::Ptr parseSelection( Source_Ref source_r, const Pathname & file_r )
       {
         MIL << "Starting to parse selection " << file_r << std::endl;
         SelectionTagFileParser p;
@@ -55,6 +55,8 @@ namespace zypp
           ERR << "Selection " << file_r << " is broken." << std::endl;
           return 0L;
         }
+        // attach the source
+        p.selImpl->_source = source_r;
         return p.result;
 
       }
index cf349b3..010b166 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "zypp/ZYppFactory.h"
 #include "zypp/Pathname.h"
+#include "zypp/Source.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -57,7 +58,7 @@ namespace zypp
            ZYpp::LocaleSet _locales;
       };
       ///////////////////////////////////////////////////////////////////
-      Selection::Ptr parseSelection( const Pathname & file_r );
+      Selection::Ptr parseSelection(  Source_Ref source_r, const Pathname & file_r );
       /////////////////////////////////////////////////////////////////
     } // namespace source
     ///////////////////////////////////////////////////////////////////
index c5b894a..b35a1f9 100644 (file)
@@ -456,7 +456,7 @@ namespace zypp
 
               Pathname file = cache ? _data_dir + selfile : provideFile( _data_dir + selfile);
             MIL << "Selection file to parse " << file << endl;
-            Selection::Ptr sel( parseSelection( file ) );
+            Selection::Ptr sel( parseSelection( source_r, file ) );
 
             if (sel)
             {
@@ -507,7 +507,7 @@ namespace zypp
             Pathname file = cache ? _data_dir + patfile : provideFile( _data_dir + patfile);
             MIL << "Pattern file to parse " << file << endl;
 
-            Pattern::Ptr pat( parsePattern( file ) );
+            Pattern::Ptr pat( parsePattern( source_r, file ) );
 
             if (pat)
             {
index 798972b..b6a540a 100644 (file)
@@ -37,7 +37,9 @@ namespace zypp
     SuseTagsPatternImpl::~SuseTagsPatternImpl()
     {}
 
-
+    Source_Ref SuseTagsPatternImpl::source() const
+    { return _source; }
+    
     TranslatedText SuseTagsPatternImpl::summary() const
     { return _summary; }
 
index 36f8abf..457d176 100644 (file)
@@ -13,6 +13,7 @@
 #define ZYPP_DETAIL_SUSETAGS_PATTERNIMPL_H
 
 #include "zypp/detail/PatternImplIf.h"
+#include "zypp/Source.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -35,32 +36,13 @@ namespace zypp
       SuseTagsPatternImpl();
       virtual ~SuseTagsPatternImpl();
 
-      /*
-      virtual std::list<std::string> suggests() const;
-      virtual std::list<std::string> recommends() const;
-      virtual std::list<std::string> insnotify( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> delnotify( const LangCode & lang = LangCode("") ) const;
-      virtual ByteCount size() const;
-      virtual bool providesSources() const;
-      virtual std::string instSrcLabel() const;
-      virtual Vendor instSrcVendor() const;
-      virtual unsigned instSrcRank() const;
-      virtual std::list<std::string> inspacks( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> delpacks( const LangCode & lang = LangCode("") ) const;
-      virtual PM::LocaleSet supportedLocales() const;
-      virtual std::set<PMSelectablePtr> pureInspacks_ptrs( const LangCode & lang ) const;
-      virtual std::set<PMSelectablePtr> inspacks_ptrs( const LangCode & lang ) const;
-      virtual std::set<PMSelectablePtr> delpacks_ptrs( const LangCode & lang ) const;
-      virtual bool isBase() const;
-      virtual PMError provideSelToInstall( Pathname & path_r ) const;
-      */
-
       virtual TranslatedText summary() const;
       virtual TranslatedText description() const;
       virtual TranslatedText category() const;
       virtual bool visible() const;
       virtual Label order() const;
       virtual Pathname icon() const;
+      virtual Source_Ref source() const;
       
       TranslatedText _summary;
       TranslatedText _description;
@@ -88,6 +70,7 @@ namespace zypp
       std::map< Locale, std::list<std::string> > _insnotify;
       std::map< Locale, std::list<std::string> > _delnotify;
 
+      Source_Ref _source;
     };
     ///////////////////////////////////////////////////////////////////
 
index 0fc17c1..c1cfb87 100644 (file)
@@ -71,7 +71,11 @@ namespace zypp
       //else
        //return std::set<std::string>();
     }
-
+  
+    Source_Ref SuseTagsSelectionImpl::source() const
+    {
+      return _source;
+    }
     /////////////////////////////////////////////////////////////////
   } // namespace detail
   ///////////////////////////////////////////////////////////////////
index b663cf4..38d5cf7 100644 (file)
@@ -13,6 +13,7 @@
 #define ZYPP_DETAIL_SUSETAGS_SELECTIONIMPL_H
 
 #include "zypp/detail/SelectionImplIf.h"
+#include "zypp/Source.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -35,26 +36,6 @@ namespace zypp
       SuseTagsSelectionImpl();
       virtual ~SuseTagsSelectionImpl();
 
-      /*
-      virtual std::list<std::string> suggests() const;
-      virtual std::list<std::string> recommends() const;
-      virtual std::list<std::string> insnotify( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> delnotify( const LangCode & lang = LangCode("") ) const;
-      virtual ByteCount size() const;
-      virtual bool providesSources() const;
-      virtual std::string instSrcLabel() const;
-      virtual Vendor instSrcVendor() const;
-      virtual unsigned instSrcRank() const;
-      virtual std::list<std::string> inspacks( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> delpacks( const LangCode & lang = LangCode("") ) const;
-      virtual PM::LocaleSet supportedLocales() const;
-      virtual std::set<PMSelectablePtr> pureInspacks_ptrs( const LangCode & lang ) const;
-      virtual std::set<PMSelectablePtr> inspacks_ptrs( const LangCode & lang ) const;
-      virtual std::set<PMSelectablePtr> delpacks_ptrs( const LangCode & lang ) const;
-      virtual bool isBase() const;
-      virtual PMError provideSelToInstall( Pathname & path_r ) const;
-      */
-
       virtual TranslatedText summary() const;
       virtual TranslatedText description() const;
       virtual Label category() const;
@@ -64,7 +45,8 @@ namespace zypp
       virtual const std::set<std::string> suggests() const PURE_VIRTUAL;
       virtual const std::set<std::string> recommends() const PURE_VIRTUAL;
       virtual const std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
-
+      virtual Source_Ref source() const;
+      
       TranslatedText _summary;
       std::string _parser_version;
       std::string _name;
@@ -87,6 +69,7 @@ namespace zypp
       std::map< Locale, std::set<std::string> > _inspacks;
       std::map< Locale, std::set<std::string> > _delpacks;
 
+      Source_Ref _source;
     };
     ///////////////////////////////////////////////////////////////////