Imported Upstream version 15.21.0 92/94692/1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 1 Nov 2016 02:07:59 +0000 (11:07 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 1 Nov 2016 02:08:00 +0000 (11:08 +0900)
Change-Id: Ie69723b432ec06785aee816a3c8afe1c7d28ef5a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
VERSION.cmake
package/libzypp.changes
po/zypp-po.tar.bz2
tests/zypp/Arch_test.cc
tests/zypp/Capabilities_test.cc
tools/zypp-NameReqPrv.cc
zypp/DiskUsageCounter.cc
zypp/RepoInfo.cc
zypp/RepoInfo.h

index 22b69d4..68049d5 100644 (file)
@@ -60,9 +60,9 @@
 #
 SET(LIBZYPP_MAJOR "15")
 SET(LIBZYPP_COMPATMINOR "19")
-SET(LIBZYPP_MINOR "20")
+SET(LIBZYPP_MINOR "21")
 SET(LIBZYPP_PATCH "0")
 #
-# LAST RELEASED: 15.20.0 (19)
+# LAST RELEASED: 15.21.0 (19)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index 91fd20e..b0de6e7 100644 (file)
@@ -1,4 +1,27 @@
 -------------------------------------------------------------------
+Wed Jan 20 17:12:42 CET 2016 - ma@suse.de
+
+- Filter unwanted btrfs subvolumes (fixes #54, closes #55, bnc#949945)
+- RepoInfo: Provide access to repo content keywords
+- Build with boost-1.60.0
+- version 15.21.0 (19)
+
+-------------------------------------------------------------------
+Thu Jan 14 01:13:17 CET 2016 - ma@suse.de
+
+- Update zypp-po.tar.bz2
+
+-------------------------------------------------------------------
+Thu Jan  7 01:13:28 CET 2016 - ma@suse.de
+
+- Update zypp-po.tar.bz2
+
+-------------------------------------------------------------------
+Thu Dec 24 01:13:13 CET 2015 - ma@suse.de
+
+- Update zypp-po.tar.bz2
+
+-------------------------------------------------------------------
 Fri Dec 11 19:07:09 CET 2015 - ma@suse.de
 
 - ResPoolProxy: make begin/end pairs Iterable
index 94d6616..9287f04 100644 (file)
Binary files a/po/zypp-po.tar.bz2 and b/po/zypp-po.tar.bz2 differ
index db6c738..a76d916 100644 (file)
 #include "zypp/Arch.h"
 
 // Boost.Test
-#include <boost/test/floating_point_comparison.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
 using boost::unit_test::test_suite;
 using boost::unit_test::test_case;
-using boost::test_tools::close_at_tolerance;
 
 using namespace std;
 using namespace zypp;
index 0434fa9..0f64f4d 100644 (file)
@@ -6,7 +6,6 @@
 #include <string>
 
 // Boost.Test
-#include <boost/test/floating_point_comparison.hpp>
 #include <boost/test/auto_unit_test.hpp>
 
 #include "TestSetup.h"
@@ -16,7 +15,6 @@
 
 using boost::unit_test::test_suite;
 using boost::unit_test::test_case;
-using boost::test_tools::close_at_tolerance;
 
 using namespace std;
 using namespace zypp;
index ae041a2..d2d669a 100644 (file)
@@ -40,6 +40,7 @@ int usage( const std::string & msg_r = std::string(), int exit_r = 100 )
   cerr << "  -o/-O    turn on/off looking for obsoletes   (default off)" << endl;
   cerr << "  -m/-M    turn on/off looking for recommends  (default off)" << endl;
   cerr << "  -s/-S    turn on/off looking for supplements (default off)" << endl;
+  cerr << "  -e/-E    turn on/off looking for enhan./sugg.(default off)" << endl;
   cerr << "  -a       short for -n -p -r" << endl;
   cerr << "  -A       short for -n -P -R" << endl;
   cerr << "  -D <pkg> dump dependencies of <pkg>" << endl;
@@ -197,6 +198,7 @@ int main( int argc, char * argv[] )
   bool obsoletes       ( false );
   bool recommends      ( false );
   bool supplements     ( false );
+  bool enhacements     ( false );
 
   for ( ; argc; --argc,++argv )
   {
@@ -231,6 +233,8 @@ int main( int argc, char * argv[] )
         case 'M': recommends = false;  break;
         case 's': supplements =        true;   break;
         case 'S': supplements =        false;  break;
+        case 'e': enhacements =        true;   break;
+        case 'E': enhacements =        false;  break;
       }
       continue;
     }
@@ -280,10 +284,16 @@ int main( int argc, char * argv[] )
        q.addDependency( sat::SolvAttr::recommends );
       if ( supplements )
        q.addDependency( sat::SolvAttr::supplements );
+      if ( enhacements )
+      {
+       q.addDependency( sat::SolvAttr::enhances );
+       q.addDependency( sat::SolvAttr::suggests );
+      }
     }
 
     message << *argv << " [" << (ignorecase?'i':'_') << (names?'n':'_') << (requires?'r':'_') << (provides?'p':'_')
