diff options
author | Alex Kost <alezost@gmail.com> | 2014-08-12 12:32:16 +0400 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-08-12 16:03:33 +0200 |
commit | f755403014e70d875541bcce5474d2cf410b5da1 (patch) | |
tree | 635b9324e483daa472ed04eb943fd00422444837 /guix | |
parent | 599f146400ea687dfda590babc9992ca8f86a482 (diff) | |
download | gnu-guix-f755403014e70d875541bcce5474d2cf410b5da1.tar gnu-guix-f755403014e70d875541bcce5474d2cf410b5da1.tar.gz |
profiles: Add 'manifest-add'.
* guix/profiles.scm (manifest-add): New procedure.
* tests/profiles.scm (guile-1.8.8): New variable.
("manifest-add"): New test.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix')
-rw-r--r-- | guix/profiles.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm index 5e69e012f9..c7aec7909b 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -47,6 +47,7 @@ manifest-pattern? manifest-remove + manifest-add manifest-installed? manifest-matching-entries @@ -196,6 +197,25 @@ must be a manifest-pattern." (manifest-entries manifest) patterns))) +(define (manifest-add manifest entries) + "Add a list of manifest ENTRIES to MANIFEST and return new manifest. +Remove MANIFEST entries that have the same name and output as ENTRIES." + (define (same-entry? entry name output) + (match entry + (($ <manifest-entry> entry-name _ entry-output _ ...) + (and (equal? name entry-name) + (equal? output entry-output))))) + + (make-manifest + (append entries + (fold (lambda (entry result) + (match entry + (($ <manifest-entry> name _ out _ ...) + (filter (negate (cut same-entry? <> name out)) + result)))) + (manifest-entries manifest) + entries)))) + (define (manifest-installed? manifest pattern) "Return #t if MANIFEST has an entry matching PATTERN (a manifest-pattern), #f otherwise." |