fix releaseFile calls passing the local filename as arg.
authorMichael Andres <ma@suse.de>
Tue, 15 May 2007 11:59:49 +0000 (11:59 +0000)
committerMichael Andres <ma@suse.de>
Tue, 15 May 2007 11:59:49 +0000 (11:59 +0000)
devel/devel.ma/ScanSource.cc
zypp/media/MediaHandler.cc
zypp/source/SourceProvideFile.cc

index b7a7559aeaaa61e0e04a8c72ac8bb57a0404f474..f168362cc18e141fd761b2f8ebb92372f6219ead 100644 (file)
@@ -10,6 +10,7 @@
 #include <zypp/KeyRing.h>
 #include <zypp/Date.h>
 #include <zypp/SourceManager.h>
+#include <zypp/ManagedFile.h>
 
 using namespace std;
 using namespace zypp;
@@ -19,6 +20,27 @@ static bool debug   = false;
 
 #define LOG (debug ? USR : cout)
 
+#include <zypp/ManagedFile.h>
+#include "zypp/source/PackageProvider.h"
+
+    static void sourceProvidePackage( const ResObject::Ptr & pi )
+    {
+      // Redirect PackageProvider queries for installed editions
+      // (in case of patch/delta rpm processing) to rpmDb.
+      source::PackageProviderPolicy packageProviderPolicy;
+      //packageProviderPolicy.queryInstalledCB( QueryInstalledEditionHelper() );
+
+      Package::constPtr p = asKind<Package>(pi);
+      if ( p )
+      {
+       source::PackageProvider pkgProvider( p, packageProviderPolicy );
+       SEC << "++++" << endl;
+       ManagedFile r( pkgProvider.providePackage() );
+       SEC << "---" << endl;
+      }
+      SEC << "-" << endl;
+    }
+
 struct KeyRingReceiver : public callback::ReceiveReport<KeyRingReport>
 {
   KeyRingReceiver()
@@ -159,6 +181,11 @@ int main( int argc, char * argv[] )
         }
       LOG << for_each( src.resolvables().begin(), src.resolvables().end(),
                        ResStoreStats() ) << endl;
+
+      for_each( src.resolvables().begin(),
+               src.resolvables().end(),
+               sourceProvidePackage );
+
       if ( verbose )
         {
           dumpRange( LOG, src.resolvables().begin(), src.resolvables().end() ) << endl;
index 1f29e7296991a67f0a86249f0d5aeff147d333ad..afaee76f75375f5919d19768d213ab10c79581eb 100644 (file)
@@ -394,6 +394,7 @@ MediaHandler::createAttachPoint(const Pathname &attach_root) const
   //
   // FIXME: use mkdtemp?
   //
+#warning Use class TmpDir from TmpPath.h
   Pathname abase( attach_root + "AP_" );
   //        ma and sh need more than 42 for debugging :-)
   //        since the readonly fs are handled now, ...
index 6502d01bc78796d256a68e859dee90338e7d0f6a..eba5121ae5bdf983811a58ec2b03fd98b3e47b0b 100644 (file)
@@ -51,6 +51,26 @@ namespace zypp
         function<bool ( int )> _redirect;
       };
 
+      /** ManagedFile Dispose functor.
+       * The Pathname argument is ignored, as Source_Ref::releaseFile expects the filename
+       * relative to the medias root (i.e. same args as to provideFile).
+      */
+      struct SourceReleaseFile
+      {
+       SourceReleaseFile( Source_Ref source_r, const Pathname & location_r, unsigned mediaNr_r )
+         : _source( source_r ), _location( location_r ), _medianr( mediaNr_r )
+       {}
+
+       void operator()( const Pathname & /*UNUSED*/ )
+       {
+         _source.releaseFile( _location, _medianr );
+       }
+
+       Source_Ref _source;
+       Pathname   _location;
+       unsigned   _medianr;
+      };
+
       /////////////////////////////////////////////////////////////////
     } // namespace
     ///////////////////////////////////////////////////////////////////
@@ -70,7 +90,7 @@ namespace zypp
 
 
       ManagedFile ret( source_r.provideFile( loc_r.filename(), loc_r.medianr() ),
-                       bind( &Source_Ref::releaseFile, source_r, _1, loc_r.medianr() ) );
+                      SourceReleaseFile( source_r, loc_r.filename(), loc_r.medianr() ) );
 
       if ( loc_r.checksum().empty() )
         {