From: David Thompson <dthompson2@worcester.edu>
To: guix-devel@gnu.org
Subject: [PATCH 1/2] packages: Merge like search path specifications.
Date: Mon, 23 Feb 2015 21:19:12 -0500 [thread overview]
Message-ID: <87egpg9hlr.fsf@fsf.org> (raw)
In-Reply-To: <87ioes9hyi.fsf@fsf.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-packages-Merge-like-search-path-specifications.patch --]
[-- Type: text/x-diff, Size: 3488 bytes --]
From 3f72a5d1cfe6d65f54c50c2ac8a8dd31f1a0691f Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Mon, 23 Feb 2015 20:36:59 -0500
Subject: [PATCH 1/2] packages: Merge like search path specifications.
* guix/packages.scm (merge-search-path-specifications): New procedure.
* guix/scripts/packages.scm (search-path-environment-variables): Merge search
paths before displaying them.
---
guix/packages.scm | 28 ++++++++++++++++++++++++++++
guix/scripts/package.scm | 7 ++++---
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index 5b686a1..3e0574a 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -54,6 +54,7 @@
search-path-specification
search-path-specification?
search-path-specification->sexp
+ merge-search-path-specifications
package
package?
@@ -203,6 +204,33 @@ corresponds to the arguments expected by `set-path-environment-variable'."
(($ <search-path-specification> variable files separator type pattern)
`(,variable ,files ,separator ,type ,pattern))))
+(define (merge-search-path-specifications specs)
+ "Merge the elements of SPECS, a list of search path specifications, by
+combining the ones that represent the same environment variable."
+ (match specs
+ (() '())
+ (((? search-path-specification? spec) . tail)
+ (let-values (((dupes others)
+ ;; Separate duplicate variables from the remainder of
+ ;; the list.
+ (partition
+ (lambda (other-spec)
+ (string=?
+ (search-path-specification-variable spec)
+ (search-path-specification-variable other-spec)))
+ tail)))
+ (cons (fold (lambda (dupe memo)
+ ;; Assuming separator, type, and pattern are the same
+ ;; since the environment variable names match.
+ (search-path-specification (inherit memo)
+ (files (delete-duplicates
+ (append
+ (search-path-specification-files memo)
+ (search-path-specification-files dupe))))))
+ spec
+ dupes)
+ (merge-search-path-specifications others))))))
+
(define %supported-systems
;; This is the list of system types that are supported. By default, we
;; expect all packages to build successfully here.
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index fc116d8..da95d45 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -393,9 +393,10 @@ current settings and report only settings not already effective."
(string-join path separator)))))))
(let* ((packages (filter-map manifest-entry->package entries))
- (search-paths (delete-duplicates
- (append-map package-native-search-paths
- packages))))
+ (search-paths (merge-search-path-specifications
+ (delete-duplicates
+ (append-map package-native-search-paths
+ packages)))))
(filter-map search-path-definition search-paths))))
(define (display-search-paths entries profile)
--
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
next prev parent reply other threads:[~2015-02-24 2:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 2:11 [PATCH 0/2] Improve search path handling? David Thompson
2015-02-24 2:19 ` David Thompson [this message]
2015-02-27 16:03 ` [PATCH 1/2] packages: Merge like search path specifications Ludovic Courtès
2015-02-24 2:19 ` [PATCH 2/2] packages: Add %base-search-path-specifications David Thompson
2015-02-27 16:04 ` Ludovic Courtès
2015-02-25 3:04 ` [PATCH 0/2] Improve search path handling? David Thompson
2015-02-27 16:06 ` Ludovic Courtès
2015-02-28 17:31 ` David Thompson
2015-02-28 20:36 ` Andreas Enge
2015-03-02 6:17 ` Mark H Weaver
2015-03-02 9:27 ` Ludovic Courtès
2015-03-02 13:26 ` Dave Thompson
2015-03-02 14:27 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87egpg9hlr.fsf@fsf.org \
--to=dthompson2@worcester.edu \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).