From ef8993e2dc90fd5d63d016fc45912ad451bf787c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 2 Sep 2014 21:12:59 +0200 Subject: profiles: Report the old and new version number in upgrades. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/profiles.scm (manifest-lookup): New procedure. (manifest-installed?): Use it. (manifest-transaction-effects): Return a pair of entries for upgrades. (right-arrow): New procedure. (manifest-show-transaction)[upgrade-string, →]: New variables. Report upgrades using 'upgrade-string'. * tests/profiles.scm ("manifest-show-transaction"): New test. ("manifest-transaction-effects"): Match UPGRADE against a pair. --- tests/profiles.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/profiles.scm b/tests/profiles.scm index d88def32fd..879f71073f 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -26,6 +26,7 @@ (define-module (test-profiles) #:use-module (guix derivations) #:use-module (gnu packages bootstrap) #:use-module (ice-9 match) + #:use-module (ice-9 regex) #:use-module (srfi srfi-11) #:use-module (srfi srfi-64)) @@ -153,7 +154,24 @@ (define glibc (manifest-transaction-effects m0 t))) (and (null? remove) (equal? (list glibc) install) - (equal? (list guile-2.0.9) upgrade))))) + (equal? (list (cons guile-1.8.8 guile-2.0.9)) upgrade))))) + +(test-assert "manifest-show-transaction" + (let* ((m (manifest (list guile-1.8.8))) + (t (manifest-transaction (install (list guile-2.0.9))))) + (let-values (((remove install upgrade) + (manifest-transaction-effects m t))) + (with-store store + (and (string-match "guile\t1.8.8 → 2.0.9" + (with-fluids ((%default-port-encoding "UTF-8")) + (with-error-to-string + (lambda () + (manifest-show-transaction store m t))))) + (string-match "guile\t1.8.8 > 2.0.9" + (with-fluids ((%default-port-encoding "ISO-8859-1")) + (with-error-to-string + (lambda () + (manifest-show-transaction store m t)))))))))) (test-assert "profile-derivation" (run-with-store %store -- cgit v1.2.3