-    << (conflicts?'c':'_') << (obsoletes?'o':'_') << (recommends?'m':'_') << (supplements?'s':'_') << "] {" << endl;
+    << (conflicts?'c':'_') << (obsoletes?'o':'_') << (recommends?'m':'_') << (supplements?'s':'_') << (enhacements?'e':'_')
+    << "] {" << endl;
 
     for_( it, q.begin(), q.end() )
     {
index 6ce9c07..f64b0e6 100644 (file)
@@ -127,6 +127,9 @@ namespace zypp
   {
     DiskUsageCounter::MountPointSet ret;
 
+    typedef std::map<ulong, MountPoint> Btrfsfilter;
+    Btrfsfilter btrfsfilter;   // see btrfs hack below
+
       std::ifstream procmounts( "/proc/mounts" );
 
       if ( !procmounts ) {
@@ -213,7 +216,7 @@ namespace zypp
            //
            const char * mpunwanted[] = {
              "/mnt", "/media", "/mounts", "/floppy", "/cdrom",
-             "/suse", "/var/tmp", "/var/adm/mount", "/var/adm/YaST",
+             "/suse", "/tmp", "/var/tmp", "/var/adm/mount", "/var/adm/YaST",
              /*last*/0/*entry*/
            };
 
@@ -252,8 +255,10 @@ namespace zypp
            //
            // check for snapshotting btrfs
            //
+           bool btrfshack = false;
            if ( words[2] == "btrfs" )
            {
+             btrfshack = true;
              if ( geteuid() != 0 )
              {
                DBG << "Assume snapshots on " << words[1] << ": non-root user can't check" << std::endl;
@@ -292,6 +297,25 @@ namespace zypp
                DBG << "Filter zero-sized mount point : " << l << std::endl;
                continue;
              }
+             if ( btrfshack )
+             {
+               // HACK:
+               // Collect just the top/1st mountpoint of each btrfs volume
+               // (by file system ID). This filters away nested subvolumes
+               // which otherwise break per package disk usage computation.
+               // FIX: Computation must learn to handle multiple mount points
+               // contributing to the same file system.
+               MountPoint & bmp( btrfsfilter[sb.f_fsid] );
+               if ( bmp.fstype.empty() )       // 1st occurance
+               {
+                 bmp = DiskUsageCounter::MountPoint( mp, words[2], sb.f_bsize,
+                                                     ((long long)sb.f_blocks)*sb.f_bsize/1024,
+                                                     ((long long)(sb.f_blocks - sb.f_bfree))*sb.f_bsize/1024, 0LL, hints );
+               }
+               else if ( bmp.dir > mp )
+                 bmp.dir = mp;
+               continue;
+             }
              ret.insert( DiskUsageCounter::MountPoint( mp, words[2], sb.f_bsize,
                ((long long)sb.f_blocks)*sb.f_bsize/1024,
                ((long long)(sb.f_blocks - sb.f_bfree))*sb.f_bsize/1024, 0LL, hints ) );
@@ -300,6 +324,10 @@ namespace zypp
        }
     }
 
+    // collect filtered btrfs volumes
+    for ( auto && bmp : btrfsfilter )
+      ret.insert( std::move(bmp.second) );
+
     return ret;
   }
 
index 3956812..8d35fba 100644 (file)
@@ -94,15 +94,18 @@ namespace zypp
     { return !emptybaseurls && !_baseUrls.empty(); }
 
 
+    const std::set<std::string> & contentKeywords() const
+    { hasContent()/*init if not yet done*/; return _keywords.second; }
+
     void addContent( const std::string & keyword_r )
-    { _keywords.insert( keyword_r ); }
+    { _keywords.second.insert( keyword_r ); if ( ! hasContent() ) _keywords.first = true; }
 
-    bool hasContent( const std::string & keyword_r ) const
+    bool hasContent() const
     {
-      if ( _keywords.empty() && ! metadatapath.empty() )
+      if ( !_keywords.first && ! metadatapath.empty() )
       {
        // HACK directly check master index file until RepoManager offers
-       // some content probing ans zypepr uses it.
+       // some content probing and zypper uses it.
        /////////////////////////////////////////////////////////////////
        MIL << "Empty keywords...." << metadatapath << endl;
        Pathname master;
@@ -112,10 +115,10 @@ namespace zypp
          xml::Reader reader( master );
          while ( reader.seekToNode( 2, "content" ) )
          {
-           _keywords.insert( reader.nodeText().asString() );
+           _keywords.second.insert( reader.nodeText().asString() );
            reader.seekToEndNode( 2, "content" );
          }
-         _keywords.insert( "" );       // valid content in _keywords even if empty
+         _keywords.first = true;       // valid content in _keywords even if empty
        }
        else if ( PathInfo( (master=metadatapath/"/content") ).isFile() )
        {
@@ -129,19 +132,22 @@ namespace zypp
                                if ( str::split( line_r, std::back_inserter(words) ) > 1
                                  && words[0].length() == 12 /*"REPOKEYWORDS"*/ )
                                {
-                                 this->_keywords.insert( ++words.begin(), words.end() );
+                                 this->_keywords.second.insert( ++words.begin(), words.end() );
                                }
                                return true; // mult. occurrances are ok.
                              }
                              return( ! str::startsWith( line_r, "META " ) );   // no need to parse into META section.
                            } );
