X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=zypp%2FTarget.h;h=1730c5c6126e1bc5462288d459f7259602a7fb86;hb=HEAD;hp=252c7bc3f8f6ff0a9edd621dd0db244a6589a977;hpb=10afc50a2505d15f87cdfa3c8a169cb29b39560d;p=platform%2Fupstream%2Flibzypp.git diff --git a/zypp/Target.h b/zypp/Target.h index 252c7bc..62cffba 100644 --- a/zypp/Target.h +++ b/zypp/Target.h @@ -14,14 +14,14 @@ #include -#include "zypp/base/ReferenceCounted.h" -#include "zypp/base/NonCopyable.h" -#include "zypp/base/PtrTypes.h" -#include "zypp/base/Deprecated.h" +#include +#include +#include +#include -#include "zypp/Product.h" -#include "zypp/Pathname.h" -#include "zypp/ResPool.h" +#include +#include +#include /////////////////////////////////////////////////////////////////// namespace zypp @@ -70,19 +70,14 @@ namespace zypp */ void load(); + void reload(); + /** * unload target resolvables from the * pool */ void unload(); - /** \deprecated NOOP - */ - ZYPP_DEPRECATED void reset() {} - - /** Null implementation */ - static Target_Ptr nullimpl(); - /** Refference to the RPM database */ target::rpm::RpmDb & rpmDb(); @@ -98,13 +93,14 @@ namespace zypp /** Return the root set for this target */ Pathname root() const; + /** Whether the targets \ref root is not \c "/". */ + bool chrooted() const + { return( ! root().emptyOrRoot() ); } + /** Return the path prefixed by the target root, unless it already is prefixed. */ Pathname assertRootPrefix( const Pathname & path_r ) const { return Pathname::assertprefix( root(), path_r ); } - /** return the last modification date of the target */ - Date timestamp() const; - /** * returns the target base installed product, also known as * the distribution or platform. @@ -118,39 +114,83 @@ namespace zypp * if you require some base product attributes when the * target is not loaded into the pool, see * \ref targetDistribution , \ref targetDistributionRelease - * and \ref distributionVersion that obtain the data + * and \ref distributionVersion that obtain the data * on demand from the installed product information. */ Product::constPtr baseProduct() const; - /** \name Base product and registration. */ - //@{ - /** The targets distribution release string (/etc/SuSE-release) - * \code - * openSUSE 10.3 (i586) - * \endcode - * \deprecated \ref targetDistribution might be a better choice as it does not depend on /etc/SuSE-release. - */ - std::string release() const ZYPP_DEPRECATED; + /** + * \brief Languages to be supported by the system. + * E.g. language specific packages to be installed. + */ + LocaleSet requestedLocales() const; + /** \overload Use a specific root_r, if empty the default targets root, or '/' + */ + static LocaleSet requestedLocales( const Pathname & root_r ); + /** Update the database of autoinstalled packages. + * This is done on commit, so you usually don't need to call this explicitly. + */ + void updateAutoInstalled(); + + public: + /** \name Base product and registration. + * + * Static methods herein allow to retrieve the values without explicitly + * initializing the \ref Target. They take a targets root directory as + * argument. If an empty \ref Pathname is passed, an already existing + * Targets root is used, otherwise \c "/" is assumed. + */ + //@{ /** This is \c register.target attribute of the installed base product. * Used for registration and \ref Service refresh. */ std::string targetDistribution() const; + /** \overload */ + static std::string targetDistribution( const Pathname & root_r ); /** This is \c register.release attribute of the installed base product. * Used for registration. */ std::string targetDistributionRelease() const; - //@} + /** \overload */ + static std::string targetDistributionRelease( const Pathname & root_r ); + + /** This is \c register.flavor attribute of the installed base product. + * Used for registration. + * \note don't mistake this for \ref distributionFlavor + */ + std::string targetDistributionFlavor() const; + /** \overload */ + static std::string targetDistributionFlavor( const Pathname & root_r ); + + struct DistributionLabel { std::string shortName; std::string summary; }; + /** This is \c shortName and \c summary attribute of the installed base product. + * Used e.g. for the bootloader menu. + */ + DistributionLabel distributionLabel() const; + /** \overload */ + static DistributionLabel distributionLabel( const Pathname & root_r ); /** This is \c version attribute of the installed base product. * For example http://download.opensue.org/update/11.0 * The 11.0 corresponds to the base product version. */ std::string distributionVersion() const; - //@} - + /** \overload */ + static std::string distributionVersion( const Pathname & root_r ); + + /** + * This is \c flavor attribute of the installed base product + * but does not require the target to be loaded as it remembers + * the last used one. It can be empty is the target has never + * been loaded, as the value is not present in the system + * but computer from a package provides + * \note don't mistake this for \ref targetDistributionFlavor + */ + std::string distributionFlavor() const; + /** \overload */ + static std::string distributionFlavor( const Pathname & root_r ); /** * anonymous unique id @@ -161,6 +201,9 @@ namespace zypp * */ std::string anonymousUniqueId() const; + /** \overload */ + static std::string anonymousUniqueId( const Pathname & root_r ); + //@} public: /** Ctor. If \c doRebuild_r is \c true, an already existing @@ -183,8 +226,6 @@ namespace zypp /** Pointer to implementation */ RW_pointer > _pimpl; - - static Target_Ptr _nullimpl; }; /////////////////////////////////////////////////////////////////// @@ -192,6 +233,14 @@ namespace zypp inline std::ostream & operator<<( std::ostream & str, const Target & obj ) { return obj.dumpOn( str ); } + /** \relates Target::DistributionLabel Stream output. + * Write out the content as key/value pairs: + * \code + * summary=Beautiful Name + * shortName=BN + * \endcode + */ + std::ostream & operator<<( std::ostream & str, const Target::DistributionLabel & obj ); ///////////////////////////////////////////////////////////////// } // namespace zypp