ref: refs/heads/master
commit 9c862b0dba932136e3b782bc116da1369bf0e93e
Author: Michael Andres
Date: Tue Jul 14 18:20:45 2009 +0200
Support "product version" detection on systems not using /etc/product.d/baseproduct.
On RHEL, Fedora and others the "product version" is determined by the first package
providing 'redhat-release'. This value is not hardcoded in YUM and can be configured
with the $distroverpkg variable. We use ZConfig::distroverpkg for this.
---
VERSION.cmake | 4 ++--
package/libzypp.changes | 8 ++++++++
zypp/ZConfig.cc | 5 +++++
zypp/ZConfig.h | 11 +++++++++++
zypp/target/TargetImpl.cc | 15 ++++++++++++++-
5 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/VERSION.cmake b/VERSION.cmake
index 22ed556..b290553 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -61,8 +61,8 @@
SET(LIBZYPP_MAJOR "6")
SET(LIBZYPP_COMPATMINOR "10")
SET(LIBZYPP_MINOR "10")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_PATCH "2")
#
-# LAST RELEASED: 6.10.1 (10)
+# LAST RELEASED: 6.10.2 (10)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
diff --git a/package/libzypp.changes b/package/libzypp.changes
index 4a96a42..aa6508e 100644
--- a/package/libzypp.changes
+++ b/package/libzypp.changes
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Tue Jul 14 18:15:51 CEST 2009 - ma@suse.de
+
+- Support "product version" detection on systems not using
+ /etc/product.d/baseproduct by looking for the first package
+ providing ZConfig::distroverpkg (defaults to redhat-release).
+- version 6.10.2 (10)
+
+-------------------------------------------------------------------
Fri Jul 10 15:21:39 CEST 2009 - ma@suse.de
- Adapt to boost_unit_test_framework-1.38.
diff --git a/zypp/ZConfig.cc b/zypp/ZConfig.cc
index 8002447..738cc71 100644
--- a/zypp/ZConfig.cc
+++ b/zypp/ZConfig.cc
@@ -706,6 +706,11 @@ namespace zypp
///////////////////////////////////////////////////////////////////
+ std::string ZConfig::distroverpkg() const
+ { return "redhat-release"; }
+
+ ///////////////////////////////////////////////////////////////////
+
std::ostream & ZConfig::about( std::ostream & str ) const
{
str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
diff --git a/zypp/ZConfig.h b/zypp/ZConfig.h
index 02d3726..6de0e12 100644
--- a/zypp/ZConfig.h
+++ b/zypp/ZConfig.h
@@ -291,6 +291,17 @@ namespace zypp
*/
Pathname credentialsGlobalFile() const;
+
+ /** Package telling the "product version" on systems not using /etc/product.d/baseproduct.
+ *
+ * On RHEL, Fedora and others the "product version" is determined by the first package
+ * providing 'redhat-release'. This value is not hardcoded in YUM and can be configured
+ * with the $distroverpkg variable.
+ *
+ * Defaults to 'redhat-release'.
+ */
+ std::string distroverpkg() const;
+
public:
class Impl;
/** Dtor */
diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc
index ed1a7ca..c03a773 100644
--- a/zypp/target/TargetImpl.cc
+++ b/zypp/target/TargetImpl.cc
@@ -1101,7 +1101,20 @@ namespace zypp
{
if ( _distributionVersion.empty() )
{
- _distributionVersion = baseproductdata( _root ).edition().version();
+ // By default ZYpp looks for /etc/product.d/baseproduct..
+ //_distributionVersion = baseproductdata( _root ).edition().version();
+
+ if ( _distributionVersion.empty() )
+ {
+ // ...But the baseproduct method is not expected to work on RedHat derivatives.
+ // On RHEL, Fedora and others the "product version" is determined by the first package
+ // providing 'redhat-release'. This value is not hardcoded in YUM and can be configured
+ // with the $distroverpkg variable.
+ rpm::librpmDb::db_const_iterator it;
+ if ( it.findByProvides( ZConfig::instance().distroverpkg() ) )
+ _distributionVersion = it->tag_version();
+ }
+
if ( !_distributionVersion.empty() )
MIL << "Remember distributionVersion = '" << _distributionVersion << "'" << endl;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org