summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-02-09 23:38:10 +0100
committerMarius Bakke <marius@gnu.org>2022-02-10 00:21:46 +0100
commitf97fe92b570b01ed1b03abd4f3ec89bf20ebc9db (patch)
tree2940c21dd0be28d4fc0b0144e78d93cf100c6cf5 /gnu
parent6ff0a6d53a4f5c3faa4a4b6503dab47ea2cc2426 (diff)
downloadguix-f97fe92b570b01ed1b03abd4f3ec89bf20ebc9db.tar.gz
gnu: cpplint: Reduce closure size.
* gnu/packages/cpp.scm (cpplint)[arguments]: Add #:modules.  Add phases to
adjust GUIX_PYTHONPATH before the wrap phase.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/cpp.scm31
1 files changed, 29 insertions, 2 deletions
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 09ba10d9ab..86138531c0 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -780,8 +780,35 @@ library.")
         (base32 "13l86aq0h1jga949k79k9x3hw2xqchjc162sclg2f99vz98zcz15"))
        (file-name (git-file-name name version))))
     (arguments
-     (list #:phases
-           #~(modify-phases %standard-phases
+     (list #:modules `((srfi srfi-1)
+                       (srfi srfi-26)
+                       ,@%python-build-system-modules)
+           #:phases
+           #~(modify-phases (@ (guix build python-build-system) %standard-phases)
+               (add-before 'wrap 'reduce-GUIX_PYTHONPATH
+                 (lambda _
+                   ;; Hide the transitive native inputs from GUIX_PYTHONPATH
+                   ;; to prevent them from ending up in the run-time closure.
+                   ;; See also <https://bugs.gnu.org/25235>.
+                   (let ((transitive-native-inputs
+                          '#$(match (package-transitive-native-inputs
+                                     this-package)
+                               (((labels packages) ...) packages))))
+                     ;; Save the original PYTHONPATH because we need it for
+                     ;; tests later.
+                     (setenv "TMP_PYTHONPATH" (getenv "GUIX_PYTHONPATH"))
+                     (setenv "GUIX_PYTHONPATH"
+                             (string-join
+                              (filter (lambda (path)
+                                        (not (any (cut string-prefix? <> path)
+                                                  transitive-native-inputs)))
+                                      (search-path-as-string->list
+                                       (getenv "GUIX_PYTHONPATH")))
+                              ":")))))
+               (add-after 'wrap 'reset-GUIX_PYTHONPATH
+                 (lambda _
+                   (setenv "GUIX_PYTHONPATH"
+                           (getenv "TMP_PYTHONPATH"))))
                (replace 'check
                  (lambda* (#:key tests? #:allow-other-keys)
                    (when tests?