[PATCH setup 1/2] Add Vendor() accessor method to SolvableVersion
Jon Turney
jon.turney@dronecode.org.uk
Mon Jul 9 18:19:00 GMT 2018
---
libsolv.cc | 17 +++++++++++++++++
libsolv.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/libsolv.cc b/libsolv.cc
index 63942b2..955a1b2 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -209,6 +209,23 @@ SolvableVersion::sourcePackageName () const
return std::string(pool_id2str(pool, spkg));
}
+const std::string
+SolvableVersion::Vendor () const
+{
+ if (!id)
+ return "";
+
+ // extract vendor
+ Solvable *solvable = pool_id2solvable(pool, id);
+ Id vendor = repo_lookup_id(solvable->repo, id, SOLVABLE_VENDOR);
+
+ // has no such attribute
+ if (!vendor)
+ return "";
+
+ return std::string(pool_id2str(pool, vendor));
+}
+
SolvableVersion
SolvableVersion::sourcePackage () const
{
diff --git a/libsolv.h b/libsolv.h
index c218ab8..f394e65 100644
--- a/libsolv.h
+++ b/libsolv.h
@@ -73,6 +73,7 @@ class SolvableVersion
SolvableVersion sourcePackage () const;
// where this package archive can be obtained from
packagesource *source() const;
+ const std::string Vendor () const;
// fixup spkg_id
void fixup_spkg_id(SolvableVersion spkg_id) const;
--
2.17.0
More information about the Cygwin-apps
mailing list