aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-01-18 14:38:33 +0000
committerChristopher Baines <mail@cbaines.net>2024-01-18 14:41:32 +0000
commit15b6dad5a56a48f81d2a0bb45de9224c5e8ed805 (patch)
treef1fcc449218cac6d704b5dd733a3204eea5a590f
parent45d9b1ad7cb9ecacd754cc3957c7280b299596e7 (diff)
downloaddata-service-15b6dad5a56a48f81d2a0bb45de9224c5e8ed805.tar
data-service-15b6dad5a56a48f81d2a0bb45de9224c5e8ed805.tar.gz
Have delete-duplicates/sort! take a equality procedure
And change the default, as eq? doesn't always work.
-rw-r--r--guix-data-service/model/derivation.scm3
-rw-r--r--guix-data-service/utils.scm4
-rw-r--r--guix-data-service/web/compare/html.scm2
3 files changed, 5 insertions, 4 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm
index d95e285..c516e58 100644
--- a/guix-data-service/model/derivation.scm
+++ b/guix-data-service/model/derivation.scm
@@ -1840,7 +1840,8 @@ WHERE derivation_inputs.derivation_id IN ("
(length ids-chunk))
(exec-query conn query)))))
(chunk! ids 500))
- <))
+ <
+ =))
(define (derivation-ids->missing-sources ids)
(define query
diff --git a/guix-data-service/utils.scm b/guix-data-service/utils.scm
index 7357a40..c91b10b 100644
--- a/guix-data-service/utils.scm
+++ b/guix-data-service/utils.scm
@@ -417,7 +417,7 @@ available. Return the resource once PROC has returned."
#t)
-(define (delete-duplicates/sort! unsorted-lst less)
+(define* (delete-duplicates/sort! unsorted-lst less #:optional (equal? equal?))
(if (null? unsorted-lst)
unsorted-lst
(let ((sorted-lst (sort! unsorted-lst less)))
@@ -428,7 +428,7 @@ available. Return the resource once PROC has returned."
(if (null? lst)
result
(let ((current-element (car lst)))
- (if (eq? current-element last-element)
+ (if (equal? current-element last-element)
(loop (cdr lst)
last-element
result)
diff --git a/guix-data-service/web/compare/html.scm b/guix-data-service/web/compare/html.scm
index 6979e42..5b624d1 100644
--- a/guix-data-service/web/compare/html.scm
+++ b/guix-data-service/web/compare/html.scm
@@ -865,7 +865,7 @@ enough builds to determine a change")))
((names . new-drvs-count)
(let ((distinct-packages
(length
- (delete-duplicates/sort! names string<?))))
+ (delete-duplicates/sort! names string<? string=?))))
`((p
,(simple-format #f "Showing ~A new derivations across ~A packages"
new-drvs-count