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.
This commit is contained in:
Christopher Baines 2019-02-10 09:42:22 +00:00
parent 552723cef1
commit c88d8335ba
Signed by: cbaines
GPG key ID: 5E28A33B0B84F577
4 changed files with 346 additions and 44 deletions

View file

@ -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))