-         _keywords.insert( "" );
+         _keywords.first = true;       // valid content in _keywords even if empty
        }
        /////////////////////////////////////////////////////////////////
       }
-      return( _keywords.find( keyword_r ) != _keywords.end() );
+      return _keywords.first;
     }
 
+    bool hasContent( const std::string & keyword_r ) const
+    { return( hasContent() && _keywords.second.find( keyword_r ) != _keywords.second.end() ); }
+
     /** Signature check result needs to be stored/retrieved from _metadatapath.
      * Don't call them from outside validRepoSignature/setValidRepoSignature
      */
@@ -223,7 +229,7 @@ namespace zypp
 
   private:
     mutable RepoVariablesReplacedUrlList _baseUrls;
-    mutable std::set<std::string> _keywords;
+    mutable std::pair<FalseBool, std::set<std::string> > _keywords;
 
     friend Impl * rwcowClone<Impl>( const Impl * rhs );
     /** clone for RWCOW_pointer */
@@ -423,10 +429,15 @@ namespace zypp
   bool RepoInfo::baseUrlSet() const
   { return _pimpl->baseurl2dump(); }
 
+  const std::set<std::string> & RepoInfo::contentKeywords() const
+  { return _pimpl->contentKeywords(); }
 
   void RepoInfo::addContent( const std::string & keyword_r )
   { _pimpl->addContent( keyword_r ); }
 
+  bool RepoInfo::hasContent() const
+  { return _pimpl->hasContent(); }
+
   bool RepoInfo::hasContent( const std::string & keyword_r ) const
   { return _pimpl->hasContent( keyword_r ); }
 
index 680c2b8..e2b0bc2 100644 (file)
@@ -347,6 +347,10 @@ namespace zypp
        */
       void setTargetDistribution(const std::string & targetDistribution);
 
+
+      /** Content keywords defined. */
+      const std::set<std::string> & contentKeywords() const;
+
       /** Add content keywords */
       void addContent( const std::string & keyword_r );
       /** \overload add keywords from container */
@@ -359,11 +363,11 @@ namespace zypp
       { addContentFrom( container_r.begin(), container_r.end() ); }
 
       /** Check for content keywords.
-       * Checking for an empty string returns whether content kewords are
-       * known at all. They may be missing due to missing metadata in disabled
-       * repos.
+       * They may be missing due to missing metadata in disabled repos.
        */
-      bool hasContent( const std::string & keyword_r = std::string() ) const;
+      bool hasContent() const;
+      /** \overload check for a keywords being present */
+      bool hasContent( const std::string & keyword_r ) const;
       /** \overload check for \b all keywords being present */
       template <class TIterator>
       bool hasContentAll( TIterator begin_r, TIterator end_r ) const