ref: refs/heads/master
commit 408aa5addf488b2257093912d76e17a2d3b22a92
Author: Michael Andres
Date: Fri Mar 13 13:53:39 2009 +0100
Fix Package::sourcePkgName, add sourcePkgLongName returning "name-version-release.type"
---
zypp/Package.cc | 10 ++++++++--
zypp/Package.h | 14 ++++++++++++++
zypp/SrcPackage.cc | 3 +++
zypp/SrcPackage.h | 3 +++
4 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/zypp/Package.cc b/zypp/Package.cc
index 3263a94..c4cd067 100644
--- a/zypp/Package.cc
+++ b/zypp/Package.cc
@@ -139,9 +139,8 @@ namespace zypp
std::string Package::sourcePkgName() const
{
- // no id means same as package
+ // no id means same as package
sat::detail::IdType id( lookupIdAttribute( sat::SolvAttr::sourcename ) );
- id = lookupIdAttribute(sat::SolvAttr::sourcearch);
return id ? IdString( id ).asString() : name();
}
@@ -152,6 +151,13 @@ namespace zypp
return id ? Edition( id ) : edition();
}
+ std::string Package::sourcePkgType() const
+ { return lookupStrAttribute( sat::SolvAttr::sourcearch ); }
+
+ std::string Package::sourcePkgLongName() const
+ { return str::form( "%s-%s.%s", sourcePkgName().c_str(), sourcePkgEdition().c_str(), sourcePkgType().c_str() ); }
+
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
diff --git a/zypp/Package.h b/zypp/Package.h
index a483101..f952d9d 100644
--- a/zypp/Package.h
+++ b/zypp/Package.h
@@ -23,6 +23,8 @@ namespace zypp
DEFINE_PTR_TYPE(Package);
+
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Package
@@ -88,6 +90,9 @@ namespace zypp
/** \deprecated Use filelist, it's faster and saves memory. */
std::liststd::string filenames() const ZYPP_DEPRECATED;
+ /** \name Source package handling
+ */
+ //@{
/** Name of the source rpm this package was built from.
*/
std::string sourcePkgName() const;
@@ -96,6 +101,15 @@ namespace zypp
*/
Edition sourcePkgEdition() const;
+ /** The type of the source rpm (\c "src" or \c "nosrc").
+ */
+ std::string sourcePkgType() const;
+
+ /** The source rpms \c "name-version-release.type"
+ */
+ std::string sourcePkgLongName() const;
+ //@}
+
/**
* Checksum the source says this package should have.
* \see \ref location
diff --git a/zypp/SrcPackage.cc b/zypp/SrcPackage.cc
index 3474485..dacb48f 100644
--- a/zypp/SrcPackage.cc
+++ b/zypp/SrcPackage.cc
@@ -40,6 +40,9 @@ namespace zypp
//
///////////////////////////////////////////////////////////////////
+ std::string SrcPackage::sourcePkgType() const
+ { return lookupStrAttribute( sat::SolvAttr::arch ); }
+
OnMediaLocation SrcPackage::location() const
{ return lookupLocation(); }
diff --git a/zypp/SrcPackage.h b/zypp/SrcPackage.h
index 2ce1a31..01d8861 100644
--- a/zypp/SrcPackage.h
+++ b/zypp/SrcPackage.h
@@ -36,6 +36,9 @@ namespace zypp
typedef TraitsType::constPtrType constPtr;
public:
+ /** The type of the source rpm ("src" or "nosrc"). */
+ std::string sourcePkgType() const;
+
/** location of resolvable in repo */
OnMediaLocation location() const;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org