profiles: Add 'manifest-transaction-removal-candidate?'.
* guix/profiles.scm (manifest-transaction-removal-candidate?): New procedure. * tests/profiles.scm ("manifest-transaction-removal-candidate?"): New test.
This commit is contained in:
parent
94a400beba
commit
6d382339de
|
@ -96,6 +96,7 @@
|
||||||
manifest-transaction-install-entry
|
manifest-transaction-install-entry
|
||||||
manifest-transaction-remove-pattern
|
manifest-transaction-remove-pattern
|
||||||
manifest-transaction-null?
|
manifest-transaction-null?
|
||||||
|
manifest-transaction-removal-candidate?
|
||||||
manifest-perform-transaction
|
manifest-perform-transaction
|
||||||
manifest-transaction-effects
|
manifest-transaction-effects
|
||||||
|
|
||||||
|
@ -564,6 +565,12 @@ remove software."
|
||||||
(($ <manifest-transaction> () ()) #t)
|
(($ <manifest-transaction> () ()) #t)
|
||||||
(($ <manifest-transaction> _ _) #f)))
|
(($ <manifest-transaction> _ _) #f)))
|
||||||
|
|
||||||
|
(define (manifest-transaction-removal-candidate? entry transaction)
|
||||||
|
"Return true if ENTRY is a candidate for removal in TRANSACTION."
|
||||||
|
(any (lambda (pattern)
|
||||||
|
((entry-predicate pattern) entry))
|
||||||
|
(manifest-transaction-remove transaction)))
|
||||||
|
|
||||||
(define (manifest-transaction-effects manifest transaction)
|
(define (manifest-transaction-effects manifest transaction)
|
||||||
"Compute the effect of applying TRANSACTION to MANIFEST. Return 4 values:
|
"Compute the effect of applying TRANSACTION to MANIFEST. Return 4 values:
|
||||||
the list of packages that would be removed, installed, upgraded, or downgraded
|
the list of packages that would be removed, installed, upgraded, or downgraded
|
||||||
|
|
|
@ -197,6 +197,13 @@
|
||||||
(test-assert "manifest-transaction-null?"
|
(test-assert "manifest-transaction-null?"
|
||||||
(manifest-transaction-null? (manifest-transaction)))
|
(manifest-transaction-null? (manifest-transaction)))
|
||||||
|
|
||||||
|
(test-assert "manifest-transaction-removal-candidate?"
|
||||||
|
(let ((m (manifest (list guile-2.0.9)))
|
||||||
|
(t (manifest-transaction
|
||||||
|
(remove (list (manifest-pattern (name "guile")))))))
|
||||||
|
(and (manifest-transaction-removal-candidate? guile-2.0.9 t)
|
||||||
|
(not (manifest-transaction-removal-candidate? glibc t)))))
|
||||||
|
|
||||||
(test-assertm "profile-derivation"
|
(test-assertm "profile-derivation"
|
||||||
(mlet* %store-monad
|
(mlet* %store-monad
|
||||||
((entry -> (package->manifest-entry %bootstrap-guile))
|
((entry -> (package->manifest-entry %bootstrap-guile))
|
||||||
|
|
Loading…
Reference in New Issue