guix package: Register non-default profiles as GC roots.
* guix/scripts/package.scm (maybe-register-gc-root): New procedure. * tests/guix-package.sh (profile): Grep the output of "guix gc --list-live" in a couple of places.
This commit is contained in:
		
							parent
							
								
									0d55c3563c
								
							
						
					
					
						commit
						d2952326ae
					
				
					 2 changed files with 13 additions and 0 deletions
				
			
		|  | @ -723,6 +723,11 @@ removed from MANIFEST." | ||||||
|                (_ #f)) |                (_ #f)) | ||||||
|               options)) |               options)) | ||||||
| 
 | 
 | ||||||
|  | (define (maybe-register-gc-root store profile) | ||||||
|  |   "Register PROFILE as a GC root, unless it doesn't need it." | ||||||
|  |   (unless (string=? profile %current-profile) | ||||||
|  |     (add-indirect-root store (canonicalize-path profile)))) | ||||||
|  | 
 | ||||||
|  |  | ||||||
| ;;; | ;;; | ||||||
| ;;; Entry point. | ;;; Entry point. | ||||||
|  | @ -915,6 +920,7 @@ more information.~%")) | ||||||
|                               (let ((count (length entries))) |                               (let ((count (length entries))) | ||||||
|                                 (switch-symlinks name prof) |                                 (switch-symlinks name prof) | ||||||
|                                 (switch-symlinks profile name) |                                 (switch-symlinks profile name) | ||||||
|  |                                 (maybe-register-gc-root (%store) profile) | ||||||
|                                 (format #t (N_ "~a package in profile~%" |                                 (format #t (N_ "~a package in profile~%" | ||||||
|                                                "~a packages in profile~%" |                                                "~a packages in profile~%" | ||||||
|                                                count) |                                                count) | ||||||
|  |  | ||||||
|  | @ -41,6 +41,9 @@ guix package --bootstrap -p "$profile" -i guile-bootstrap | ||||||
| test -L "$profile" && test -L "$profile-1-link" | test -L "$profile" && test -L "$profile-1-link" | ||||||
| test -f "$profile/bin/guile" | test -f "$profile/bin/guile" | ||||||
| 
 | 
 | ||||||
|  | # Make sure the profile is a GC root. | ||||||
|  | guix gc --list-live | grep "`readlink "$profile-1-link"`" | ||||||
|  | 
 | ||||||
| # Installing the same package a second time does nothing. | # Installing the same package a second time does nothing. | ||||||
| guix package --bootstrap -p "$profile" -i guile-bootstrap | guix package --bootstrap -p "$profile" -i guile-bootstrap | ||||||
| test -L "$profile" && test -L "$profile-1-link" | test -L "$profile" && test -L "$profile-1-link" | ||||||
|  | @ -209,6 +212,10 @@ fi | ||||||
| default_profile="`readlink "$HOME/.guix-profile"`" | default_profile="`readlink "$HOME/.guix-profile"`" | ||||||
| for i in `seq 1 3` | for i in `seq 1 3` | ||||||
| do | do | ||||||
|  |     # Make sure the current generation is a GC root. | ||||||
|  |     profile_link="`readlink "$default_profile"`" | ||||||
|  |     guix gc --list-live | grep "`readlink "$profile_link"`" | ||||||
|  | 
 | ||||||
|     guix package --bootstrap --roll-back |     guix package --bootstrap --roll-back | ||||||
|     ! test -f "$HOME/.guix-profile/bin" |     ! test -f "$HOME/.guix-profile/bin" | ||||||
|     ! test -f "$HOME/.guix-profile/lib" |     ! test -f "$HOME/.guix-profile/lib" | ||||||
|  |  | ||||||
		Reference in a new issue