Imported Upstream version 17.28.7 upstream/17.28.7
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Dec 2021 00:31:40 +0000 (09:31 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Dec 2021 00:31:40 +0000 (09:31 +0900)
VERSION.cmake
doc/autoinclude/RepoVariables.doc
package/libzypp.changes
tests/zypp/PurgeKernels_test.cc
zypp-core/base/LogControl.cc
zypp/Locks.cc
zypp/PoolQuery.cc
zypp/PoolQuery.h
zypp/PurgeKernels.cc

index 7935739..5989889 100644 (file)
@@ -61,8 +61,8 @@
 SET(LIBZYPP_MAJOR "17")
 SET(LIBZYPP_COMPATMINOR "22")
 SET(LIBZYPP_MINOR "28")
-SET(LIBZYPP_PATCH "6")
+SET(LIBZYPP_PATCH "7")
 #
-# LAST RELEASED: 17.28.6 (22)
+# LAST RELEASED: 17.28.7 (22)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index ac423f7..7e6d5b6 100644 (file)
@@ -6,7 +6,7 @@
 
 \section zypp-repovars-intro Repository Variables
 
-Within a \c .repo or \c .serivce file, the name and URLs are subject to variable substitution.
+Within a \c .repo or \c .service file, the name and URLs are subject to variable substitution.
 
 Variables are e.g. usefull for related repositories like packman (<tt>http://ftp.gwdg.de/pub/linux/packman/suse/$releasever</tt>), which shall always fit the installed distribution, even after a distribution upgrade. To help performing a distribution upgrade, the value of \c $releasever can be overwritten in zypper using the \c --releasever global option. This way you can easily switch all repositories using \c $releasever to the new version (provided the server layouts did not change and new repos are already available).
 
index 9d87895..ada579c 100644 (file)
@@ -1,4 +1,13 @@
 -------------------------------------------------------------------
+Thu Nov  4 15:16:29 CET 2021 - ma@suse.de
+
+- Check log writer before accessing it (fixes #355, bsc#1192337)
+- Save locks: Update an existing locks changed comment string.
+- Allow uname-r format in purge kernels keepspec (fixes
+  openSUSE/zypper#418)
+- version 17.28.7 (22)
+
+-------------------------------------------------------------------
 Mon Oct 18 12:02:57 CEST 2021 - ma@suse.de
 
 - Zypper should keep cached files if transaction is aborted
index ef5c560..a6b7e3a 100644 (file)
@@ -292,6 +292,20 @@ namespace  {
           //{ "kernel-default-base-5.7.8-3.1.1.1.x86_64" },
           }
       },
+      // same test set as before, but this time the user took the uname-r kernel output
+      // we should ignore the -flavor in the end and just use the edition part
+      TestSample {
+        TESTS_SRC_DIR"/zypp/data/PurgeKernels/kernel-base",
+        "5.7.8-3-default",
+        Arch("x86_64"),
+        "running, 5.7.8-2.1.1-default",
+        {
+          { "kernel-default-base-5.7.8-1.1.1.1.x86_64" },
+          { "kernel-default-base-5.8.8-2.1.1.1.x86_64" },
+          //{ "kernel-default-base-5.7.8-2.1.1.1.x86_64" },
+          //{ "kernel-default-base-5.7.8-3.1.1.1.x86_64" },
+          }
+      },
       TestSample {
         TESTS_SRC_DIR"/zypp/data/PurgeKernels/flavour",
         "1-3-rt",
index 998f5e3..f2bed4f 100644 (file)
@@ -252,7 +252,8 @@ namespace zypp
       // if we are in the same thread as the Log worker we can directly push our messages out, no need to use the socket
       if ( std::this_thread::get_id() == LogThread::instance().threadId() ) {
         auto writer = LogThread::instance().getLineWriter();
-        writer->writeOut( msg );
+        if ( writer )
+          writer->writeOut( msg );
         return;
       }
 
index 5e5ef6d..fb212d3 100644 (file)
@@ -423,7 +423,7 @@ public:
 bool Locks::Impl::mergeList(callback::SendReport<SavingLocksReport>& report)
 {
   MIL << "merge list old: " << locks().size()
-    << " to add: " << toAdd.size() << "to remove: " << toRemove.size() << endl;
+    << " to add: " << toAdd.size() << " to remove: " << toRemove.size() << endl;
   for_(it,toRemove.begin(),toRemove.end())
   {
     std::set<sat::Solvable> s(it->begin(),it->end());
@@ -433,7 +433,11 @@ bool Locks::Impl::mergeList(callback::SendReport<SavingLocksReport>& report)
   if (!report->progress())
     return false;
 
-  MANIPlocks().insert( toAdd.begin(), toAdd.end() );
+  for ( const auto & q : toAdd ) {
+    const auto & [i,b] { MANIPlocks().insert( q ) };
+    if ( not b &&  i->comment() != q.comment() )
+      i->setComment( q.comment() ); // update comment if query already exists
+  }
 
   toAdd.clear();
   toRemove.clear();
index 3a338fb..00c8a5a 100644 (file)
@@ -455,8 +455,8 @@ namespace zypp
     /** Kinds to search */
     Kinds _kinds;
 
-    /** comments */
-    std::string _comment;
+    /** Optional comment string for serialization. */
+    mutable std::string _comment;
     //@}
 
   public:
@@ -492,6 +492,7 @@ namespace zypp
           && _attrs.size() == 1
           && _attrs.begin()->first == sat::SolvAttr::name ) )
       {
+        // ma: Intentionally a different _comment is not considered.
         return ( _strings == rhs._strings
               && _attrs == rhs._attrs
               && _uncompiledPredicated == rhs._uncompiledPredicated
@@ -870,8 +871,12 @@ namespace zypp
   void PoolQuery::addKind(const ResKind & kind)
   { _pimpl->_kinds.insert(kind); }
 
+  void PoolQuery::setComment(const std::string & comment) const
+  { _pimpl->_comment = comment; }
+#if LEGACY(1722)
   void PoolQuery::setComment(const std::string & comment)
   { _pimpl->_comment = comment; }
+#endif
 
   void PoolQuery::addString(const std::string & value)
   { _pimpl->_strings.insert(value); }
@@ -1476,8 +1481,8 @@ namespace zypp
       str << "complex: "<< it->serialize() << delim;
     }
 
-    str << PoolQueryAttr::commentAttr.asString() << ": "
-        << comment() << delim ;
+    if ( const std::string & c { comment() }; not c.empty() )
+      str << PoolQueryAttr::commentAttr.asString() << ": " << c << delim ;
 
     //separating delim - protection
     str << delim;
index 8568f4a..6e5207b 100644 (file)
@@ -159,8 +159,14 @@ namespace zypp
      * only the specified repo will be returned (multiple repos will be ORed).
      */
     void addRepo(const std::string &repoalias);
-    void setComment(const std::string & comment);
 
+    /** Set an optional comment string describing the purpose of the query.
+     * Stored and retrieved when serializing the query. E.g. as lock.
+     */
+    void setComment(const std::string & comment) const;
+#if LEGACY(1722)
+    void setComment(const std::string & comment);
+#endif
 
     /** Installed status filter setters. */
     //@{
index 7f699ec..19f539e 100644 (file)
@@ -324,7 +324,18 @@ namespace zypp {
       } else {
         str::smatch what;
         if ( !str::regex_match( word, what, specRegex ) ) {
-          _keepSpecificEditions.insert( Edition(word) );
+          // Allow uname_r version numbers by cutting off any postfix that comes after a second dash, including the second dash.
+          // Github-Issue openSUSE/zypper#418
+          std::string_view edition(word);
+          const auto firstDash = word.find_first_of ('-');
+          if ( firstDash != std::string::npos ) {
+            const auto secondDash = word.find_first_of ('-', firstDash+1 );
+            if ( secondDash != std::string::npos ) {
+              WAR << "Ignoring possible flavor postfix:'"<< word.substr (secondDash) <<"' in keep spec: " << word << std::endl;
+              edition = std::string_view( word.c_str (), secondDash );
+            }
+          }
+          _keepSpecificEditions.insert( Edition(IdString(edition)) );
           continue;
         }
 
@@ -456,6 +467,7 @@ namespace zypp {
             for ( Capability prov : solv.provides() ) {
               if ( prov.detail().name() == solv.name() && _keepSpecificEditions.count( prov.detail().ed() ) ) {
                 markAsKeep( solv );
+                break;
               }
             }
           });