* [PATCH 0/2] environment: Add --inclusive option. @ 2015-03-19 0:08 David Thompson 2015-03-19 0:11 ` [PATCH 1/2] packages: Expose transitive-inputs David Thompson 2015-03-19 0:11 ` [PATCH 2/2] environment: Add --inclusive option David Thompson 0 siblings, 2 replies; 6+ messages in thread From: David Thompson @ 2015-03-19 0:08 UTC (permalink / raw) To: guix-devel This patch set adds a new option to 'guix environment', --inclusive. When this option is used, the resulting environment includes all of the input packages in addition to their transitive inputs. This is useful for building environments with arbitrary inputs that have no pre-defined package object to contain them. I was just wishing for this feature when demonstrating how to reproduce a problem with our SDL package. TIA for review. I hope I've convinced you all of its usefulness. :) -- David Thompson Web Developer - Free Software Foundation - http://fsf.org GPG Key: 0FF1D807 Support the FSF: https://fsf.org/donate ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] packages: Expose transitive-inputs. 2015-03-19 0:08 [PATCH 0/2] environment: Add --inclusive option David Thompson @ 2015-03-19 0:11 ` David Thompson 2015-03-19 10:34 ` David Thompson 2015-03-19 0:11 ` [PATCH 2/2] environment: Add --inclusive option David Thompson 1 sibling, 1 reply; 6+ messages in thread From: David Thompson @ 2015-03-19 0:11 UTC (permalink / raw) To: guix-devel [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: 0001-packages-Expose-transitive-inputs.patch --] [-- Type: text/x-diff, Size: 1134 bytes --] From 14bc819b7d999fd1b3806918987c0e1ab5db742b Mon Sep 17 00:00:00 2001 From: David Thompson <dthompson2@worcester.edu> Date: Wed, 18 Mar 2015 19:53:22 -0400 Subject: [PATCH 1/2] packages: Expose transitive-inputs. * guix/packages.scm (transitive-inputs): Add docstring. Export. --- guix/packages.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/guix/packages.scm b/guix/packages.scm index ec0e79d..577148a 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -81,6 +81,7 @@ package-location package-field-location + transitive-inputs package-direct-inputs package-transitive-inputs package-transitive-target-inputs @@ -509,6 +510,8 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET." #:guile-for-build guile-for-build))) (define (transitive-inputs inputs) + "Return the transitive inputs of each package in INPUTS---i.e., its direct +inputs along with their propagated inputs, recursively.." (let loop ((inputs inputs) (result '())) (match inputs -- 2.1.4 [-- Attachment #2: Type: text/plain, Size: 136 bytes --] -- David Thompson Web Developer - Free Software Foundation - http://fsf.org GPG Key: 0FF1D807 Support the FSF: https://fsf.org/donate ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] packages: Expose transitive-inputs. 2015-03-19 0:11 ` [PATCH 1/2] packages: Expose transitive-inputs David Thompson @ 2015-03-19 10:34 ` David Thompson 0 siblings, 0 replies; 6+ messages in thread From: David Thompson @ 2015-03-19 10:34 UTC (permalink / raw) To: guix-devel David Thompson <dthompson2@worcester.edu> writes: > From 14bc819b7d999fd1b3806918987c0e1ab5db742b Mon Sep 17 00:00:00 2001 > From: David Thompson <dthompson2@worcester.edu> > Date: Wed, 18 Mar 2015 19:53:22 -0400 > Subject: [PATCH 1/2] packages: Expose transitive-inputs. > > * guix/packages.scm (transitive-inputs): Add docstring. Export. Ugh, sorry. Ignore this. I made this patch while I was experimenting, but as you can see from patch #2, this procedure isn't used at all. -- David Thompson Web Developer - Free Software Foundation - http://fsf.org GPG Key: 0FF1D807 Support the FSF: https://fsf.org/donate ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] environment: Add --inclusive option. 2015-03-19 0:08 [PATCH 0/2] environment: Add --inclusive option David Thompson 2015-03-19 0:11 ` [PATCH 1/2] packages: Expose transitive-inputs David Thompson @ 2015-03-19 0:11 ` David Thompson 2015-03-20 0:55 ` David Thompson 2015-03-20 19:20 ` Ludovic Courtès 1 sibling, 2 replies; 6+ messages in thread From: David Thompson @ 2015-03-19 0:11 UTC (permalink / raw) To: guix-devel [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: 0002-environment-Add-inclusive-option.patch --] [-- Type: text/x-diff, Size: 4175 bytes --] From 3d97dbcf1907a67ed25fd90c09eb88d1b136d31a Mon Sep 17 00:00:00 2001 From: David Thompson <dthompson2@worcester.edu> Date: Wed, 18 Mar 2015 20:01:12 -0400 Subject: [PATCH 2/2] environment: Add --inclusive option. * guix/scripts/environment.scm (show-help): Add help. (%default-options): Add 'inclusive?'. (%options): Add 'inclusive' option. (packages->transitive-inputs): Add 'inclusive?' argument. (guix-environment): Use 'inclusive' option. --- doc/guix.texi | 6 ++++++ guix/scripts/environment.scm | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ae2f786..d552faf 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3366,6 +3366,12 @@ evaluates to. @item -E @var{command} Execute @var{command} in the new environment. +@item --inclusive +@item -i +Include @var{packages}@dots{} in the new environment in addition to +their inputs. Useful for creating an environment from arbitrary +packages without building another package object to house them. + @item --pure Unset existing environment variables when building the new environment. This has the effect of creating an environment in which search paths diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 80ae924..9788496 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -103,6 +103,8 @@ shell command in that environment.\n")) (display (_ " -E, --exec=COMMAND execute COMMAND in new environment")) (display (_ " + -i, --inclusive include PACKAGE... in new environment")) + (display (_ " --pure unset existing environment variables")) (display (_ " --search-paths display needed environment variable definitions")) @@ -119,6 +121,7 @@ shell command in that environment.\n")) (define %default-options ;; Default to opening a new shell. `((exec . ,(or (getenv "SHELL") "/bin/sh")) + (inclusive? . #f) (substitutes? . #t) (max-silent-time . 3600) (verbosity . 0))) @@ -147,6 +150,9 @@ shell command in that environment.\n")) (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) + (option '(#\i "inclusive") #f #f + (lambda (opt name arg result) + (alist-cons 'inclusive? #t result))) (option '(#\n "dry-run") #f #f (lambda (opt name arg result) (alist-cons 'dry-run? #t result))) @@ -178,8 +184,9 @@ packages." (opt opt)) opts)) -(define (packages->transitive-inputs packages) - "Return a list of the transitive inputs for all PACKAGES." +(define (packages->transitive-inputs packages inclusive?) + "Return a list of the transitive inputs for all PACKAGES. If INCLUSIVE?, +include PACKAGES in the result." (define (transitive-inputs package) (filter-map (match-lambda ((or (_ (? package? package)) @@ -188,8 +195,10 @@ packages." (_ #f)) (bag-transitive-inputs (package->bag package)))) + (delete-duplicates - (append-map transitive-inputs packages))) + (append (if inclusive? packages '()) + (append-map transitive-inputs packages)))) ;; TODO: Deduplicate these. (define show-what-to-build* @@ -225,9 +234,10 @@ packages." (let* ((opts (parse-command-line args %options (list %default-options) #:argument-handler handle-argument)) (pure? (assoc-ref opts 'pure)) + (inclusive? (assoc-ref opts 'inclusive?)) (command (assoc-ref opts 'exec)) - (inputs (packages->transitive-inputs - (pick-all (options/resolve-packages opts) 'package))) + (packages (pick-all (options/resolve-packages opts) 'package)) + (inputs (packages->transitive-inputs packages inclusive?)) (drvs (run-with-store store (mbegin %store-monad (set-guile-for-build (default-guile)) -- 2.1.4 [-- Attachment #2: Type: text/plain, Size: 136 bytes --] -- David Thompson Web Developer - Free Software Foundation - http://fsf.org GPG Key: 0FF1D807 Support the FSF: https://fsf.org/donate ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] environment: Add --inclusive option. 2015-03-19 0:11 ` [PATCH 2/2] environment: Add --inclusive option David Thompson @ 2015-03-20 0:55 ` David Thompson 2015-03-20 19:20 ` Ludovic Courtès 1 sibling, 0 replies; 6+ messages in thread From: David Thompson @ 2015-03-20 0:55 UTC (permalink / raw) To: guix-devel David Thompson <dthompson2@worcester.edu> writes: > From 3d97dbcf1907a67ed25fd90c09eb88d1b136d31a Mon Sep 17 00:00:00 2001 > From: David Thompson <dthompson2@worcester.edu> > Date: Wed, 18 Mar 2015 20:01:12 -0400 > Subject: [PATCH 2/2] environment: Add --inclusive option. To clarify: Despite saying this is patch 2/2, this is only patch that I would want to apply, discarding the first one. -- David Thompson Web Developer - Free Software Foundation - http://fsf.org GPG Key: 0FF1D807 Support the FSF: https://fsf.org/donate ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] environment: Add --inclusive option. 2015-03-19 0:11 ` [PATCH 2/2] environment: Add --inclusive option David Thompson 2015-03-20 0:55 ` David Thompson @ 2015-03-20 19:20 ` Ludovic Courtès 1 sibling, 0 replies; 6+ messages in thread From: Ludovic Courtès @ 2015-03-20 19:20 UTC (permalink / raw) To: David Thompson; +Cc: guix-devel David Thompson <dthompson2@worcester.edu> skribis: > From 3d97dbcf1907a67ed25fd90c09eb88d1b136d31a Mon Sep 17 00:00:00 2001 > From: David Thompson <dthompson2@worcester.edu> > Date: Wed, 18 Mar 2015 20:01:12 -0400 > Subject: [PATCH 2/2] environment: Add --inclusive option. > > * guix/scripts/environment.scm (show-help): Add help. > (%default-options): Add 'inclusive?'. > (%options): Add 'inclusive' option. > (packages->transitive-inputs): Add 'inclusive?' argument. > (guix-environment): Use 'inclusive' option. It’s a good idea. Though I guess in the SDL example and similar use cases, it’s often enough to make an environment that contains PACKAGES as their propagated inputs (recursively), but not their inputs. > +@item --inclusive > +@item -i > +Include @var{packages}@dots{} in the new environment in addition to > +their inputs. Useful for creating an environment from arbitrary ^^ “This is useful for” > + -i, --inclusive include PACKAGE... in new environment")) “in the new environment” OK to push with these changes, thank you! Ludo’. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-20 19:20 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-03-19 0:08 [PATCH 0/2] environment: Add --inclusive option David Thompson 2015-03-19 0:11 ` [PATCH 1/2] packages: Expose transitive-inputs David Thompson 2015-03-19 10:34 ` David Thompson 2015-03-19 0:11 ` [PATCH 2/2] environment: Add --inclusive option David Thompson 2015-03-20 0:55 ` David Thompson 2015-03-20 19:20 ` Ludovic Courtès
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.