- Move Fetcher class to zypp/
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 12 Mar 2007 15:14:26 +0000 (15:14 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 12 Mar 2007 15:14:26 +0000 (15:14 +0000)
- Move OnMediaLocation out of source/
- port the code
- document it

15 files changed:
devel/devel.dmacvicar/SUSETagsDownloader.cc
zypp/CMakeLists.txt
zypp/Fetcher.cc [new file with mode: 0644]
zypp/Fetcher.h [new file with mode: 0644]
zypp/MediaSetAccess.cc
zypp/MediaSetAccess.h
zypp/OnMediaLocation.cc [new file with mode: 0644]
zypp/OnMediaLocation.h [new file with mode: 0644]
zypp/source/OnMediaLocation.cc [deleted file]
zypp/source/OnMediaLocation.h [deleted file]
zypp/source/PackageDelta.h
zypp/source/PackageProvider.cc
zypp/source/SourceProvideFile.cc
zypp/source/SourceProvideFile.h
zypp/source/yum/YUMSourceImpl.cc

index 6c33ef853ed9def68681dbb8cececb526c85db37..992aed3bd1ce8d2622122d89319f98d3cbd3f820 100644 (file)
@@ -14,7 +14,8 @@
 #include <zypp/media/MediaManager.h>
 #include <zypp/MediaSetAccess.h>
 #include <zypp/source/SUSEMediaVerifier.h>
-#include <zypp/source/OnMediaLocation.h>
+#include <zypp/nMediaLocation.h>
+#include <zypp/Fetcher.h>
 
 #include "zypp/Product.h"
 #include "zypp/Package.h"
 using namespace std;
 using namespace zypp;
 using namespace media;
-using namespace source;
-
-class Fetcher
-{
-private:
-  Url _url;
-  Pathname _path;
-  std::list<OnMediaLocation> _resources;
-  std::list<Pathname> _caches;
-
-public:
-
-  Fetcher( const Url &url, const Pathname &path )
-    : _url(url), _path(path)
-  {
-  
-  }
-
-  void enqueue( const OnMediaLocation &resource )
-  {
-    _resources.push_back(resource);
-  }
-
-  void reset()
-  {
-    _resources.clear();
-    _caches.clear();
-  }
-
-  /**
-   * adds a directory to the list of directories
-   * where to look for cached files
-   */
-  void insertCache( const Pathname &cache_dir )
-  {
-    _caches.push_back(cache_dir);
-  }
-
-  void start( const Pathname &dest_dir )
-  {
-    MediaSetAccess media(_url, _path);
-    
-    for ( list<OnMediaLocation>::const_iterator it_res = _resources.begin(); it_res != _resources.end(); ++it_res )
-    {
-      bool got_from_cache = false;
-      for ( list<Pathname>::const_iterator it_cache = _caches.begin(); it_cache != _caches.end(); ++it_cache )
-      {
-        // Pathinfos could be cached to avoid too many stats?
-        PathInfo info(*it_cache);
-        if ( info.isDir() )
-        {
-          // does the current file exists in the current cache?
-          Pathname cached_file = *it_cache + (*it_res).filename();
-          if ( PathInfo( cached_file ).isExist() )
-          {
-            // check the checksum
-            if ( is_checksum( cached_file, (*it_res).checksum() ) )
-            {
-              // cached
-              MIL << "file " << (*it_res).filename() << " found in previous cache. Using cached copy." << endl;
-              // checksum is already checked.
-              // we could later implement double failover and try to download if file copy fails.
-            
-              // replicate the complete path in the target directory
-              Pathname dest_full_path = dest_dir + (*it_res).filename();
-              if ( assert_dir( dest_full_path.dirname() ) != 0 )
-                ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
-
-              if ( filesystem::copy(cached_file, dest_full_path ) != 0 )
-              { //copy_file2dir
-                //ZYPP_THROW(SourceIOException("Can't copy " + cached_file.asString() + " to " + destination.asString()));
-                ERR << "Can't copy " << cached_file + " to " + dest_dir << endl;
-                // try next cache
-                continue;
-              }
-              
-              got_from_cache = true;
-              break;
-            }
-          }
-          else
-          {
-            // File exists in cache but with a different checksum
-            // so just try next cache
-            continue; 
-          }
-        }
-        else
-        {
-          // skip bad cache directory and try with next one
-          ERR << "Skipping cache : " << *it_cache << endl;
-          continue;
-        }
-      }
-      
-      if ( ! got_from_cache )
-      {
-        // try to get the file from the net
-        try
-        {
-          Pathname tmp_file = media.provideFile(*it_res);
-          Pathname dest_full_path = dest_dir + (*it_res).filename();
-          if ( assert_dir( dest_full_path.dirname() ) != 0 )
-                ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
-          if ( filesystem::copy(tmp_file, dest_full_path ) != 0 )
-          {
-            ZYPP_THROW( Exception("Can't copy " + tmp_file.asString() + " to " + dest_dir.asString()));
-          }
-        }
-        catch (const Exception & excpt_r)
-        {
-          ZYPP_CAUGHT(excpt_r);
-          ZYPP_THROW(SourceIOException("Can't provide " + (*it_res).filename().asString() + " : " + excpt_r.msg() ));
-        }
-      }
-      else
-      {
-        // We got the file from cache
-        // continue with next file
-        continue;
-      }
-    }
-  }
-//       callback::SendReport<DigestReport> report;
-//       if ( checksum.empty() )
-//       {
-//         MIL << "File " <<  file_url << " has no checksum available." << std::endl;
-//         if ( report->askUserToAcceptNoDigest(file_to_download) )
-//         {
-//           MIL << "User accepted " <<  file_url << " with no checksum." << std::endl;
-//           return;
-//         }
-//         else
-//         {
-//           ZYPP_THROW(SourceMetadataException( file_url.asString() + " " + N_(" miss checksum.") ));
-//         }
-//       }
-//       else
-//       {
-//         if (! is_checksum( destination, checksum))
-//           ZYPP_THROW(SourceMetadataException( file_url.asString() + " " + N_(" fails checksum verification.") ));
-//       }
-
-};
+//using namespace source;
 
 class SUSETagsDownloader
 {
index 48289a968f8829d279b9ddfab9980d1faa40870b..dd68fa8ec6804e5314f057b7a633a364137162e5 100644 (file)
@@ -81,7 +81,9 @@ SET( zypp_SRCS
   Signature.cc
   KeyRing.cc
   MediaSetAccess.cc
-  ProvideFilePolicy.cc 
+  ProvideFilePolicy.cc
+  OnMediaLocation.cc
+  Fetcher.cc
 )
 
 SET( zypp_HEADERS
@@ -110,6 +112,7 @@ SET( zypp_HEADERS
   DiskUsageCounter.h
   Edition.h
   ExternalProgram.h
+  Fetcher.h
   KVMap.h
   KeyRing.h
   Language.h
@@ -123,6 +126,7 @@ SET( zypp_HEADERS
   NVRAD.h
   NameKindProxy.h
   NeedAType.h
+  OnMediaLocation.h
   Package.h
   Patch.h
   PathInfo.h
@@ -664,7 +668,6 @@ INSTALL(  FILES
 SET( zypp_source_SRCS
   source/Applydeltarpm.cc
   source/MediaSet.cc
-  source/OnMediaLocation.cc
   source/PackageDelta.cc
   source/PackageProvider.cc
   source/SourceImpl.cc
@@ -677,7 +680,6 @@ SET( zypp_source_HEADERS
   source/Applydeltarpm.h
   source/Builtin.h
   source/MediaSet.h
-  source/OnMediaLocation.h
   source/PackageDelta.h
   source/PackageProvider.h
   source/SourceImpl.h
diff --git a/zypp/Fetcher.cc b/zypp/Fetcher.cc
new file mode 100644 (file)
index 0000000..d04179c
--- /dev/null
@@ -0,0 +1,148 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#include "zypp/base/Logger.h"
+#include "zypp/Fetcher.h"
+#include "zypp/MediaSetAccess.h"
+#include "zypp/PathInfo.h"
+
+using namespace std;
+using namespace zypp::filesystem;
+
+namespace zypp
+{
+
+Fetcher::Fetcher( const Url &url, const Pathname &path )
+  : _url(url), _path(path)
+{
+
+}
+
+void Fetcher::enqueue( const OnMediaLocation &resource )
+{
+  _resources.push_back(resource);
+}
+
+void Fetcher::reset()
+{
+  _resources.clear();
+  _caches.clear();
+}
+
+void Fetcher::insertCache( const Pathname &cache_dir )
+{
+  _caches.push_back(cache_dir);
+}
+
+void Fetcher::start( const Pathname &dest_dir )
+{
+  MediaSetAccess media(_url, _path);
+  
+  for ( list<OnMediaLocation>::const_iterator it_res = _resources.begin(); it_res != _resources.end(); ++it_res )
+  {
+    bool got_from_cache = false;
+    for ( list<Pathname>::const_iterator it_cache = _caches.begin(); it_cache != _caches.end(); ++it_cache )
+    {
+      // Pathinfos could be cached to avoid too many stats?
+      PathInfo info(*it_cache);
+      if ( info.isDir() )
+      {
+        // does the current file exists in the current cache?
+        Pathname cached_file = *it_cache + (*it_res).filename();
+        if ( PathInfo( cached_file ).isExist() )
+        {
+          // check the checksum
+          if ( is_checksum( cached_file, (*it_res).checksum() ) )
+          {
+            // cached
+            MIL << "file " << (*it_res).filename() << " found in previous cache. Using cached copy." << endl;
+            // checksum is already checked.
+            // we could later implement double failover and try to download if file copy fails.
+          
+            // replicate the complete path in the target directory
+            Pathname dest_full_path = dest_dir + (*it_res).filename();
+            if ( assert_dir( dest_full_path.dirname() ) != 0 )
+              ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
+
+            if ( filesystem::copy(cached_file, dest_full_path ) != 0 )
+            { //copy_file2dir
+              //ZYPP_THROW(SourceIOException("Can't copy " + cached_file.asString() + " to " + destination.asString()));
+              ERR << "Can't copy " << cached_file + " to " + dest_dir << endl;
+              // try next cache
+              continue;
+            }
+            
+            got_from_cache = true;
+            break;
+          }
+        }
+        else
+        {
+          // File exists in cache but with a different checksum
+          // so just try next cache
+          continue; 
+        }
+      }
+      else
+      {
+        // skip bad cache directory and try with next one
+        ERR << "Skipping cache : " << *it_cache << endl;
+        continue;
+      }
+    }
+    
+    if ( ! got_from_cache )
+    {
+      // try to get the file from the net
+      try
+      {
+        Pathname tmp_file = media.provideFile(*it_res);
+        Pathname dest_full_path = dest_dir + (*it_res).filename();
+        if ( assert_dir( dest_full_path.dirname() ) != 0 )
+              ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
+        if ( filesystem::copy(tmp_file, dest_full_path ) != 0 )
+        {
+          ZYPP_THROW( Exception("Can't copy " + tmp_file.asString() + " to " + dest_dir.asString()));
+        }
+      }
+      catch (const Exception & excpt_r)
+      {
+        ZYPP_CAUGHT(excpt_r);
+        ZYPP_THROW(Exception("Can't provide " + (*it_res).filename().asString() + " : " + excpt_r.msg() ));
+      }
+    }
+    else
+    {
+      // We got the file from cache
+      // continue with next file
+      continue;
+    }
+  }
+}
+//       callback::SendReport<DigestReport> report;
+//       if ( checksum.empty() )
+//       {
+//         MIL << "File " <<  file_url << " has no checksum available." << std::endl;
+//         if ( report->askUserToAcceptNoDigest(file_to_download) )
+//         {
+//           MIL << "User accepted " <<  file_url << " with no checksum." << std::endl;
+//           return;
+//         }
+//         else
+//         {
+//           ZYPP_THROW(SourceMetadataException( file_url.asString() + " " + N_(" miss checksum.") ));
+//         }
+//       }
+//       else
+//       {
+//         if (! is_checksum( destination, checksum))
+//           ZYPP_THROW(SourceMetadataException( file_url.asString() + " " + N_(" fails checksum verification.") ));
+//       }
+
+} // namespace zypp
\ No newline at end of file
diff --git a/zypp/Fetcher.h b/zypp/Fetcher.h
new file mode 100644 (file)
index 0000000..4b43008
--- /dev/null
@@ -0,0 +1,72 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_FETCHER_H
+#define ZYPP_FETCHER_H
+
+#include <list>
+#include "zypp/Pathname.h"
+#include "zypp/Url.h"
+#include "zypp/OnMediaLocation.h"
+
+namespace zypp
+{
+  
+  /** 
+  * Edition represents <code>[epoch:]version[-release]</code>
+  *
+  * This class allows to retrieve a group of files which can
+  * be cached already on the local disk.
+  *
+  * \code
+  * Fetcher fetcher(url, path);
+  * fetcher.enqueue( OnMediaLocation().filename("/content") );
+  * fetcher.insertCache("/tmp/cache")
+  * fetcher.start( "/download-dir );
+  * fetcher.reset();
+  * \endcode
+  */
+  class Fetcher
+  {
+  public:
+    /**
+    * Constructs a fetcher from a url and path
+    */
+    Fetcher( const Url &url, const Pathname &path );
+    
+    /**
+    * Enqueue a object for transferal, they will not
+    * be transfered until \ref start() is called
+    */
+    void enqueue( const OnMediaLocation &resource );
+    /**
+    * adds a directory to the list of directories
+    * where to look for cached files
+    */
+    void insertCache( const Pathname &cache_dir );
+    /**
+    * Reset the transfer list and cache list
+    */
+    void reset();
+    /**
+    * start the transfer to a destination directory
+    * The file tree will be replicated inside this
+    * directory
+    */
+    void start( const Pathname &dest_dir );
+  
+  private:
+    Url _url;
+    Pathname _path;
+    std::list<OnMediaLocation> _resources;
+    std::list<Pathname> _caches;
+  };
+
+} // ns zypp
+#endif
\ No newline at end of file
index 16f23c58f4b7db830be97ad2b1c6ec9c2521250c..2965d3f4e624ffae6555e5461fba1a9aeeec9632 100644 (file)
@@ -117,7 +117,7 @@ namespace zypp
     }
   }
 
-  Pathname MediaSetAccess::provideFile( const source::OnMediaLocation & on_media_file )
+  Pathname MediaSetAccess::provideFile( const OnMediaLocation & on_media_file )
   {
     return provideFile( on_media_file.filename(), on_media_file.medianr() );
   }
index 3b1dd933a30617cf4bfdddd55d63d96146edf561..df222938d0fdb96f0faa4b3fe3203228d206832e 100644 (file)
@@ -21,7 +21,7 @@
 #include "zypp/media/MediaManager.h"
 #include "zypp/Pathname.h"
 #include "zypp/CheckSum.h"
-#include "zypp/source/OnMediaLocation.h"
+#include "zypp/OnMediaLocation.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -50,6 +50,9 @@ namespace zypp
     //
     // CLASS NAME : SourceCache
     //
+    /**
+     * The
+     */
     class MediaSetAccess : public base::ReferenceCounted, private base::NonCopyable
     {
       friend std::ostream & operator<<( std::ostream & str, const MediaSetAccess & obj );
@@ -70,7 +73,7 @@ namespace zypp
       /**
        * provide a file fom a multiple media
        */
-      Pathname provideFile( const source::OnMediaLocation & on_media_file );
+      Pathname provideFile( const OnMediaLocation & on_media_file );
 
       /**
        * provides a file on multiple media which is possibly cached
@@ -78,7 +81,7 @@ namespace zypp
        * if they match, the cached one is copied to the destination directory
        * if not the file is provided and copied to the destination directory.
        */
-      void providePossiblyCachedMetadataFile( const source::OnMediaLocation &file_on_media, const Pathname &destination, const Pathname &cached_file);
+      void providePossiblyCachedMetadataFile( const OnMediaLocation &file_on_media, const Pathname &destination, const Pathname &cached_file);
 
       Pathname provideFile(const Pathname & file, unsigned media_nr = 1 );
       Pathname provideFile(const Pathname & file, unsigned media_nr, const FileChecker checker );
diff --git a/zypp/OnMediaLocation.cc b/zypp/OnMediaLocation.cc
new file mode 100644 (file)
index 0000000..5fda908
--- /dev/null
@@ -0,0 +1,36 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/source/OnMediaLocation.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+
+#include "zypp/OnMediaLocation.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+  /******************************************************************
+  **
+  **   FUNCTION NAME : operator<<
+  **   FUNCTION TYPE : std::ostream &
+  */
+  std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj )
+  {
+    return str << "[" << obj.medianr() << "]" << obj.filename()
+              << "{" << obj.downloadsize() << "|" << obj.checksum() << "}";
+  }
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/OnMediaLocation.h b/zypp/OnMediaLocation.h
new file mode 100644 (file)
index 0000000..1d85b1f
--- /dev/null
@@ -0,0 +1,71 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/source/OnMediaLocation.h
+ *
+*/
+#ifndef ZYPP_SOURCE_ONMEDIALOCATION_H
+#define ZYPP_SOURCE_ONMEDIALOCATION_H
+
+#include <iosfwd>
+
+#include "zypp/Pathname.h"
+#include "zypp/ByteCount.h"
+#include "zypp/CheckSum.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : OnMediaLocation
+  //
+  /** 
+    * Describes a path ona certain media amongs as the information
+    * required to download it, like its media number, checksum and
+    * size.
+    * it does not specifies the URI of the file.
+  */
+  class OnMediaLocation
+  {
+    friend std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj );
+
+  public:
+    /** Ctor */
+    OnMediaLocation()
+    : _medianr( 1 )
+    {}
+
+  public:
+    unsigned          medianr()      const { return _medianr; }
+    const Pathname &  filename()     const { return _filename; }
+    const CheckSum &  checksum()     const { return _checksum; }
+    const ByteCount & downloadsize() const { return _downloadsize; }
+
+  public:
+    OnMediaLocation & medianr( unsigned val_r )               { _medianr = val_r; return *this; }
+    OnMediaLocation & filename( const Pathname & val_r )      { _filename = val_r; return *this; }
+    OnMediaLocation & checksum( const CheckSum & val_r )      { _checksum = val_r; return *this; }
+    OnMediaLocation & downloadsize( const ByteCount & val_r ) { _downloadsize = val_r; return *this; }
+
+  private:
+    unsigned  _medianr;
+    Pathname  _filename;
+    CheckSum  _checksum;
+    ByteCount _downloadsize;
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /** \relates OnMediaLocation Stream output */
+  std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj );
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_ONMEDIALOCATION_H
diff --git a/zypp/source/OnMediaLocation.cc b/zypp/source/OnMediaLocation.cc
deleted file mode 100644 (file)
index 6b25d5b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file      zypp/source/OnMediaLocation.cc
- *
-*/
-#include <iostream>
-//#include "zypp/base/Logger.h"
-
-#include "zypp/source/OnMediaLocation.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace source
-  { /////////////////////////////////////////////////////////////////
-
-    /******************************************************************
-    **
-    ** FUNCTION NAME : operator<<
-    ** FUNCTION TYPE : std::ostream &
-    */
-    std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj )
-    {
-      return str << "[" << obj.medianr() << "]" << obj.filename()
-                 << "{" << obj.downloadsize() << "|" << obj.checksum() << "}";
-    }
-
-    /////////////////////////////////////////////////////////////////
-  } // namespace source
-  ///////////////////////////////////////////////////////////////////
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
diff --git a/zypp/source/OnMediaLocation.h b/zypp/source/OnMediaLocation.h
deleted file mode 100644 (file)
index 381296f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file      zypp/source/OnMediaLocation.h
- *
-*/
-#ifndef ZYPP_SOURCE_ONMEDIALOCATION_H
-#define ZYPP_SOURCE_ONMEDIALOCATION_H
-
-#include <iosfwd>
-
-#include "zypp/Pathname.h"
-#include "zypp/ByteCount.h"
-#include "zypp/CheckSum.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace source
-  { /////////////////////////////////////////////////////////////////
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // CLASS NAME : OnMediaLocation
-    //
-    /** 
-     * Describes a path ona certain media amongs as the information
-     * required to download it, like its media number, checksum and
-     * size.
-     * it does not specifies the URI of the file.
-    */
-    class OnMediaLocation
-    {
-      friend std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj );
-
-    public:
-      /** Ctor */
-      OnMediaLocation()
-      : _medianr( 1 )
-      {}
-
-    public:
-      unsigned          medianr()      const { return _medianr; }
-      const Pathname &  filename()     const { return _filename; }
-      const CheckSum &  checksum()     const { return _checksum; }
-      const ByteCount & downloadsize() const { return _downloadsize; }
-
-    public:
-      OnMediaLocation & medianr( unsigned val_r )               { _medianr = val_r; return *this; }
-      OnMediaLocation & filename( const Pathname & val_r )      { _filename = val_r; return *this; }
-      OnMediaLocation & checksum( const CheckSum & val_r )      { _checksum = val_r; return *this; }
-      OnMediaLocation & downloadsize( const ByteCount & val_r ) { _downloadsize = val_r; return *this; }
-
-    private:
-      unsigned  _medianr;
-      Pathname  _filename;
-      CheckSum  _checksum;
-      ByteCount _downloadsize;
-    };
-    ///////////////////////////////////////////////////////////////////
-
-    /** \relates OnMediaLocation Stream output */
-    std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj );
-
-    /////////////////////////////////////////////////////////////////
-  } // namespace source
-  ///////////////////////////////////////////////////////////////////
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_ONMEDIALOCATION_H
index 6b67bc7b04dede9207db81aaff3474388afe30a1..7116839efb6bf690c340fc060ccf577d79043bbb 100644 (file)
@@ -15,7 +15,7 @@
 #include <iosfwd>
 #include <list>
 
-#include "zypp/source/OnMediaLocation.h"
+#include "zypp/OnMediaLocation.h"
 #include "zypp/Edition.h"
 #include "zypp/Date.h"
 //#include "zypp/Arch.h"
@@ -40,18 +40,18 @@ namespace zypp
       {}
 
     public:
-      const source::OnMediaLocation & location()     const { return _location; }
+      const OnMediaLocation & location()     const { return _location; }
       const BaseVersions &            baseversions() const { return _baseversions; }
       const Date &                    buildtime()    const { return _buildtime;}
 
     public:
-      PatchRpm & location( const source::OnMediaLocation & val_r ) { _location = val_r; return *this; }
+      PatchRpm & location( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
       PatchRpm & baseversions( const BaseVersions & val_r )        { _baseversions = val_r; return *this; }
       PatchRpm & baseversion( const BaseVersion & val_r )          { _baseversions.push_back( val_r ); return *this; }
       PatchRpm & buildtime( const Date & val_r )                   { _buildtime = val_r; return *this; }
 
     private:
-      source::OnMediaLocation _location;
+      OnMediaLocation _location;
       BaseVersions            _baseversions;
       Date                    _buildtime;
     };
@@ -96,17 +96,17 @@ namespace zypp
       {}
 
     public:
-      const source::OnMediaLocation & location()     const { return _location; }
+      const OnMediaLocation & location()     const { return _location; }
       const BaseVersion &             baseversion()  const { return _baseversion; }
       const Date &                    buildtime()    const { return _buildtime;}
 
     public:
-      DeltaRpm & location( const source::OnMediaLocation & val_r ) { _location = val_r; return *this; }
-      DeltaRpm & baseversion( const BaseVersion & val_r )          { _baseversion = val_r; return *this; }
-      DeltaRpm & buildtime( const Date & val_r )                   { _buildtime = val_r; return *this; }
+      DeltaRpm & location( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
+      DeltaRpm & baseversion( const BaseVersion & val_r )  { _baseversion = val_r; return *this; }
+      DeltaRpm & buildtime( const Date & val_r )           { _buildtime = val_r; return *this; }
 
     private:
-      source::OnMediaLocation _location;
+      OnMediaLocation _location;
       BaseVersion             _baseversion;
       Date                    _buildtime;
     };
index 2cfccc365651f2376fdfa1879787dd6d2448a3ce..1e5dda263759edbf5b77c6aa5cc19c01cfd53c4b 100644 (file)
@@ -157,7 +157,7 @@ namespace zypp
 
       // no patch/delta -> provide full package
       ManagedFile ret;
-      source::OnMediaLocation loc;
+      OnMediaLocation loc;
       loc.medianr( _package->sourceMediaNr() )
       .filename( _package->location() )
       .checksum( _package->checksum() )
index 3be04ac2f34c902858cd36c7f7997831869736cd..6502d01bc78796d256a68e859dee90338e7d0f6a 100644 (file)
@@ -56,7 +56,7 @@ namespace zypp
     ///////////////////////////////////////////////////////////////////
 
     ManagedFile provideFile( Source_Ref source_r,
-                             const source::OnMediaLocation & loc_r,
+                             const OnMediaLocation & loc_r,
                              const ProvideFilePolicy & policy_r )
     {
       MIL << "sourceProvideFile " << loc_r << endl;
index ed00ee252b0a1de19bcd175241f0abbf620fe5dc..a8387fcf4f18a6759dd757f47884f1048858fcf6 100644 (file)
@@ -18,7 +18,7 @@
 #include "zypp/base/Functional.h"
 #include "zypp/Source.h"
 #include "zypp/ManagedFile.h"
-#include "zypp/source/OnMediaLocation.h"
+#include "zypp/OnMediaLocation.h"
 #include "zypp/ProvideFilePolicy.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -43,7 +43,7 @@ namespace zypp
      * \throws Exception
     */
     ManagedFile provideFile( Source_Ref source_r,
-                             const source::OnMediaLocation & loc_r,
+                             const OnMediaLocation & loc_r,
                              const ProvideFilePolicy & policy_r = ProvideFilePolicy() );
 
     /////////////////////////////////////////////////////////////////
index 8ee8cef3ca8e9355a87a928e4bfebe0b742ca1a5..30ff0d9794d64f2ede504de65283e12bb3e7a104 100644 (file)
@@ -959,7 +959,7 @@ Atom::Ptr YUMSourceImpl::augmentPackage(
       {
         YUMPackageImpl::PatchRpm patch_rpm;
 
-        patch_rpm.location( source::OnMediaLocation()
+        patch_rpm.location( OnMediaLocation()
                             .medianr( str::strtonum<unsigned>( it->media ) )
                             .filename( it->location )
                             .checksum( CheckSum( it->checksumType, it->checksum ) )
@@ -985,7 +985,7 @@ Atom::Ptr YUMSourceImpl::augmentPackage(
       {
         YUMPackageImpl::DeltaRpm delta_rpm;
 
-        delta_rpm.location( source::OnMediaLocation()
+        delta_rpm.location( OnMediaLocation()
                             .medianr( str::strtonum<unsigned>( it->media ) )
                             .filename( it->location )
                             .checksum( CheckSum( it->checksumType, it->checksum ) )