From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 01 16:12:24 2019 Received: (at 22138) by debbugs.gnu.org; 1 Aug 2019 20:12:24 +0000 Received: from localhost ([127.0.0.1]:55406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htHR2-0007wr-0o for submit@debbugs.gnu.org; Thu, 01 Aug 2019 16:12:24 -0400 Received: from lepiller.eu ([89.234.186.109]:35742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1htHQz-0007we-JJ for 22138@debbugs.gnu.org; Thu, 01 Aug 2019 16:12:22 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 29eb82a8 for <22138@debbugs.gnu.org>; Thu, 1 Aug 2019 20:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=pnd zzYMka2zr8cQ4jlNihuwiRrA=; b=kiL/y7FsCMQrqFEl4Jgx8Vuy+J5r3InjKzO e3+dZIrMPIgkZG9zRLSDfh0CMU42o6HWue2MiK8vZaF3mJL/71xIohnqwXJNY3+l 36CSPkzA4yXxU2/l3cSYDy7VBu4a41royL+ag8g1fjP+mxNwB8mPyqzXT3CqoJk1 4lKq0VLupf9o7IfXGQ671E8Qx+BraPN0litchZGtVeJ9vpsIy81qiRqEq70w4aB1 Co815W2GQg/Np/IMpsM37XJvfgYE37QwjrP/qffUC16GL9YDLmTYqyqQXP6uyFUi JRr255h6KqyTpG9P4swk22JU/U2OsWi/2ZHDnV8aDqGaf/eW0Kg== DomainKey-Signature: a=rsa-sha1; c=nofws; d=lepiller.eu; h=date:from:to :subject:message-id:mime-version:content-type; q=dns; s=dkim; b= kUrtrHA+Tlp1M1NxnQauMoh1ofEW+k+etr0bAUAFeUSyfq1hCJC5+h53Dk2PAiik gJFxME9MkMCqa8De1iONyZ5zlB7lXoHWEUv1pds91O3GlHkddEvnE6JG/yqkRcc4 lLos34QHJv5lCBlgKPKr+QiH/xBGsmrVV2eYv5NozGhCCJ9sMLfz9P9b9BkcaPoX Z9UNTMCnqOQ8mYa3Vh9bhMP4iuIXbZmLqvECgTS/M/1Rqy4zMfITKYG+LuYqiyf2 zM6steVksE6L3u3XehNyJidiO5CaOtBMvfWGvFjkuBzzv+78OavGmig7q9XFMREn pdlOXLyceQzkMf/z4SPcnQ== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id a64bdbcb (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <22138@debbugs.gnu.org>; Thu, 1 Aug 2019 20:12:16 +0000 (UTC) Date: Thu, 1 Aug 2019 22:12:06 +0200 From: Julien Lepiller To: 22138@debbugs.gnu.org Subject: Search paths of dependencies are not honored Message-ID: <20190801221206.17965136@sybil.lepiller.eu> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/P7b3w4QD0RSr.lNrEvJblE1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 22138 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --MP_/P7b3w4QD0RSr.lNrEvJblE1 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I've been looking at our current code and would like to propose the attached patch for that issue. --MP_/P7b3w4QD0RSr.lNrEvJblE1 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-guix-Recursively-honor-search-paths-of-dependencies.patch From cfd2c229087166ab4cc0a9e2bdb72c8b393bcdd5 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 1 Aug 2019 22:09:38 +0200 Subject: [PATCH] guix: Recursively honor search paths of dependencies. * guix/packages.scm (all-transitive-inputs) (package-all-transitive-inputs) (package-all-transitive-native-search-paths): New procedures. * guix/profiles.scm (package->manifest-entry): Use package-all-transitive-native-search-paths to generate manifest search paths. --- guix/packages.scm | 53 +++++++++++++++++++++++++++++++++++++++++++++++ guix/profiles.scm | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/guix/packages.scm b/guix/packages.scm index c94a651f27..f9095759f1 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -101,6 +101,7 @@ package-transitive-propagated-inputs package-transitive-native-search-paths package-transitive-supported-systems + package-all-transitive-native-search-paths package-mapping package-input-rewriting package-input-rewriting/spec @@ -686,6 +687,42 @@ preserved, and only duplicate propagated inputs are removed." ((input rest ...) (loop rest (cons input result) propagated first? seen))))) +(define (all-transitive-inputs inputs) + "Return the closure of INPUTS when considering the 'propagated-inputs', +'inputs' and 'native-inputs' edges. Omit duplicate inputs, except for +those already present in INPUTS itself. + +This is implemented as a breadth-first traversal such that INPUTS is +preserved, and only duplicate propagated inputs are removed." + (define (seen? seen item outputs) + ;; FIXME: We're using pointer identity here, which is extremely sensitive + ;; to memoization in package-producing procedures; see + ;; . + (match (vhash-assq item seen) + ((_ . o) (equal? o outputs)) + (_ #f))) + + (let loop ((inputs inputs) + (result '()) + (transitive '()) + (first? #t) + (seen vlist-null)) + (match inputs + (() + (if (null? transitive) + (reverse result) + (loop (reverse (concatenate transitive)) result '() #f seen))) + (((and input (label (? package? package) outputs ...)) rest ...) + (if (and (not first?) (seen? seen package outputs)) + (loop rest result transitive first? seen) + (loop rest + (cons input result) + (cons (package-direct-inputs package) transitive) + first? + (vhash-consq package outputs seen)))) + ((input rest ...) + (loop rest (cons input result) transitive first? seen))))) + (define (package-direct-sources package) "Return all source origins associated with PACKAGE; including origins in PACKAGE's inputs." @@ -720,6 +757,11 @@ with their propagated inputs." with their propagated inputs, recursively." (transitive-inputs (package-direct-inputs package))) +(define (package-all-transitive-inputs package) + "Return the transitive inputs of PACKAGE---i.e., its direct inputs along +with their propagated inputs, recursively." + (all-transitive-inputs (package-direct-inputs package))) + (define (package-transitive-target-inputs package) "Return the transitive target inputs of PACKAGE---i.e., its direct inputs along with their propagated inputs, recursively. This only includes inputs @@ -749,6 +791,17 @@ recursively." '())) (package-transitive-propagated-inputs package)))) +(define (package-all-transitive-native-search-paths package) + "Return the list of search paths for PACKAGE and its propagated inputs, +recursively." + (append (package-native-search-paths package) + (append-map (match-lambda + ((label (? package? p) _ ...) + (package-native-search-paths p)) + (_ + '())) + (package-all-transitive-inputs package)))) + (define (transitive-input-references alist inputs) "Return a list of (assoc-ref ALIST