let the source find out the proper directory for a package
authorStanislav Visnovsky <visnov@suse.cz>
Wed, 1 Feb 2006 08:13:39 +0000 (08:13 +0000)
committerStanislav Visnovsky <visnov@suse.cz>
Wed, 1 Feb 2006 08:13:39 +0000 (08:13 +0000)
zypp/source/susetags/PackagesParser.cc
zypp/source/susetags/PackagesParser.h
zypp/source/susetags/SuseTagsImpl.cc
zypp/source/susetags/SuseTagsImpl.h

index 058360059b4817cfc261b13d2bd6c4aafc6cf0df..d9380c95004d94b88211b57a6c8a535fffa85cda 100644 (file)
@@ -39,6 +39,7 @@ namespace zypp
         std::list<Package::Ptr> result;
        
        zypp::Source_Ref _source;
+       zypp::source::susetags::SuseTagsImpl::Ptr _sourceImpl;
 
         shared_ptr<source::susetags::SuseTagsPackageImpl> pkgImpl;
         NVRAD nvrad;
@@ -113,7 +114,7 @@ namespace zypp
             if ( howmany >= 2 )
             {
               pkgImpl->_media_number = str::strtonum<unsigned int>(words[0]);
-              pkgImpl->_location = Pathname("/suse/" + nvrad.arch.asString() + "/" + words[1]);
+              pkgImpl->_location = _sourceImpl->sourceDir(nvrad) + words[1];
             }
             else
             {
index 7c8298412629bc4063d0761d43f01fc2238bfbe7..85c1c0c999e6c43cf5e817857a9ee5b8e3e85224 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "zypp/Pathname.h"
 #include "zypp/Package.h"
+#include "zypp/source/susetags/SuseTagsImpl.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -31,7 +32,7 @@ namespace zypp
       /** \deprecated Just temporary.
        * \throws ParseException and others.
       */
-      std::list<Package::Ptr> parsePackages( Source_Ref source_r, const Pathname & file_r );
+      std::list<Package::Ptr> parsePackages( Source_Ref source_r, SuseTagsImpl::Ptr, Pathname & file_r );
 
       /////////////////////////////////////////////////////////////////
     } // namespace susetags
index c65ba6de2c64689633d3c788d1246f26566310cb..5c7922b276daf92baba24d4f4c697d2fd96dc594 100644 (file)
@@ -70,7 +70,7 @@ namespace zypp
 #warning We use suse instead of <DATADIR> for now
         Pathname p = provideFile(_path + "suse/setup/descr/packages");
         DBG << "Going to parse " << p << endl;
-        std::list<Package::Ptr> content( parsePackages( source_r, p ) );
+        std::list<Package::Ptr> content( parsePackages( source_r, this, p ) );
         _store.insert( content.begin(), content.end() );
         DBG << "SuseTagsImpl (fake) from " << p << ": "
             << content.size() << " packages" << endl;
@@ -111,6 +111,12 @@ namespace zypp
       //
       SuseTagsImpl::~SuseTagsImpl()
       {}
+      
+      Pathname SuseTagsImpl::sourceDir( const NVRAD& nvrad )
+      {
+#warning Not using <DATADIR>
+        return Pathname( "/suse/" + nvrad.arch.asString() + "/");
+      }
 
       ///////////////////////////////////////////////////////////////////
       //
index f5d4742abd20be4f5d971a6a7620e558d19d6e5d..f58f2ceffd100ccf1101e009282ca9b41b69f525 100644 (file)
@@ -36,6 +36,9 @@ namespace zypp
       class SuseTagsImpl : public SourceImpl
       {
       public:
+
+        typedef intrusive_ptr<SuseTagsImpl>      Ptr;
+
         /** \deprecated Interim ctor for testing
          * \throw EXCEPTION on parse error
         */
@@ -46,6 +49,8 @@ namespace zypp
         ~SuseTagsImpl();
 
        virtual void createResolvables(Source_Ref source_r);
+       
+       Pathname sourceDir( const NVRAD& nvrad );
 
       public:
         /** Stream output. */