Imported Upstream version 14.27.2 08/94608/1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 1 Nov 2016 01:29:18 +0000 (10:29 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 1 Nov 2016 01:29:19 +0000 (10:29 +0900)
Change-Id: Id457fedbe9a5fb52251c9ca50275ed40222f6cf5
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
VERSION.cmake
devel/devel.ma/Basic.cc
package/libzypp.changes
po/zypp-po.tar.bz2
zypp/RepoManager.cc
zypp/ZYppCallbacks.h
zypp/repo/PackageProvider.cc

index 49d9cc8..ba6f58a 100644 (file)
@@ -61,8 +61,8 @@
 SET(LIBZYPP_MAJOR "14")
 SET(LIBZYPP_COMPATMINOR "27")
 SET(LIBZYPP_MINOR "27")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_PATCH "2")
 #
-# LAST RELEASED: 14.27.1 (27)
+# LAST RELEASED: 14.27.2 (27)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index d27969d..4002b7e 100644 (file)
@@ -153,32 +153,6 @@ using namespace zypp::ui;
        USR << __PRETTY_FUNCTION__ << endl;
       }
 
-      // Dowmload patch rpm:
-      // - path below url reported on start()
-      // - expected download size (0 if unknown)
-      // - download is interruptable
-      virtual void startPatchDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ )
-      {
-       USR << __PRETTY_FUNCTION__ << endl;
-      }
-
-      virtual bool progressPatchDownload( int /*value*/ )
-      {
-       USR << __PRETTY_FUNCTION__ << endl;
-       return true;
-      }
-
-      virtual void problemPatchDownload( const std::string &/*description*/ )
-      {
-       USR << __PRETTY_FUNCTION__ << endl;
-      }
-
-      virtual void finishPatchDownload()
-      {
-       USR << __PRETTY_FUNCTION__ << endl;
-      }
-
-
       // return false if the download should be aborted right now
       virtual bool progress(int value, Resolvable::constPtr resolvable_ptr)
       {
index 4dfafac..53590bc 100644 (file)
@@ -1,4 +1,24 @@
 -------------------------------------------------------------------
+Fri Aug 29 14:46:25 CEST 2014 - ma@suse.de
+
+- PackageProvider: consider toplevel cache if --root or --pkg-cachedir
+  is used.
+- Cleanup orpahned cache dirs only at zypp.conf default locations 
+  (bnc#891515)
+- Remove orphaned package caches on refresh (bnc#888919)
+- version 14.27.2 (27)
+
+-------------------------------------------------------------------
+Sun Aug 24 01:16:00 CEST 2014 - ma@suse.de
+
+- Update zypp-po.tar.bz2
+
+-------------------------------------------------------------------
+Mon Aug 18 14:01:06 CEST 2014 - ma@suse.de
+
+- Update zypp-po.tar.bz2
+
+-------------------------------------------------------------------
 Thu Jul 31 19:22:56 CEST 2014 - ma@suse.de
 
 - Fix gpg key creation/modification date computation to properly
index 247d1a6..3d9df3f 100644 (file)
Binary files a/po/zypp-po.tar.bz2 and b/po/zypp-po.tar.bz2 differ
index 73eea25..f04694c 100644 (file)
@@ -399,6 +399,21 @@ namespace zypp
     return ret;
   }
 
+  std:: ostream & operator<<( std::ostream & str, const RepoManagerOptions & obj )
+  {
+#define OUTS(X) str << "  " #X "\t" << obj.X << endl
+    str << "RepoManagerOptions (" << obj.rootDir << ") {" << endl;
+    OUTS( repoRawCachePath );
+    OUTS( repoSolvCachePath );
+    OUTS( repoPackagesCachePath );
+    OUTS( knownReposPath );
+    OUTS( knownServicesPath );
+    OUTS( pluginsPath );
+    str << "}" << endl;
+#undef OUTS
+    return str;
+  }
+
   ///////////////////////////////////////////////////////////////////
   /// \class RepoManager::Impl
   /// \brief RepoManager implementation.
@@ -630,6 +645,37 @@ namespace zypp
     repo::PluginServices(_options.pluginsPath/"services", ServiceCollector(_services));
   }
 
+  ///////////////////////////////////////////////////////////////////
+  namespace {
+    /** Delete \a cachePath_r subdirs not matching known aliases in \a repoEscAliases_r (must be sorted!)
+     * \note bnc#891515: Auto-cleanup only zypp.conf default locations. Otherwise
+     * we'd need some magic file to identify zypp cache directories. Without this
+     * we may easily remove user data (zypper --pkg-cache-dir . download ...)
+     */
+    inline void cleanupNonRepoMetadtaFolders( const Pathname & cachePath_r,
+                                             const Pathname & defaultCachePath_r,
+                                             const std::list<std::string> & repoEscAliases_r )
+    {
+      if ( cachePath_r != defaultCachePath_r )
+       return;
+
+      std::list<std::string> entries;
+      if ( filesystem::readdir( entries, cachePath_r, false ) == 0 )
+      {
+       entries.sort();
+       std::set<std::string> oldfiles;
+       set_difference( entries.begin(), entries.end(), repoEscAliases_r.begin(), repoEscAliases_r.end(),
+                       std::inserter( oldfiles, oldfiles.end() ) );
+       for ( const std::string & old : oldfiles )
+       {
+         if ( old == Repository::systemRepoAlias() )   // don't remove the @System solv file
+           continue;
+         filesystem::recursive_rmdir( cachePath_r / old );
+       }
+      }
+    }
+  } // namespace
+  ///////////////////////////////////////////////////////////////////
   void RepoManager::Impl::init_knownRepositories()
   {
     MIL << "start construct known repos" << endl;
@@ -682,25 +728,15 @@ namespace zypp
       }
 
       // delete metadata folders without corresponding repo (e.g. old tmp directories)
+      //
+      // bnc#891515: Auto-cleanup only zypp.conf default locations. Otherwise
+      // we'd need somemagic file to identify zypp cache directories. Without this
+      // we may easily remove user data (zypper --pkg-cache-dir . download ...)
       repoEscAliases.sort();
-      for ( const Pathname & cachePath : { _options.repoRawCachePath
-                                        , _options.repoSolvCachePath } )
-      {
-       std::list<std::string> entries;
-       if ( filesystem::readdir( entries, cachePath, false ) == 0 )
-       {
-         entries.sort();
-         std::set<std::string> oldfiles;
-         set_difference( entries.begin(), entries.end(), repoEscAliases.begin(), repoEscAliases.end(),
-                         std::inserter( oldfiles, oldfiles.end() ) );
-         for ( const std::string & old : oldfiles )
-         {
-           if ( old == Repository::systemRepoAlias() ) // don't remove the @System solv file
-             continue;
-           filesystem::recursive_rmdir( cachePath / old );
-         }
-       }
-      }
+      RepoManagerOptions defaultCache( _options.rootDir );
+      cleanupNonRepoMetadtaFolders( _options.repoRawCachePath,         defaultCache.repoRawCachePath,          repoEscAliases );
+      cleanupNonRepoMetadtaFolders( _options.repoSolvCachePath,                defaultCache.repoSolvCachePath,         repoEscAliases );
+      cleanupNonRepoMetadtaFolders( _options.repoPackagesCachePath,    defaultCache.repoPackagesCachePath,     repoEscAliases );
     }
     MIL << "end construct known repos" << endl;
   }
