mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: ganeti: Do not set PYTHONPATH.
* gnu/packages/virtualization.scm (ganeti): Remove trailing #t. [phases]{build-bash-completions}: Do not set PYTHONPATH. {pre-check}: Do patch PYTHONPATH from script. {wrap}: Use the new GUIX_PYTHONPATH environment variable.
This commit is contained in:
parent
40b67a1f2a
commit
1ed567c872
1 changed files with 22 additions and 57 deletions
|
@ -15,7 +15,7 @@
|
||||||
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
|
||||||
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
||||||
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
|
;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -413,7 +413,6 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
(guix build python-build-system))
|
(guix build python-build-system))
|
||||||
#:modules (,@%gnu-build-system-modules
|
#:modules (,@%gnu-build-system-modules
|
||||||
((guix build haskell-build-system) #:prefix haskell:)
|
((guix build haskell-build-system) #:prefix haskell:)
|
||||||
((guix build python-build-system) #:select (python-version))
|
|
||||||
(ice-9 rdelim))
|
(ice-9 rdelim))
|
||||||
|
|
||||||
;; The default test target includes a lot of checks that are only really
|
;; The default test target includes a lot of checks that are only really
|
||||||
|
@ -460,8 +459,7 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
(unless (file-exists? "vcs-version")
|
(unless (file-exists? "vcs-version")
|
||||||
(call-with-output-file "vcs-version"
|
(call-with-output-file "vcs-version"
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(format port "v~a~%" ,version))))
|
(format port "v~a~%" ,version))))))
|
||||||
#t))
|
|
||||||
(add-after 'unpack 'patch-absolute-file-names
|
(add-after 'unpack 'patch-absolute-file-names
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* '("lib/utils/process.py"
|
(substitute* '("lib/utils/process.py"
|
||||||
|
@ -487,8 +485,7 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
(("ndisc6") (which "ndisc6"))
|
(("ndisc6") (which "ndisc6"))
|
||||||
(("fping") (which "fping"))
|
(("fping") (which "fping"))
|
||||||
(("grep") (which "grep"))
|
(("grep") (which "grep"))
|
||||||
(("ip addr") (string-append (which "ip") " addr")))
|
(("ip addr") (string-append (which "ip") " addr")))))
|
||||||
#t))
|
|
||||||
(add-after 'unpack 'override-builtin-PATH
|
(add-after 'unpack 'override-builtin-PATH
|
||||||
(lambda _
|
(lambda _
|
||||||
;; Ganeti runs OS install scripts and similar with a built-in
|
;; Ganeti runs OS install scripts and similar with a built-in
|
||||||
|
@ -496,8 +493,7 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
(substitute* "src/Ganeti/Constants.hs"
|
(substitute* "src/Ganeti/Constants.hs"
|
||||||
(("/sbin:/bin:/usr/sbin:/usr/bin")
|
(("/sbin:/bin:/usr/sbin:/usr/bin")
|
||||||
"/run/setuid-programs:/run/current-system/profile/sbin:\
|
"/run/setuid-programs:/run/current-system/profile/sbin:\
|
||||||
/run/current-system/profile/bin"))
|
/run/current-system/profile/bin"))))
|
||||||
#t))
|
|
||||||
(add-after 'bootstrap 'patch-sphinx-version-detection
|
(add-after 'bootstrap 'patch-sphinx-version-detection
|
||||||
(lambda _
|
(lambda _
|
||||||
;; The build system runs 'sphinx-build --version' to verify that
|
;; The build system runs 'sphinx-build --version' to verify that
|
||||||
|
@ -505,8 +501,8 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
;; .sphinx-build-real executable name created by the Sphinx wrapper.
|
;; .sphinx-build-real executable name created by the Sphinx wrapper.
|
||||||
(substitute* "configure"
|
(substitute* "configure"
|
||||||
(("\\$SPHINX --version 2>&1")
|
(("\\$SPHINX --version 2>&1")
|
||||||
"$SPHINX --version 2>&1 | sed 's/.sphinx-build-real/sphinx-build/g'"))
|
"$SPHINX --version 2>&1 \
|
||||||
#t))
|
| sed 's/.sphinx-build-real/sphinx-build/g'"))))
|
||||||
|
|
||||||
;; The build system invokes Cabal and GHC, which do not work with
|
;; The build system invokes Cabal and GHC, which do not work with
|
||||||
;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
|
;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
|
||||||
|
@ -520,13 +516,11 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
(("\\$\\(CABAL\\)")
|
(("\\$\\(CABAL\\)")
|
||||||
"$(CABAL) --package-db=../package.conf.d")
|
"$(CABAL) --package-db=../package.conf.d")
|
||||||
(("\\$\\(GHC\\)")
|
(("\\$\\(GHC\\)")
|
||||||
"$(GHC) -package-db=../package.conf.d"))
|
"$(GHC) -package-db=../package.conf.d"))))
|
||||||
#t))
|
|
||||||
(add-after 'configure 'make-ghc-use-shared-libraries
|
(add-after 'configure 'make-ghc-use-shared-libraries
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* "Makefile"
|
(substitute* "Makefile"
|
||||||
(("HFLAGS =") "HFLAGS = -dynamic -fPIC"))
|
(("HFLAGS =") "HFLAGS = -dynamic -fPIC"))))
|
||||||
#t))
|
|
||||||
(add-after 'configure 'fix-installation-directories
|
(add-after 'configure 'fix-installation-directories
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* "Makefile"
|
(substitute* "Makefile"
|
||||||
|
@ -536,8 +530,7 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
;; Similarly, do not attempt to install the sample ifup scripts
|
;; Similarly, do not attempt to install the sample ifup scripts
|
||||||
;; to /etc/ganeti.
|
;; to /etc/ganeti.
|
||||||
(("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
|
(("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
|
||||||
"$(DESTDIR)${prefix}$(ifupdir)"))
|
"$(DESTDIR)${prefix}$(ifupdir)"))))
|
||||||
#t))
|
|
||||||
(add-before 'build 'adjust-tests
|
(add-before 'build 'adjust-tests
|
||||||
(lambda _
|
(lambda _
|
||||||
;; Disable tests that can not run. Do it early to prevent
|
;; Disable tests that can not run. Do it early to prevent
|
||||||
|
@ -556,37 +549,16 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
"")
|
"")
|
||||||
;; This test requires networking.
|
;; This test requires networking.
|
||||||
(("test/py/import-export_unittest\\.bash")
|
(("test/py/import-export_unittest\\.bash")
|
||||||
""))
|
""))))
|
||||||
|
|
||||||
;; Many of the Makefile targets reset PYTHONPATH before running
|
|
||||||
;; the Python interpreter, which does not work very well for us.
|
|
||||||
(substitute* "Makefile"
|
|
||||||
(("PYTHONPATH=")
|
|
||||||
(string-append "PYTHONPATH=" (getenv "PYTHONPATH") ":")))
|
|
||||||
#t))
|
|
||||||
(add-after 'build 'build-bash-completions
|
(add-after 'build 'build-bash-completions
|
||||||
(lambda _
|
(lambda _
|
||||||
(let ((orig-pythonpath (getenv "PYTHONPATH")))
|
(invoke "python" "-m" "./autotools/build-bash-completion")))
|
||||||
(setenv "PYTHONPATH" (string-append ".:" orig-pythonpath))
|
|
||||||
(invoke "./autotools/build-bash-completion")
|
|
||||||
(setenv "PYTHONPATH" orig-pythonpath)
|
|
||||||
#t)))
|
|
||||||
(add-before 'check 'pre-check
|
(add-before 'check 'pre-check
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
;; Set TZDIR so that time zones are found.
|
;; Set TZDIR so that time zones are found.
|
||||||
(setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
|
(setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
|
||||||
"/share/zoneinfo"))
|
"/share/zoneinfo"))
|
||||||
|
|
||||||
;; This test checks whether PYTHONPATH is untouched, and extends
|
|
||||||
;; it to include test directories if so. Add an else branch for
|
|
||||||
;; our modified PYTHONPATH, in order to prevent a confusing test
|
|
||||||
;; failure where expired certificates are not cleaned because
|
|
||||||
;; check-cert-expired is silently crashing.
|
|
||||||
(substitute* "test/py/ganeti-cleaner_unittest.bash"
|
|
||||||
(("then export PYTHONPATH=(.*)" all testpath)
|
|
||||||
(string-append all "else export PYTHONPATH="
|
|
||||||
(getenv "PYTHONPATH") ":" testpath "\n")))
|
|
||||||
|
|
||||||
(substitute* "test/py/ganeti.utils.process_unittest.py"
|
(substitute* "test/py/ganeti.utils.process_unittest.py"
|
||||||
;; This test attempts to run an executable with
|
;; This test attempts to run an executable with
|
||||||
;; RunCmd(..., reset_env=True), which fails because the default
|
;; RunCmd(..., reset_env=True), which fails because the default
|
||||||
|
@ -608,8 +580,7 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
(for-each (lambda (file)
|
(for-each (lambda (file)
|
||||||
(symlink "../../src/htools" file))
|
(symlink "../../src/htools" file))
|
||||||
'("hspace" "hscan" "hinfo" "hbal" "hroller"
|
'("hspace" "hscan" "hinfo" "hbal" "hroller"
|
||||||
"hcheck" "hail" "hsqueeze")))
|
"hcheck" "hail" "hsqueeze")))))
|
||||||
#t))
|
|
||||||
(add-after 'install 'install-bash-completions
|
(add-after 'install 'install-bash-completions
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
|
@ -638,21 +609,15 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
(cons (basename (car (reverse (string-split
|
(cons (basename (car (reverse (string-split
|
||||||
line #\ ))))
|
line #\ ))))
|
||||||
progs))
|
progs))
|
||||||
(loop (read-line port) progs))))))))
|
(loop (read-line port) progs)))))))))))
|
||||||
#t)))
|
;; Wrap all executables with GUIX_PYTHONPATH. We can't borrow
|
||||||
;; Wrap all executables with PYTHONPATH. We can't borrow the phase
|
;; the phase from python-build-system because we also need to wrap
|
||||||
;; from python-build-system because we also need to wrap the scripts
|
;; the scripts in $out/lib/ganeti such as "node-daemon-setup".
|
||||||
;; in $out/lib/ganeti such as "node-daemon-setup".
|
|
||||||
(add-after 'install 'wrap
|
(add-after 'install 'wrap
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(sbin (string-append out "/sbin"))
|
(sbin (string-append out "/sbin"))
|
||||||
(lib (string-append out "/lib"))
|
(lib (string-append out "/lib")))
|
||||||
(python (assoc-ref inputs "python"))
|
|
||||||
(major+minor (python-version python))
|
|
||||||
(PYTHONPATH (string-append lib "/python" major+minor
|
|
||||||
"/site-packages:"
|
|
||||||
(getenv "PYTHONPATH"))))
|
|
||||||
(define (shell-script? file)
|
(define (shell-script? file)
|
||||||
(call-with-ascii-input-file file
|
(call-with-ascii-input-file file
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
|
@ -673,11 +638,11 @@ server and embedded PowerPC, and S390 guests.")
|
||||||
|
|
||||||
(for-each (lambda (file)
|
(for-each (lambda (file)
|
||||||
(wrap-program file
|
(wrap-program file
|
||||||
`("PYTHONPATH" ":" prefix (,PYTHONPATH))))
|
`("GUIX_PYTHONPATH" ":" prefix
|
||||||
|
(,(getenv "GUIX_PYTHONPATH")))))
|
||||||
(filter wrap?
|
(filter wrap?
|
||||||
(append (find-files (string-append lib "/ganeti"))
|
(append (find-files (string-append lib "/ganeti"))
|
||||||
(find-files sbin))))
|
(find-files sbin))))))))))
|
||||||
#t))))))
|
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("haskell" ,ghc)
|
`(("haskell" ,ghc)
|
||||||
("cabal" ,cabal-install)
|
("cabal" ,cabal-install)
|
||||||
|
@ -1370,7 +1335,7 @@ domains, their live performance and resource utilization statistics.")
|
||||||
(string-take (string-take-right
|
(string-take (string-take-right
|
||||||
(assoc-ref inputs "python") 5) 3)
|
(assoc-ref inputs "python") 5) 3)
|
||||||
"/site-packages:"
|
"/site-packages:"
|
||||||
(getenv "PYTHONPATH"))))
|
(or (getenv "PYTHONPATH") ""))))
|
||||||
(wrap-program (string-append out "/bin/crit")
|
(wrap-program (string-append out "/bin/crit")
|
||||||
`("PYTHONPATH" ":" prefix (,path))))
|
`("PYTHONPATH" ":" prefix (,path))))
|
||||||
#t)))))
|
#t)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue