guix package: "guix package -f FILE" ensures FILE returns a package.
* guix/scripts/package.scm (options->installable): Add clause for 'install option with a non-package object. * tests/guix-package.sh: Add test.
This commit is contained in:
		
							parent
							
								
									cf48ea9539
								
							
						
					
					
						commit
						f9c0400392
					
				
					 2 changed files with 16 additions and 1 deletions
				
			
		|  | @ -607,7 +607,11 @@ and upgrades." | |||
|                        (let-values (((package output) | ||||
|                                      (specification->package+output spec))) | ||||
|                          (package->manifest-entry* package output)))) | ||||
|                   (_ #f)) | ||||
|                   (('install . obj) | ||||
|                    (leave (G_ "cannot install non-package object: ~s~%") | ||||
|                           obj)) | ||||
|                   (_ | ||||
|                    #f)) | ||||
|                 opts)) | ||||
| 
 | ||||
|   (fold manifest-transaction-install-entry | ||||
|  |  | |||
|  | @ -331,6 +331,17 @@ cat > "$module_dir/package.scm"<<EOF | |||
| EOF | ||||
| guix package --bootstrap --install-from-file="$module_dir/package.scm" | ||||
| 
 | ||||
| # Make sure an error is raised if the file doesn't return a package. | ||||
| cat > "$module_dir/package.scm"<<EOF | ||||
| (use-modules (gnu packages base)) | ||||
| 
 | ||||
| (define my-package coreutils)   ;returns *unspecified* | ||||
| EOF | ||||
| if guix package --bootstrap --install-from-file="$module_dir/package.scm" | ||||
| then false; else true; fi | ||||
| 
 | ||||
| rm "$module_dir/package.scm" | ||||
| 
 | ||||
| # This one should not show up in searches since it's no supported on the | ||||
| # current system. | ||||
| test "`guix package -A super-non-portable-emacs`" = "" | ||||
|  |  | |||
		Reference in a new issue