From f5adc6c0ee7965abcad4cc73d0f36d1ed3cba3cc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Sep 2015 11:29:50 +0200 Subject: Complete pkg-status, rework object model --- bpkg/package.cxx | 48 +++++++++--------------------------------------- 1 file changed, 9 insertions(+), 39 deletions(-) (limited to 'bpkg/package.cxx') 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 -- cgit v1.1