diff options
author | Christopher Baines <mail@cbaines.net> | 2019-02-10 09:42:22 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-02-10 09:42:22 +0000 |
commit | c88d8335babf437bec3961b24d5aa92c82a59d27 (patch) | |
tree | 2f69e46c93bd30a768aa85e331a2a81936940c50 /guix-data-service/comparison.scm | |
parent | 552723cef15285d36f1ca8ae87d8672a093522d2 (diff) | |
download | data-service-c88d8335babf437bec3961b24d5aa92c82a59d27.tar data-service-c88d8335babf437bec3961b24d5aa92c82a59d27.tar.gz |
Improve the model for derivations
These changes mean that more information about derivations is
recorded. There are a number of corresponding changes in the database
schema that are not tracked in the repository unfortunately.
Diffstat (limited to 'guix-data-service/comparison.scm')
-rw-r--r-- | guix-data-service/comparison.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/guix-data-service/comparison.scm b/guix-data-service/comparison.scm index 4dfd96e..bd09d49 100644 --- a/guix-data-service/comparison.scm +++ b/guix-data-service/comparison.scm @@ -4,8 +4,10 @@ #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:use-module (squee) + #:use-module (guix-data-service model derivation) #:export (package-data->package-data-vhashes package-differences-data + package-data-vhashes->derivations package-data-vhashes->new-packages package-data-vhashes->removed-packages package-data-version-changes @@ -45,6 +47,24 @@ ORDER BY base_packages.name, base_packages.version, target_packages.name, target (list vlist-null vlist-null) package-data))) +(define (package-data-vhashes->derivations conn + base-packages-vhash + target-packages-vhash) + (define (vhash->derivation-ids vhash) + (vhash-fold (lambda (key value result) + (cons (third value) + result)) + '() + vhash)) + + (let* ((derivation-ids + (delete-duplicates + (append (vhash->derivation-ids base-packages-vhash) + (vhash->derivation-ids target-packages-vhash)))) + (derivation-data + (select-derivations-by-id conn derivation-ids))) + derivation-data)) + (define (package-data-vhash->package-name-and-version-vhash vhash) (vhash-fold (lambda (name details result) (vhash-cons (cons name (first details)) |