aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-10-25 18:14:35 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-11-02 14:04:09 +0300
commitad53b2152e10b133165c95f08f218e80f1dd8580 (patch)
tree2f2a0a09d776767ad302663fb5496a093d318854 /bpkg/package.cxx
parentb28f172537ae14d0fd386de63f7b62bfa6612d3a (diff)
Improve pkg-build's 'unable to upgrade package' diagnostics
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r--bpkg/package.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx
index aca3550..4beba8e 100644
--- a/bpkg/package.cxx
+++ b/bpkg/package.cxx
@@ -70,6 +70,39 @@ namespace bpkg
return r != 0 ? (r < 0) : (db < v.db);
}
+ // package_version_key
+ //
+ string package_version_key::
+ string (bool ignore_version) const
+ {
+ std::string r (name.string ());
+
+ if (version && !version->empty () && !ignore_version)
+ {
+ r += '/';
+ r += version->string ();
+ }
+
+ const std::string& d (db.get ().string);
+
+ if (!d.empty ())
+ {
+ r += ' ';
+ r += d;
+ }
+
+ return r;
+ }
+
+ bool package_version_key::
+ operator< (const package_version_key& v) const
+ {
+ if (int r = name.compare (v.name))
+ return r < 0;
+
+ return version != v.version ? (version < v.version) : (db < v.db);
+ }
+
// available_package
//
const version* available_package::