From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Thompson Subject: [PATCH 1/2] packages: Merge like search path specifications. Date: Mon, 23 Feb 2015 21:19:12 -0500 Message-ID: <87egpg9hlr.fsf@fsf.org> References: <87ioes9hyi.fsf@fsf.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ55f-0005af-0c for guix-devel@gnu.org; Mon, 23 Feb 2015 21:19:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQ55d-0007ln-OW for guix-devel@gnu.org; Mon, 23 Feb 2015 21:19:14 -0500 Received: from mail.fsf.org ([208.118.235.13]:55561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ55d-0007lj-Kf for guix-devel@gnu.org; Mon, 23 Feb 2015 21:19:13 -0500 Received: from 209-6-40-86.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.40.86]:39907 helo=izanagi) by mail.fsf.org with esmtpsa (TLS-1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1YQ55c-00051c-Rl for guix-devel@gnu.org; Mon, 23 Feb 2015 21:19:13 -0500 In-Reply-To: <87ioes9hyi.fsf@fsf.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-packages-Merge-like-search-path-specifications.patch >From 3f72a5d1cfe6d65f54c50c2ac8a8dd31f1a0691f Mon Sep 17 00:00:00 2001 From: David Thompson 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'." (($ 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 --=-=-= Content-Type: text/plain -- David Thompson Web Developer - Free Software Foundation - http://fsf.org GPG Key: 0FF1D807 Support the FSF: https://fsf.org/donate --=-=-=--