@@ -838,9 +874,6 @@ namespace zypp
         }
       }
 
-      // To test the new matadta create temp dir as sibling of mediarootpath
-      filesystem::TmpDir tmpdir( filesystem::TmpDir::makeSibling( mediarootpath ) );
-
       repo::RepoType repokind = info.type();
       // if unknown: probe it
       if ( repokind == RepoType::NONE )
index 77d8ec1..9f0a96a 100644 (file)
@@ -157,20 +157,20 @@ namespace zypp
       virtual void finishDeltaApply()
       {}
 
-      // Dowmload patch rpm:
-      // - path below url reported on start()
-      // - expected download size (0 if unknown)
-      // - download is interruptable
-      virtual void startPatchDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ )
+      /** \deprecated Unused since 2008 */
+      virtual ZYPP_DEPRECATED void startPatchDownload( const Pathname & /*filename*/, const ByteCount & /*downloadsize*/ )
       {}
 
-      virtual bool progressPatchDownload( int /*value*/ )
+      /** \deprecated Unused since 2008 */
+      virtual ZYPP_DEPRECATED bool progressPatchDownload( int /*value*/ )
       { return true; }
 
-      virtual void problemPatchDownload( const std::string &/*description*/ )
+      /** \deprecated Unused since 2008 */
+      virtual ZYPP_DEPRECATED void problemPatchDownload( const std::string &/*description*/ )
       {}
 
-      virtual void finishPatchDownload()
+      /** \deprecated Unused since 2008 */
+      virtual ZYPP_DEPRECATED void finishPatchDownload()
       {}
 
 
index c4b9a9c..0557284 100644 (file)
@@ -10,6 +10,7 @@
  *
 */
 #include <iostream>
+#include <fstream>
 #include <sstream>
 #include "zypp/repo/PackageDelta.h"
 #include "zypp/base/Logger.h"
@@ -23,6 +24,7 @@
 #include "zypp/TmpPath.h"
 #include "zypp/ZConfig.h"
 #include "zypp/RepoInfo.h"
+#include "zypp/RepoManager.h"
 
 using std::endl;
 
@@ -219,8 +221,37 @@ namespace zypp
        return ret; // <-- cache hit
       }
 
-      // HERE: cache misss, do download:
+      // HERE: cache misss, check toplevel cache or do download:
       RepoInfo info = _package->repoInfo();
+
+      // Check toplevel cache
+      {
+       RepoManagerOptions topCache;
+       if ( info.packagesPath().dirname() != topCache.repoPackagesCachePath )  // not using toplevel cache
+       {
+         const OnMediaLocation & loc( _package->location() );
+         if ( ! loc.checksum().empty() )       // no cache hit without checksum
+         {
+           PathInfo pi( topCache.repoPackagesCachePath / info.packagesPath().basename() / loc.filename() );
+           if ( pi.isExist() && loc.checksum() == CheckSum( loc.checksum().type(), std::ifstream( pi.c_str() ) ) )
+           {
+             report()->start( _package, pi.path().asFileUrl() );
+             const Pathname & dest( info.packagesPath() / loc.filename() );
+             if ( filesystem::assert_dir( dest.dirname() ) == 0 && filesystem::hardlinkCopy( pi.path(), dest ) == 0 )
+             {
+               ret = ManagedFile( dest );
+               if ( ! info.keepPackages() )
+                 ret.setDispose( filesystem::unlink );
+
+               MIL << "provided Package from toplevel cache " << _package << " at " << ret << endl;
+               report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
+               return ret; // <-- toplevel cache hit
+             }
+           }
+         }
+       }
+      }
+
       // FIXME we only support the first url for now.
       if ( info.baseUrlsEmpty() )
         ZYPP_THROW(Exception("No url in repository."));