diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-29 11:29:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-29 11:29:50 +0200 |
commit | f5adc6c0ee7965abcad4cc73d0f36d1ed3cba3cc (patch) | |
tree | 209d8b593efc5cf525ae96f6bf69b356cdba9766 /bpkg/package.cxx | |
parent | bbc1acd6e9e086c5bcfccac971c8ca4edd192765 (diff) |
Complete pkg-status, rework object model
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r-- | bpkg/package.cxx | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx index 1862fe4..ad54e51 100644 --- a/bpkg/package.cxx +++ b/bpkg/package.cxx @@ -10,58 +10,28 @@ using namespace std; namespace bpkg { - // repository - // - repository::_id_type repository:: - _id () const - { - return _id_type {location.canonical_name (), location.string ()}; - } - - void repository:: - _id (_id_type&& l) - { - location = repository_location (move (l.location)); - assert (location.canonical_name () == l.name); - } - - // package_version_id + // available_package_id // bool - operator< (const package_version_id& x, const package_version_id& y) + operator< (const available_package_id& x, const available_package_id& y) { int r (x.name.compare (y.name)); if (r != 0) return r < 0; - if (x.epoch != y.epoch) - return x.epoch < y.epoch; + const auto& xv (x.version); + const auto& yv (y.version); + + if (xv.epoch != yv.epoch) + return xv.epoch < yv.epoch; - r = x.upstream.compare (y.upstream); + r = xv.canonical_upstream.compare (yv.canonical_upstream); if (r != 0) return r < 0; - return x.revision < y.revision; - } - - // available_package - // - available_package::_id_type available_package:: - _id () const - { - return _id_type {package_version_id (name, version), version.upstream ()}; - } - - void available_package:: - _id (_id_type&& v) - { - name = move (v.data.name); - version = version_type (v.data.epoch, - move (v.version_original_upstream), - v.data.revision); - assert (version.canonical_upstream () == v.data.upstream); + return xv.revision < yv.revision; } // state |