Use the line numbers to make the package deduplication more stable

Previously this would just compare on the version if the name was the same,
but there are package definitions that share the name and version (itstool is
one example).

To try and make this more stable, to avoid weird errors, and unstable
comparisons between revisions, use the line number when deduplicating
packages.
This commit is contained in:
Christopher Baines 2020-01-21 23:55:36 +00:00
parent a66cbd41f9
commit 1ab6ecd64f

View file

@ -499,8 +499,18 @@ WHERE job_id = $1"
(let ((a-name (inferior-package-name a))
(b-name (inferior-package-name b)))
(if (string=? a-name b-name)
(let ((a-version (inferior-package-version a))
(b-version (inferior-package-version b)))
(if (string=? a-version b-version)
;; The name and version are the same, so try and pick
;; the same package each time, by looking at the
;; location.
(let ((a-location (inferior-package-location a))
(b-location (inferior-package-location b)))
(< (location-line a-location)
(location-line b-location)))
(string<? (inferior-package-version a)
(inferior-package-version b))
(inferior-package-version b))))
(string<? a-name
b-name)))))))