diff options
author | Christopher Baines <mail@cbaines.net> | 2020-01-21 23:55:36 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-01-21 23:55:36 +0000 |
commit | 1ab6ecd64f29562fb2186ef46f97dc36e824d4cc (patch) | |
tree | 88bd64bfeab0b3b2bcdbce3d163870b4cfb0e716 | |
parent | a66cbd41f97e58d3ea0e75cd02cf07a1f11d2d9f (diff) | |
download | data-service-1ab6ecd64f29562fb2186ef46f97dc36e824d4cc.tar data-service-1ab6ecd64f29562fb2186ef46f97dc36e824d4cc.tar.gz |
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.
-rw-r--r-- | guix-data-service/jobs/load-new-guix-revision.scm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index e685615..86911df 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -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) - (string<? (inferior-package-version a) - (inferior-package-version b)) + (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)))) (string<? a-name b-name))))))) |