Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / target / TargetImpl.h
index adc6c47..21f4b04 100644 (file)
@@ -13,7 +13,6 @@
 #define ZYPP_TARGET_TARGETIMPL_H
 
 #include <iosfwd>
-#include <list>
 #include <set>
 
 #include "zypp/base/ReferenceCounted.h"
@@ -28,8 +27,9 @@
 #include "zypp/target/rpm/RpmDb.h"
 #include "zypp/target/TargetException.h"
 #include "zypp/target/RequestedLocalesFile.h"
-#include "zypp/target/SoftLocksFile.h"
+#include "zypp/target/SolvIdentFile.h"
 #include "zypp/target/HardLocksFile.h"
+#include "zypp/ManagedFile.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -67,9 +67,6 @@ namespace zypp
       /** Dtor. */
       virtual ~TargetImpl();
 
-      /** Null implementation */
-      static TargetImpl_Ptr nullimpl();
-
       /**
        * generates the unique anonymous id which is called
        * when creating the target
@@ -102,17 +99,17 @@ namespace zypp
       Pathname _tmpSolvfilesPath;
 
     public:
-      void load();
+      void load( bool force = true );
 
       void unload();
 
+      void reload();
+
       void clearCache();
 
-      void buildCache();
+      bool buildCache();
       //@}
 
-      std::string anonymousUniqueId() const;
-
     public:
 
       /** The root set for this target */
@@ -121,7 +118,10 @@ namespace zypp
 
       /** The directory to store things. */
       Pathname home() const
-      { return _root / "/var/lib/zypp"; }
+      { return home( _root ); }
+
+      static Pathname home( const Pathname & root_r )
+      { return root_r / "/var/lib/zypp"; }
 
       /** Commit changes in the pool */
       ZYppCommitResult commit( ResPool pool_r, const ZYppCommitPolicy & policy_r );
@@ -129,6 +129,9 @@ namespace zypp
       /** Install a source package on the Target. */
       void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
 
+      /** Provides a source package on the Target. */
+      ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r );
+
       /** Overload to realize stream output. */
       virtual std::ostream & dumpOn( std::ostream & str ) const
       {
@@ -153,28 +156,55 @@ namespace zypp
       /** \copydoc Target::baseProduct() */
       Product::constPtr baseProduct() const;
 
-      /** \copydoc Target::release() */
-      std::string release() const;
+      /** \copydoc Target::requestedLocales() */
+      LocaleSet requestedLocales() const
+      { return _requestedLocalesFile.locales(); }
+      /** \overload */
+      static LocaleSet requestedLocales( const Pathname & root_r );
 
       /** \copydoc Target::targetDistribution() */
       std::string targetDistribution() const;
+      /** \overload */
+      static std::string targetDistribution( const Pathname & root_r );
 
       /** \copydoc Target::targetDistributionRelease()*/
       std::string targetDistributionRelease() const;
+      /** \overload */
+      static std::string targetDistributionRelease( const Pathname & root_r );
+
+      /** \copydoc Target::targetDistributionFlavor()*/
+      std::string targetDistributionFlavor() const;
+      /** \overload */
+      static std::string targetDistributionFlavor( const Pathname & root_r );
+
+      /** \copydoc Target::distributionLabel()*/
+      Target::DistributionLabel distributionLabel() const;
+      /** \overload */
+      static Target::DistributionLabel distributionLabel( const Pathname & root_r );
 
       /** \copydoc Target::distributionVersion()*/
       std::string distributionVersion() const;
+      /** \overload */
+      static std::string distributionVersion( const Pathname & root_r );
 
       /** \copydoc Target::distributionFlavor() */
       std::string distributionFlavor() const;
+      /** \overload */
+      static std::string distributionFlavor( const Pathname & root_r );
+
+      /** \copydoc Target::anonymousUniqueId() */
+      std::string anonymousUniqueId() const;
+      /** \overload */
+      static std::string anonymousUniqueId( const Pathname & root_r );
 
     private:
       /** Commit ordered changes (internal helper) */
-      PoolItemList commit( const PoolItemList & items_r,
-                           const ZYppCommitPolicy & policy_r,
-                           ZYppCommitResult & result_r,
-                           CommitPackageCache & packageCache_r );
+      void commit( const ZYppCommitPolicy & policy_r,
+                  CommitPackageCache & packageCache_r,
+                  ZYppCommitResult & result_r );
 
+      /** Commit helper checking for file conflicts after download. */
+      void commitFindFileConflicts( const ZYppCommitPolicy & policy_r, ZYppCommitResult & result_r );
     protected:
       /** Path to the target */
       Pathname _root;
@@ -182,16 +212,12 @@ namespace zypp
       rpm::RpmDb _rpm;
       /** Requested Locales database */
       RequestedLocalesFile _requestedLocalesFile;
-      /** Soft-locks database */
-      SoftLocksFile _softLocksFile;
+      /** user/auto installed database */
+      SolvIdentFile _autoInstalledFile;
       /** Hard-Locks database */
       HardLocksFile _hardLocksFile;
       /** Cache distributionVersion */
       mutable std::string _distributionVersion;
-
-    private:
-      /** Null implementation */
-      static TargetImpl_Ptr _nullimpl;
     };
     ///////////////////////////////////////////////////////////////////