diff options
| author | pjotrp <pjotr.public01@thebird.nl> | 2026-10-01 10:23:31 +0200 |
|---|---|---|
| committer | pjotrp <pjotr.public01@thebird.nl> | 2026-10-01 10:23:31 +0200 |
| commit | d6bfdad5fa2d5aefa5edee04bd7655bd23fd0cb2 (patch) | |
| tree | aff088311a6259df2a8b15a0a75fa545924426af | |
| parent | a3f0372a816ed6bb1795ab3836417f98a28ae4fe (diff) | |
| download | guix-bioinformatics-d6bfdad5fa2d5aefa5edee04bd7655bd23fd0cb2.tar.gz | |
bnw: fixes
| -rw-r--r-- | gn/packages/bnw.scm | 71 | ||||
| -rw-r--r-- | gn/packages/python-build.scm | 2 |
2 files changed, 62 insertions, 11 deletions
diff --git a/gn/packages/bnw.scm b/gn/packages/bnw.scm index a609905..f7dede6 100644 --- a/gn/packages/bnw.scm +++ b/gn/packages/bnw.scm @@ -2,6 +2,7 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix git-download) + #:use-module (guix gexp) #:use-module (guix build-system gnu) #:use-module (gnu packages gcc) #:use-module (gnu packages graph) @@ -14,25 +15,23 @@ #:use-module (gn packages web)) (define-public bnw - (let ((commit "73ba58868451b5fc6611e1feaa9b63f17b6cd19d") - (revision "5")) (package (name "bnw") - (version (git-version "genenet8_initial_1.3" revision commit)) ; Oct 11, 2021 + (version "1.0.0") (source (origin (method git-fetch) (uri (git-reference - (url "https://github.com/ziejd2/BNW") - (commit commit))) + (url "https://git.genenetwork.org/gn-bnw") + (commit "74f922e3496a5f0dfe97792a5f10bba41862267d") + )) (file-name (git-file-name name version)) (sha256 (base32 - "150aq4cg3yxhgv8vw6mxkq94ib1v0s94c2cibd5fpw92vgf24y9n")) + "0gj1il7ypkcjblb8q0c5g1m1fmamnrqf357vr4dbdlax5apx24z0")) (modules '((guix build utils))) (snippet '(begin (delete-file "var_lib_genenet_bnw/localscore/libRmath.so") - (delete-file-recursively "bnw-env") (delete-file "var_lib_genenet_bnw/k-best/src/get_kbest_nets") (delete-file "var_lib_genenet_bnw/k-best/src/get_kbest_parents") (for-each delete-file (find-files "." "\\.dll$")) @@ -64,11 +63,46 @@ #:phases (modify-phases %standard-phases (delete 'configure) - (add-after 'unpack 'patch-source + (add-after 'unpack 'clean-artifacts + (lambda _ + ;; Same hygiene as the upstream-source snippet; applies to + ;; both the patched upstream checkout and the local test + ;; checkout. The git-fetch checkout already had the + ;; snippet applied, so these files are already gone by + ;; the time this phase runs -- guard each deletion so + ;; the phase also works unmodified against a local-file + ;; checkout (which skips the snippet). + (for-each + (lambda (file) + (when (file-exists? file) + (delete-file file))) + '("var_lib_genenet_bnw/localscore/libRmath.so" + "var_lib_genenet_bnw/k-best/src/get_kbest_nets" + "var_lib_genenet_bnw/k-best/src/get_kbest_parents")) + (for-each delete-file (find-files "." "\\.dll$")) + (for-each delete-file (find-files "." "\\.o$")))) + (add-after 'clean-artifacts 'patch-source (lambda _ ;; sourcecodes/matrix.php hardcodes $dir=/tmp/bnw (substitute* "sourcecodes/matrix.php" (("/tmp/bnw") "/var/lib/genenet/bnw/")))) + (add-after 'patch-source 'fix-python-path + (lambda* (#:key inputs #:allow-other-keys) + ;; The plotting scripts are called with a hardcoded + ;; developer python path; point them at the python + ;; shipped with the package (python3; the octave + ;; wrappers export GUIX_PYTHONPATH with plotly et al., + ;; and referencing it here pulls python into the + ;; container closure). All other path fixes live in + ;; bnw-container-paths.patch. + (let ((python3 (assoc-ref inputs "python"))) + (for-each + (lambda (file) + (substitute* file + (("/home/jziebart/python/Python-2.7.15/python") + (string-append python3 "/bin/python3")))) + (append (find-files "sourcecodes" "\\.py$") + (find-files "sourcecodes/run_scripts" ".*")))))) (add-after 'patch-source-shebangs 'patch-more-shebangs (lambda* (#:key inputs #:allow-other-keys) (let ((graphviz (assoc-ref inputs "graphviz")) @@ -89,7 +123,9 @@ (find-files "sourcecodes/run_scripts")) (("/usr/bin/dot") (string-append graphviz "/bin/dot"))) (substitute* "var_lib_genenet_bnw/build.sh" - (("./localscore/libRmath.so") + ;; Upstream now calls pkgconf to find libRmath; we + ;; point gcc straight at the rmath-standalone lib. + (("\\$\\(pkgconf --libs libRmath\\)") (string-append rmath "/lib/libRmath.so")))))) (add-after 'patch-source-shebangs 'replace-javascript (lambda* (#:key inputs #:allow-other-keys) @@ -143,6 +179,21 @@ (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (copy-recursively "." out)))) + (add-after 'install 'install-diag-page + (lambda* (#:key outputs #:allow-other-keys) + ;; Debug helper for the container: shows the php-fpm + ;; working directory and request method. Not part of + ;; upstream BNW. + (call-with-output-file + (string-append (assoc-ref outputs "out") + "/sourcecodes/diag.php") + (lambda (port) + (display + (string-append + "<?php echo 'cwd=', getcwd(); " + "echo ' method=', $_SERVER['REQUEST_METHOD']; ?>") + port))))) + (add-after 'install 'install-javascript-libraries (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) @@ -267,4 +318,4 @@ "This contains the code for the @dfn{Bayesian Network Webserver} (BNW).") (license (list license:gpl2 license:gpl2+ - license:lgpl2.1+))))) + license:lgpl2.1+)))) diff --git a/gn/packages/python-build.scm b/gn/packages/python-build.scm index 445a674..f695e3d 100644 --- a/gn/packages/python-build.scm +++ b/gn/packages/python-build.scm @@ -21,7 +21,7 @@ (method git-fetch) (uri (git-reference (url "https://github.com/pypa/build") - (commit version))) + (commit ""))) (file-name (git-file-name name version)) (sha256 (base32 "107hhzjrlj56gshcyalf4laf741swmmaznlz0xcfv8rvpwa81mm2")))) |
