#
SET(LIBZYPP_MAJOR "5")
SET(LIBZYPP_COMPATMINOR "8")
-SET(LIBZYPP_MINOR "9")
+SET(LIBZYPP_MINOR "10")
SET(LIBZYPP_PATCH "0")
#
# LAST RELEASED: 5.9.0 (8)
#undef OUTS
}
+namespace zypp
+{
+ enum TestE {
+ TE1, TE2, TE3
+ };
+
+ inline void fromString( const std::string & str_r, TestE & cl_r )
+ { cl_r = TE1; }
+
+}
+
/******************************************************************
**
** FUNCTION NAME : main
INT << "===[START]==========================================" << endl;
ZConfig::instance();
-#if 0
- ServiceInfo s( "STest", Url("dir:///somewhere") );
- DBG << s << endl;
- s.addCatalogToEnable( "foo" );
- s.addCatalogToEnable( "ba a" );
- s.addCatalogToEnable( "kaa" );
- DBG << s << endl;
+
+#if 1
+ DBG << str::fromString<TestE>("te1") << endl;
+
+
///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
}
getZYpp()->target()->load();
USR << getZYpp()->target()->targetDistribution() << endl;
+ USR << getZYpp()->target()->targetDistributionRelease() << endl;
+ USR << getZYpp()->target()->targetDistributionFlavor() << endl;
}
}
-------------------------------------------------------------------
+Thu Sep 11 14:41:28 CEST 2008 - ma@suse.de
+
+- Fix evaluation of vendor support flags.
+- Adapt retrieval of registration data (targetDistribution,
+ targetDistributionRelease and targetDistributionFlavor).
+- revision 11013
+
+-------------------------------------------------------------------
Wed Sep 10 18:23:52 CEST 2008 - ma@suse.de
- Follow gpgcheck tag in .repo file and do no check if disabled.
VendorSupportOption Package::vendorSupport() const
{
Keywords kw(keywords());
-
+
for_( it, kw.begin(), kw.end() )
{
if ( *it == "support_unsupported")
return VendorSupportUnsupported;
if ( *it == "support_acc")
return VendorSupportACC;
-
+
if ( *it == "support_l1")
return VendorSupportLevel1;
if ( *it == "support_l2")
return VendorSupportLevel3;
}
return VendorSupportUnknown;
- }
+ }
bool Package::maybeUnsupported() const
{
- return ( vendorSupport() & ( VendorSupportACC | VendorSupportUnsupported | VendorSupportUnknown ) == ( VendorSupportACC | VendorSupportUnsupported | VendorSupportUnknown ) );
+ return ( vendorSupport() & ( VendorSupportACC | VendorSupportUnsupported | VendorSupportUnknown ) );
}
-
Changelog Package::changelog() const
{
- Target_Ptr target;
- try
+ Target_Ptr target( getZYpp()->getTarget() );
+ if ( ! target )
{
- target = getZYpp()->target();
+ ERR << "Target not initialized. Changelog is not available." << std::endl;
+ return Changelog();
}
- catch ( const Exception &e )
- {
- ERR << "Target not initialized. Changelog is not available." << std::endl;
- return Changelog();
- }
-
if ( repository().isSystemRepo() )
{
std::string Target::targetDistribution() const
{ return _pimpl->targetDistribution(); }
+ std::string Target::targetDistributionRelease() const
+ { return _pimpl->targetDistributionRelease(); }
+
+ std::string Target::targetDistributionFlavor() const
+ { return _pimpl->targetDistributionFlavor(); }
+
std::string Target::anonymousUniqueId() const
{ return _pimpl->anonymousUniqueId(); }
/** return the last modification date of the target */
Date timestamp() 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;
+ std::string release() const ZYPP_DEPRECATED;
- /** This is "distribution-arch" of the installed base product.
+ /** This is \c register.target attribute of the installed base product.
* Used for registration and \ref Service refresh.
*/
std::string targetDistribution() const;
+ /** This is \c register.release attribute of the installed base product.
+ * Used for registration.
+ */
+ std::string targetDistributionRelease() const;
+
+ /** This is \c register.flavor attribute of the installed base product.
+ * Used for registration.
+ */
+ std::string targetDistributionFlavor() const;
+ //@}
+
/**
* anonymous unique id
*
return _rpm.timestamp();
}
+ ///////////////////////////////////////////////////////////////////
+
std::string TargetImpl::release() const
{
std::ifstream suseRelease( (_root / "/etc/SuSE-release").c_str() );
return _("Unknown Distribution");
}
- std::string TargetImpl::targetDistribution() const
+ ///////////////////////////////////////////////////////////////////
+
+ namespace
{
- std::ostringstream cmd;
- cmd << "rpmdb2solv";
- cmd << " -n";
- if ( ! _root.empty() )
- cmd << " -r '" << _root << "'";
- cmd << " -p '" << Pathname::assertprefix( _root, "/etc/products.d" ) << "'";
- cmd << " -a distribution.target";
-
- MIL << "Executing: " << cmd << endl;
- ExternalProgram prog( cmd.str(), ExternalProgram::Discard_Stderr );
- for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
+ std::string rpmdb2solvAttr( const std::string & attr_r, const Pathname & root_r )
{
- return str::trim(output);
- }
+ std::ostringstream cmd;
+ cmd << "rpmdb2solv";
+ cmd << " -n";
+ if ( ! root_r.empty() )
+ cmd << " -r '" << root_r << "'";
+ cmd << " -p '" << Pathname::assertprefix( root_r, "/etc/products.d" ) << "'";
+ cmd << " -a distribution.target";
+
+ MIL << "Executing: " << cmd << endl;
+ ExternalProgram prog( cmd.str(), ExternalProgram::Discard_Stderr );
+ for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
+ {
+ return str::trim(output);
+ }
- int ret = prog.close();
- WAR << "Got no output from rpmdb2solv (returned " << ret << ")." << endl;
+ int ret = prog.close();
+ WAR << "Got no output from rpmdb2solv (returned " << ret << ")." << endl;
- return std::string();
+ return std::string();
+ }
}
+ std::string TargetImpl::targetDistribution() const
+ { return rpmdb2solvAttr( "register.target", _root ); }
+
+ std::string TargetImpl::targetDistributionRelease() const
+ { return rpmdb2solvAttr( "register.release", _root ); }
+
+ std::string TargetImpl::targetDistributionFlavor() const
+ { return rpmdb2solvAttr( "register.flavor", _root ); }
+
+ ///////////////////////////////////////////////////////////////////
+
std::string TargetImpl::anonymousUniqueId() const
{
std::ifstream idfile( ( home() / "AnonymousUniqueId" ).c_str() );
return std::string();
}
+ ///////////////////////////////////////////////////////////////////
+
void TargetImpl::installSrcPackage( const SrcPackage_constPtr & srcPackage_r )
{
// provide on local disk
/** return the last modification date of the target */
Date timestamp() const;
- /** The targets distribution release string.
- * \code
- * openSUSE 10.3 (i586)
- * \endcode
- */
+ /** \copydoc Target::release() */
std::string release() const;
- /** This is "distribution-arch" of the installed base product.
- * Used for registration and \ref Service refresh.
- */
- std::string targetDistribution() const;
+ /** \copydoc Target::targetDistribution() */
+ std::string targetDistribution() const;
+
+ /** \copydoc Target::targetDistributionRelease()*/
+ std::string targetDistributionRelease() const;
+
+ /** \copydoc Target::targetDistributionFlavor() */
+ std::string targetDistributionFlavor() const;
protected:
/** Path to the target */