aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-25 17:28:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-25 17:28:57 +0200
commit5905fbe8053c5e58e77234dc1f9f81bde6e46b41 (patch)
treefc9e43793ca7d40c65d0bb835326d3995e0dad63 /bpkg/package
parentdb495f3c771ecfe2911d55ba41ab83d22409bcc0 (diff)
Ignore revision for version equality in pkg-{status,build}, constraints
Diffstat (limited to 'bpkg/package')
-rw-r--r--bpkg/package37
1 files changed, 33 insertions, 4 deletions
diff --git a/bpkg/package b/bpkg/package
index e46164c..8bd9546 100644
--- a/bpkg/package
+++ b/bpkg/package
@@ -503,13 +503,34 @@ namespace bpkg
//
template <typename T1, typename T2>
inline auto
+ compare_version_eq (const T1& x, const T2& y, bool revision)
+ -> decltype (x.epoch == y.epoch)
+ {
+ // Since we don't quite know what T1 and T2 are (and where the resulting
+ // expression will run), let's not push our luck with something like
+ // (revision || x.revision == y.revision).
+ //
+ if (revision)
+ return x.epoch == y.epoch &&
+ x.canonical_upstream == y.canonical_upstream &&
+ x.canonical_release == y.canonical_release &&
+ x.revision == y.revision;
+ else
+ return x.epoch == y.epoch &&
+ x.canonical_upstream == y.canonical_upstream &&
+ x.canonical_release == y.canonical_release;
+ }
+
+ /*
+ Currently unused (and probably should stay that way).
+
+ template <typename T1, typename T2>
+ inline auto
operator== (const T1& x, const T2& y) -> decltype (x.epoch == y.epoch)
{
- return x.epoch == y.epoch &&
- x.canonical_upstream == y.canonical_upstream &&
- x.canonical_release == y.canonical_release &&
- x.revision == y.revision;
+ return compare_version_eq (x, y, true);
}
+ */
template <typename T1, typename T2>
inline auto
@@ -580,6 +601,14 @@ namespace bpkg
+ x.canonical_release + "DESC,"
+ x.revision + "DESC";
}
+
+ template <typename T>
+ inline auto
+ order_by_revision_desc (const T& x) -> //decltype ("ORDER BY" + x.epoch)
+ decltype (x.revision == 0)
+ {
+ return "ORDER BY" + x.revision + "DESC";
+ }
}
#include <bpkg/package.ixx>