Hello community,

here is the log from the commit of package yast2-pkg-bindings for 
openSUSE:Factory checked in at 2014-04-26 11:45:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-pkg-bindings (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-pkg-bindings.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-pkg-bindings"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-pkg-bindings/yast2-pkg-bindings.changes    
2014-04-13 13:13:07.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.yast2-pkg-bindings.new/yast2-pkg-bindings.changes   
    2014-04-26 11:45:15.000000000 +0200
@@ -1,0 +2,14 @@
+Tue Apr 22 12:40:55 UTC 2014 - [email protected]
+
+- remeber the base product NVRA (instead of the zypp product
+  reference which might be invalidated) to properly create the
+  /etc/products.d/baseproduct symlink (bnc#873885)
+- 3.1.9
+
+-------------------------------------------------------------------
+Tue Apr 15 14:48:45 UTC 2014 - [email protected]
+
+- fixed repeated service save problem (bnc#873198, bnc#873683#c7)
+- 3.1.8
+
+-------------------------------------------------------------------

Old:
----
  yast2-pkg-bindings-3.1.7.tar.bz2

New:
----
  yast2-pkg-bindings-3.1.9.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
--- /var/tmp/diff_new_pack.1PdtvQ/_old  2014-04-26 11:45:16.000000000 +0200
+++ /var/tmp/diff_new_pack.1PdtvQ/_new  2014-04-26 11:45:16.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-pkg-bindings-devel-doc
-Version:        3.1.7
+Version:        3.1.9
 Release:        0
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        yast2-pkg-bindings-%{version}.tar.bz2

++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.1PdtvQ/_old  2014-04-26 11:45:16.000000000 +0200
+++ /var/tmp/diff_new_pack.1PdtvQ/_new  2014-04-26 11:45:16.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-pkg-bindings
-Version:        3.1.7
+Version:        3.1.9
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-pkg-bindings-3.1.7.tar.bz2 -> yast2-pkg-bindings-3.1.9.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-pkg-bindings-3.1.7/package/yast2-pkg-bindings-devel-doc.spec 
new/yast2-pkg-bindings-3.1.9/package/yast2-pkg-bindings-devel-doc.spec
--- old/yast2-pkg-bindings-3.1.7/package/yast2-pkg-bindings-devel-doc.spec      
2014-04-02 20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/package/yast2-pkg-bindings-devel-doc.spec      
2014-04-22 16:21:42.000000000 +0200
@@ -16,7 +16,7 @@
 #
 
 Name:           yast2-pkg-bindings-devel-doc
-Version:        3.1.7
+Version:        3.1.9
 Release:        0
 License:        GPL-2.0
 Group:          Documentation/HTML
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-pkg-bindings-3.1.7/package/yast2-pkg-bindings.changes 
new/yast2-pkg-bindings-3.1.9/package/yast2-pkg-bindings.changes
--- old/yast2-pkg-bindings-3.1.7/package/yast2-pkg-bindings.changes     
2014-04-02 20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/package/yast2-pkg-bindings.changes     
2014-04-22 16:21:42.000000000 +0200
@@ -1,4 +1,18 @@
 -------------------------------------------------------------------
+Tue Apr 22 12:40:55 UTC 2014 - [email protected]
+
+- remeber the base product NVRA (instead of the zypp product
+  reference which might be invalidated) to properly create the
+  /etc/products.d/baseproduct symlink (bnc#873885)
+- 3.1.9
+
+-------------------------------------------------------------------
+Tue Apr 15 14:48:45 UTC 2014 - [email protected]
+
+- fixed repeated service save problem (bnc#873198, bnc#873683#c7)
+- 3.1.8
+
+-------------------------------------------------------------------
 Wed Apr  2 15:11:58 UTC 2014 - [email protected]
 
 - properly initialize "autorefresh_skipped" attribute (leaving it
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-pkg-bindings-3.1.7/package/yast2-pkg-bindings.spec 
new/yast2-pkg-bindings-3.1.9/package/yast2-pkg-bindings.spec
--- old/yast2-pkg-bindings-3.1.7/package/yast2-pkg-bindings.spec        
2014-04-02 20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/package/yast2-pkg-bindings.spec        
2014-04-22 16:21:42.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-pkg-bindings
-Version:        3.1.7
+Version:        3.1.9
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/BaseProduct.cc 
new/yast2-pkg-bindings-3.1.9/src/BaseProduct.cc
--- old/yast2-pkg-bindings-3.1.7/src/BaseProduct.cc     1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-pkg-bindings-3.1.9/src/BaseProduct.cc     2014-04-22 
16:21:42.000000000 +0200
@@ -0,0 +1,22 @@
+/* 
+ * File:   BaseProduct.cc
+ * Author: [email protected]
+ * 
+ */
+
+#include "BaseProduct.h"
+
+BaseProduct::BaseProduct(
+    const std::string& product_name,
+    const zypp::Edition& product_edition,
+    const zypp::Arch& product_arch,
+    const std::string& source_repo_alias
+) :
+  name(product_name),
+  edition(product_edition),
+  arch(product_arch),
+  repo_alias(source_repo_alias)
+{
+}
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/BaseProduct.h 
new/yast2-pkg-bindings-3.1.9/src/BaseProduct.h
--- old/yast2-pkg-bindings-3.1.7/src/BaseProduct.h      1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-pkg-bindings-3.1.9/src/BaseProduct.h      2014-04-22 
16:21:42.000000000 +0200
@@ -0,0 +1,37 @@
+/* 
+ * File:   BaseProduct.h
+ * Author: [email protected]
+ *
+ * Remember the attributes of the base product for creating the
+ * /etc/products.d/baseproduct symlink.
+ *
+ * (Note: zypp::Product reference cannot be used as it might be invalidated
+ * after adding/removing repositories or at target reload after commit.)
+ */
+
+#ifndef BASEPRODUCT_H
+#define BASEPRODUCT_H
+
+#include <string>
+#include <zypp/Edition.h>
+#include <zypp/Arch.h>
+
+class BaseProduct {
+
+public:
+  BaseProduct(
+    const std::string& product_name,
+    const zypp::Edition& product_edition,
+    const zypp::Arch& product_arch,
+    const std::string& source_repo_alias
+  );
+
+  std::string name;
+  // zypp::Edition contains both version and release
+  zypp::Edition edition;
+  zypp::Arch arch;
+  std::string repo_alias;
+};
+
+#endif /* BASEPRODUCT_H */
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/Makefile.am 
new/yast2-pkg-bindings-3.1.9/src/Makefile.am
--- old/yast2-pkg-bindings-3.1.7/src/Makefile.am        2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/Makefile.am        2014-04-22 
16:21:42.000000000 +0200
@@ -53,6 +53,7 @@
        ServiceManager.cc ServiceManager.h      \
        Service.cc                              \
        Network.cc                              \
+       BaseProduct.h BaseProduct.cc            \
        HelpTexts.h i18n.h log.h
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/Package.cc 
new/yast2-pkg-bindings-3.1.9/src/Package.cc
--- old/yast2-pkg-bindings-3.1.7/src/Package.cc 2014-04-02 20:25:49.000000000 
+0200
+++ new/yast2-pkg-bindings-3.1.9/src/Package.cc 2014-04-22 16:21:42.000000000 
+0200
@@ -2643,6 +2643,53 @@
     return MPS2YCPMap( ducounter.disk_usage( pkg ) );
 }
 
+
+zypp::Product::constPtr PkgFunctions::FindInstalledBaseProduct()
+{
+    // access to the Pool of Selectables
+    zypp::ResPoolProxy selectablePool(zypp::ResPool::instance().proxy());
+
+    // iterate over zypp::Products
+    for_(product_it, selectablePool.byKindBegin<zypp::Product>(),
+        selectablePool.byKindEnd<zypp::Product>())
+    {
+       // search an installed product
+       for_(installed_product_it, (*product_it)->installedBegin(),
+            (*product_it)->installedEnd())
+       {
+           // get the resolvable
+           zypp::ResObject::constPtr res = *installed_product_it;
+
+           // check if NVRA matches the base product
+            if (res && res->name() == base_product->name &&
+                res->edition() == base_product->edition &&
+                res->arch() == base_product->arch)
+
+           {
+               zypp::Product::constPtr product =
+                    boost::dynamic_pointer_cast<const zypp::Product>(res);
+
+               if (product)
+               {
+                    y2milestone("Found installed base product: %s-%s-%s (%s)",
+                        product->name().c_str(),
+                        product->edition().asString().c_str(),
+                        product->arch().asString().c_str(),
+                        product->summary().c_str()
+                    );
+
+                   return product;
+               }
+           }
+       }
+    }
+
+    // matching installed product was not found
+    y2error("Cannot find the installed base product");
+
+    return NULL;
+}
+
 // helper function - create a symbolic link to the created base product (by 
SourceCreateBase() function)
 // returns 'true' on success
 // see http://en.opensuse.org/Product_Management/Code11/installed
@@ -2653,7 +2700,10 @@
        y2milestone("Creating symlink for the base product...");
 
        // get the package
-       zypp::sat::Solvable refsolvable = base_product->referencePackage();
+        zypp::Product::constPtr installed_product = FindInstalledBaseProduct();
+        if (!installed_product) return false;
+
+        zypp::sat::Solvable refsolvable = 
installed_product->referencePackage();
 
        if (refsolvable != zypp::sat::Solvable::noSolvable)
        {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/PkgFunctions.cc 
new/yast2-pkg-bindings-3.1.9/src/PkgFunctions.cc
--- old/yast2-pkg-bindings-3.1.7/src/PkgFunctions.cc    2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/PkgFunctions.cc    2014-04-22 
16:21:42.000000000 +0200
@@ -141,6 +141,7 @@
 
     if (base_product)
     {
+        delete base_product;
        base_product = NULL;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/PkgFunctions.h 
new/yast2-pkg-bindings-3.1.9/src/PkgFunctions.h
--- old/yast2-pkg-bindings-3.1.7/src/PkgFunctions.h     2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/PkgFunctions.h     2014-04-22 
16:21:42.000000000 +0200
@@ -55,6 +55,7 @@
 #include <i18n.h>
 
 #include "ServiceManager.h"
+#include "BaseProduct.h"
 
 #include "PkgError.h"
 class PkgProgress;
@@ -160,7 +161,9 @@
     
       bool aliasExists(const std::string &alias, const 
std::list<zypp::RepoInfo> &reps) const;
 
-      zypp::Product::constPtr FindBaseProduct(const std::string &alias) const;
+      // remember the base product attributes for finding it later in
+      // the installed system
+      void RememberBaseProduct(const std::string &alias);
 
       zypp::RepoManager* CreateRepoManager();
 
@@ -224,7 +227,7 @@
 
       ServiceManager service_manager;
 
-      zypp::Product::constPtr base_product;
+      BaseProduct* base_product;
 
       std::vector<zypp::filesystem::TmpDir> tmp_dirs;
 
@@ -260,6 +263,9 @@
       // helper for installing/removing/upgrading a resolvable
       bool ResolvableUpdateInstallOrDelete(const YCPString& name_r, const 
YCPSymbol& kind_r, ResolvableAction action);
 
+      // it finds the resolvable using attributes saved earlier by 
RememberBaseProduct
+      zypp::Product::constPtr FindInstalledBaseProduct();
+
     public:
        // general
        /* TYPEINFO: void(string) */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/PkgService.cc 
new/yast2-pkg-bindings-3.1.9/src/PkgService.cc
--- old/yast2-pkg-bindings-3.1.7/src/PkgService.cc      2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/PkgService.cc      2014-04-16 
11:31:36.000000000 +0200
@@ -54,3 +54,7 @@
     return _old_alias;
 }
 
+void PkgService::setOrigAlias(const std::string& orig_alias)
+{
+    _old_alias = orig_alias;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/PkgService.h 
new/yast2-pkg-bindings-3.1.9/src/PkgService.h
--- old/yast2-pkg-bindings-3.1.7/src/PkgService.h       2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/PkgService.h       2014-04-16 
11:31:36.000000000 +0200
@@ -40,6 +40,7 @@
 
        std::string origAlias() const;
 
+        void setOrigAlias(const std::string& orig_alias);
 
     private:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/ServiceManager.cc 
new/yast2-pkg-bindings-3.1.9/src/ServiceManager.cc
--- old/yast2-pkg-bindings-3.1.7/src/ServiceManager.cc  2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/ServiceManager.cc  2014-04-16 
11:31:36.000000000 +0200
@@ -53,7 +53,7 @@
     }
 }
 
-void ServiceManager::SaveServices(zypp::RepoManager &repomgr) const
+void ServiceManager::SaveServices(zypp::RepoManager &repomgr)
 {
     for_ (it, _known_services.begin(), _known_services.end())
     {
@@ -75,9 +75,9 @@
     }
 }
 
-bool ServiceManager::SaveService(const std::string &alias, zypp::RepoManager 
&repomgr) const
+bool ServiceManager::SaveService(const std::string &alias, zypp::RepoManager 
&repomgr)
 {
-    PkgServices::const_iterator serv_it = _known_services.find(alias);
+    PkgServices::iterator serv_it = _known_services.find(alias);
 
     if (serv_it == _known_services.end())
     {
@@ -287,7 +287,7 @@
     return _known_services.size();
 }
 
-void ServiceManager::SavePkgService(const PkgService &s_known, 
zypp::RepoManager &repomgr) const
+void ServiceManager::SavePkgService(PkgService &s_known, zypp::RepoManager 
&repomgr) const
 {
     const std::string alias(s_known.alias());
     const zypp::ServiceInfo s_stored = repomgr.getService(alias);
@@ -305,6 +305,8 @@
         y2milestone("Adding new service %s", alias.c_str());
         // add the service
         repomgr.addService(s_known);
+        // set the old alias to properly save it next time
+        s_known.setOrigAlias(alias);
     }
     else
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/ServiceManager.h 
new/yast2-pkg-bindings-3.1.9/src/ServiceManager.h
--- old/yast2-pkg-bindings-3.1.7/src/ServiceManager.h   2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/ServiceManager.h   2014-04-16 
11:31:36.000000000 +0200
@@ -42,9 +42,9 @@
 
        void LoadServices(const zypp::RepoManager &repomgr);
 
-       void SaveServices(zypp::RepoManager &repomgr) const;
+       void SaveServices(zypp::RepoManager &repomgr);
 
-       bool SaveService(const std::string &alias, zypp::RepoManager &repomgr) 
const;
+       bool SaveService(const std::string &alias, zypp::RepoManager &repomgr);
 
        bool AddService(const std::string &alias, const std::string &url);
 
@@ -70,7 +70,7 @@
     private:
 
        // internal helper method
-       void SavePkgService(const PkgService &s_known, zypp::RepoManager 
&repomgr) const;
+       void SavePkgService(PkgService &s_known, zypp::RepoManager &repomgr) 
const;
 
        // current alias -> PkgService for convenient search by alias
        typedef std::map<std::string, PkgService> PkgServices;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/Source_Create.cc 
new/yast2-pkg-bindings-3.1.9/src/Source_Create.cc
--- old/yast2-pkg-bindings-3.1.7/src/Source_Create.cc   2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/Source_Create.cc   2014-04-22 
16:21:42.000000000 +0200
@@ -674,7 +674,7 @@
                if (base && !base_product)
                {
                    y2milestone("Searching a base product...");
-                   base_product = FindBaseProduct(repo->repoInfo().alias());
+                    RememberBaseProduct(repo->repoInfo().alias());
                }
            }
            catch ( const zypp::Exception& excpt)
@@ -709,7 +709,7 @@
            if (base && !base_product)
            {
                y2milestone("Searching the base product...");
-               base_product = FindBaseProduct(repo->repoInfo().alias());
+                RememberBaseProduct(repo->repoInfo().alias());
            }
        }
     }
@@ -872,10 +872,8 @@
     return ret;
 }
 
-zypp::Product::constPtr PkgFunctions::FindBaseProduct(const std::string 
&alias) const
+void PkgFunctions::RememberBaseProduct(const std::string &alias)
 {
-    zypp::Product::constPtr product = NULL;
-
     // access to the Pool of Selectables
     zypp::ResPoolProxy selectablePool(zypp::ResPool::instance().proxy());
 
@@ -891,35 +889,28 @@
            // check the repository
            if (res && res->repoInfo().alias() == alias)
            {
-               product = boost::dynamic_pointer_cast<const zypp::Product>(res);
+               zypp::Product::constPtr product = 
boost::dynamic_pointer_cast<const zypp::Product>(res);
 
                if (product)
                {
-                   break;
+                    y2milestone("Found base product: %s-%s-%s (%s)",
+                        product->name().c_str(),
+                        product->edition().asString().c_str(),
+                        product->arch().asString().c_str(),
+                        product->summary().c_str()
+                    );
+
+                    base_product = new BaseProduct(
+                        product->name(),
+                        product->edition(),
+                        product->arch(),
+                        alias
+                    );
                }
            }
        }
-
-       if (product)
-       {
-           break;
-       }
     }
 
     // no product in the pool
-    if (!product)
-    {
-       y2error("No base product has been found");
-    }
-    else
-    {
-       y2milestone("Found base product: %s %s (%s-%s)",
-           product->summary().c_str(),
-           product->edition().asString().c_str(),
-           product->name().c_str(),
-           product->edition().asString().c_str()
-       );
-    }
-
-    return product;
+    y2error("No base product has been found");
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-pkg-bindings-3.1.7/src/Source_Set.cc 
new/yast2-pkg-bindings-3.1.9/src/Source_Set.cc
--- old/yast2-pkg-bindings-3.1.7/src/Source_Set.cc      2014-04-02 
20:25:49.000000000 +0200
+++ new/yast2-pkg-bindings-3.1.9/src/Source_Set.cc      2014-04-22 
16:21:42.000000000 +0200
@@ -374,9 +374,10 @@
        repo->setDeleted();
 
        // removing the base product repository?
-       if (base_product && base_product->repoInfo().alias() == repo_alias)
+       if (base_product && base_product->repo_alias == repo_alias)
        {
            y2warning("Resetting the base product, the base product repository 
has been removed");
+            delete base_product;
            base_product = NULL;
        }
     }

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to