Avoid reinitialization of target if the root is the same only
authorStanislav Visnovsky <visnov@suse.cz>
Fri, 24 Feb 2006 07:25:35 +0000 (07:25 +0000)
committerStanislav Visnovsky <visnov@suse.cz>
Fri, 24 Feb 2006 07:25:35 +0000 (07:25 +0000)
zypp/Target.cc
zypp/Target.h
zypp/target/TargetImpl.cc
zypp/target/TargetImpl.h
zypp/zypp_detail/ZYppImpl.cc

index 18ee0eb..f32f0f5 100644 (file)
@@ -79,6 +79,9 @@ namespace zypp
   { _pimpl->enableStorage(root_r); }
 #endif
 
+  Pathname Target::root() const
+  { return _pimpl->root(); }
+
   int Target::commit(ResPool pool_r, int medianr, PoolItemList & errors_r
         , PoolItemList & remaining_r, PoolItemList & srcremaining_r)
   { return _pimpl->commit(pool_r, medianr, errors_r, remaining_r, srcremaining_r); }
index 6ba6c30..b71947c 100644 (file)
@@ -89,6 +89,9 @@ namespace zypp
     /** Set the log file for target */
     bool setInstallationLogfile(const Pathname & path_r);
 
+    /** Return the root set for this target */
+    Pathname root() const;
+
   public:
     /** Ctor */
     explicit
index d239fd0..5204b0b 100644 (file)
@@ -84,6 +84,11 @@ namespace zypp
       _storage.init(root_r);
       _storage_enabled = true;
     }
+
+    Pathname TargetImpl::root() const
+    {
+      return _root;
+    }
   
     const ResStore & TargetImpl::resolvables()
     {
index c49dbec..86f4b11 100644 (file)
@@ -80,6 +80,9 @@ namespace zypp
       /** All resolvables in the target. */
       const ResStore & resolvables();
 
+      /** The root set for this target */
+      Pathname root() const;
+
       /** Commit changes in the pool
          media = 0 means any/all medias
          media > 0 means limit commits to this media */
index fa8739c..6e9b0bf 100644 (file)
@@ -104,8 +104,8 @@ namespace zypp
 
     void ZYppImpl::initTarget(const Pathname & root, bool commit_only)
     {
-      if (_target) {
-       WAR << "Repeated call to initTarget()" << endl;
+      if (_target && _target->root() == root) {
+       MIL << "Repeated call to initTarget()" << endl;
         return;
       }