;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2016, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2018 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2023-04-29gnu: r-chipcomp: Update to 1.30.0....* gnu/packages/bioconductor.scm (r-chipcomp): Update to 1.30.0. Ricardo Wurmus
2023-04-29gnu: r-qdnaseq: Update to 1.36.0....* gnu/packages/bioconductor.scm (r-qdnaseq): Update to 1.36.0. Ricardo Wurmus
2023-04-29gnu: r-cghcall: Update to 2.62.0....* gnu/packages/bioconductor.scm (r-cghcall): Update to 2.62.0. Ricardo Wurmus
2023-04-29gnu: r-cghbase: Update to 1.60.0....* gnu/packages/bioconductor.scm (r-cghbase): Update to 1.60.0. Ricardo Wurmus
2023-04-29gnu: r-marray: Update to 1.78.0....* gnu/packages/bioconductor.scm (r-marray): Update to 1.78.0. Ricardo Wurmus
2023-04-29gnu: r-matrixgenerics: Update to 1.12.0....* gnu/packages/bioconductor.scm (r-matrixgenerics): Update to 1.12.0. Ricardo Wurmus
2023-04-29gnu: r-chippeakanno: Update to 3.34.0....* gnu/packages/bioconductor.scm (r-chippeakanno): Update to 3.34.0. Ricardo Wurmus
2023-04-29gnu: r-pepsnmr: Update to 1.18.0....* gnu/packages/bioconductor.scm (r-pepsnmr): Update to 1.18.0. Ricardo Wurmus
2023-04-29gnu: r-graph: Update to 1.78.0....* gnu/packages/bioconductor.scm (r-graph): Update to 1.78.0. [native-inputs]: Add r-knitr. Ricardo Wurmus
2023-04-29gnu: r-multtest: Update to 2.56.0....* gnu/packages/bioconductor.scm (r-multtest): Update to 2.56.0. Ricardo Wurmus
2023-04-29gnu: r-mbkmeans: Update to 1.16.0....* gnu/packages/bioconductor.scm (r-mbkmeans): Update to 1.16.0. Ricardo Wurmus
2023-04-29gnu: r-diffbind: Update to 3.10.0....* gnu/packages/bioconductor.scm (r-diffbind): Update to 3.10.0. Ricardo Wurmus
2023-04-29gnu: r-greylistchip: Update to 1.32.0....* gnu/packages/bioconductor.scm (r-greylistchip): Update to 1.32.0. Ricardo Wurmus
2023-04-29gnu: r-apeglm: Update to 1.22.0....* gnu/packages/bioconductor.scm (r-apeglm): Update to 1.22.0. [native-inputs]: Add r-rmarkdown. Ricardo Wurmus
2023-04-29gnu: r-qvalue: Update to 2.32.0....* gnu/packages/bioconductor.scm (r-qvalue): Update to 2.32.0. Ricardo Wurmus
2023-04-29gnu: r-quantsmooth: Update to 1.66.0....* gnu/packages/bioconductor.scm (r-quantsmooth): Update to 1.66.0. Ricardo Wurmus
2023-04-29gnu: r-oligo: Update to 1.64.0....* gnu/packages/bioconductor.scm (r-oligo): Update to 1.64.0. Ricardo Wurmus
2023-04-29gnu: r-oligoclasses: Update to 1.62.0....* gnu/packages/bioconductor.scm (r-oligoclasses): Update to 1.62.0. Ricardo Wurmus
2023-04-29gnu: r-geneplotter: Update to 1.78.0....* gnu/packages/bioconductor.scm (r-geneplotter): Update to 1.78.0. Ricardo Wurmus
2023-04-29gnu: r-zellkonverter: Update to 1.10.0....* gnu/packages/bioconductor.scm (r-zellkonverter): Update to 1.10.0. Ricardo Wurmus
2023-04-29gnu: r-zlibbioc: Update to 1.46.0....* gnu/packages/bioconductor.scm (r-zlibbioc): Update to 1.46.0. Ricardo Wurmus
2023-04-29gnu: r-xvector: Update to 0.40.0....* gnu/packages/bioconductor.scm (r-xvector): Update to 0.40.0. Ricardo Wurmus
2023-04-29gnu: r-xmapbridge: Update to 1.58.0....* gnu/packages/bioconductor.scm (r-xmapbridge): Update to 1.58.0. Ricardo Wurmus
2023-04-29gnu: r-xina: Update to 1.18.0....* gnu/packages/bioconductor.scm (r-xina): Update to 1.18.0. Ricardo Wurmus
2023-04-29gnu: r-vsn: Update to 3.68.0....* gnu/packages/bioconductor.scm (r-vsn): Update to 3.68.0. Ricardo Wurmus
2023-04-29gnu: r-variantannotation: Update to 1.46.0....* gnu/packages/bioconductor.scm (r-variantannotation): Update to 1.46.0. Ricardo Wurmus
2023-04-29gnu: r-tximport: Update to 1.28.0....* gnu/packages/bioconductor.scm (r-tximport): Update to 1.28.0. Ricardo Wurmus
2023-04-29gnu: r-topgo: Update to 2.52.0....* gnu/packages/bioconductor.scm (r-topgo): Update to 2.52.0. Ricardo Wurmus
2023-04-29gnu: r-systempiper: Update to 2.6.0....* gnu/packages/bioconductor.scm (r-systempiper): Update to 2.6.0. Ricardo Wurmus
2023-04-29gnu: r-sva: Update to 3.48.0....* gnu/packages/bioconductor.scm (r-sva): Update to 3.48.0. Ricardo Wurmus
2023-04-29gnu: r-summarizedexperiment: Update to 1.30.0....* gnu/packages/bioconductor.scm (r-summarizedexperiment): Update to 1.30.0. Ricardo Wurmus
2023-04-29gnu: r-structuralvariantannotation: Update to 1.16.0....* gnu/packages/bioconductor.scm (r-structuralvariantannotation): Update to 1.16.0. Ricardo Wurmus
2023-04-29gnu: r-stringdb: Update to 2.12.0....* gnu/packages/bioconductor.scm (r-stringdb): Update to 2.12.0. Ricardo Wurmus
2023-04-29gnu: r-stager: Update to 1.22.0....* gnu/packages/bioconductor.scm (r-stager): Update to 1.22.0. Ricardo Wurmus
2023-04-29gnu: r-slingshot: Update to 2.8.0.ing value." (let loop ((result '())) (match (read-line port) ((? eof-object?) (reverse result)) (line (loop (cons (key=value->pair line) result)))))) (define (device-module-aliases device) "Return the list of module aliases required by DEVICE, a /dev file name, as in this example: (device-module-aliases \"/dev/sda\") => (\"scsi:t-0x00\" \"pci:v00008086d00009D03sv0000103Csd000080FAbc01sc06i01\") The modules corresponding to these aliases can then be found using 'matching-modules'." ;; The approach is adapted from ;; . (let* ((st (stat device)) (type (stat:type st)) (major (stat->device-major st)) (minor (stat->device-minor st)) (sys-name (string-append "/sys/dev/" (case type ((block-special) "block") ((char-special) "char") (else (symbol->string type))) "/" (number->string major) ":" (number->string minor))) (directory (canonicalize-path (readlink* sys-name)))) (let loop ((components (string-tokenize directory %not-slash)) (aliases '())) (match components (("sys" "devices" _) (reverse aliases)) ((head ... _) (let ((uevent (string-append (string-join components "/" 'prefix) "/uevent"))) (if (file-exists? uevent) (let ((props (call-with-input-file uevent read-uevent))) (match (assq-ref props 'MODALIAS) (#f (loop head aliases)) (alias (loop head (cons alias aliases))))) (loop head aliases)))))))) (define (read-module-aliases port) "Read from PORT data in the Linux 'modules.alias' file format. Return a list of alias/module pairs where each alias is a glob pattern as like the result of: (string->compiled-sglob \"scsi:t-0x01*\") and each module is a module name like \"snd_hda_intel\"." (define (comment? str) (string-prefix? "#" str)) (define (tokenize str) ;; Lines have the form "alias ALIAS MODULE", where ALIAS can contain ;; whitespace. This is why we don't use 'string-tokenize'. (let* ((str (string-trim-both str)) (left (string-index str #\space)) (right (string-rindex str #\space))) (list (string-take str left) (string-trim-both (substring str left right)) (string-trim-both (string-drop str right))))) (let loop ((aliases '())) (match (read-line port) ((? eof-object?) (reverse aliases)) ((? comment?) (loop aliases)) (line (match (tokenize line) (("alias" alias module) (loop (alist-cons (string->compiled-sglob alias) module aliases))) (() ;empty line (loop aliases))))))) (define (current-kernel-directory) "Return the directory of the currently running Linux kernel." (string-append (or (getenv "LINUX_MODULE_DIRECTORY") "/run/booted-system/kernel/lib/modules") "/" (utsname:release (uname)))) (define (current-alias-file) "Return the absolute file name of the default 'modules.alias' file." (string-append (current-kernel-directory) "/modules.alias")) (define* (known-module-aliases #:optional (alias-file (current-alias-file))) "Return the list of alias/module pairs read from ALIAS-FILE. Each alias is actually a pattern." (call-with-input-file alias-file read-module-aliases)) (define* (matching-modules alias #:optional (known-aliases (known-module-aliases))) "Return the list of modules that match ALIAS according to KNOWN-ALIASES. ALIAS is a string like \"scsi:t-0x00\" as returned by 'device-module-aliases'." (filter-map (match-lambda ((pattern . module) (and (glob-match? pattern alias) module))) known-aliases)) (define* (missing-modules device modules-provided) "Assuming MODULES-PROVIDED lists kernel modules that are already provided--e.g., in the initrd, return the list of missing kernel modules that are required to access DEVICE." (define aliases ;; Attempt to load 'modules.alias' from the current kernel, assuming we're ;; on Guix System, and assuming that corresponds to the kernel we'll be ;; installing. (known-module-aliases)) (if aliases (let* ((modules (delete-duplicates (append-map (cut matching-modules <> aliases) (device-module-aliases device)))) ;; Module names (not file names) are supposed to use underscores ;; instead of hyphens. MODULES is a list of module names, whereas ;; LINUX-MODULES is file names without '.ko', so normalize them. (provided (map file-name->module-name modules-provided))) (remove (cut member <> provided) modules)) '())) ;;; ;;; Module databases. ;;; (define (module-name->file-name/guess directory name) "Guess the file name corresponding to NAME, a module name. That doesn't always work because sometimes underscores in NAME map to hyphens (e.g., \"input-leds.ko\"), sometimes not (e.g., \"mac_hid.ko\")." (string-append directory "/" (ensure-dot-ko name))) (define (module-name-lookup directory) "Return a one argument procedure that takes a module name (e.g., \"input_leds\") and returns its absolute file name (e.g., \"/.../input-leds.ko\")." (catch 'system-error (lambda () (define mapping (call-with-input-file (string-append directory "/modules.name") read)) (lambda (name) (or (assoc-ref mapping name) (module-name->file-name/guess directory name)))) (lambda args (if (= ENOENT (system-error-errno args)) (cut module-name->file-name/guess directory <>) (apply throw args))))) (define (write-module-name-database directory) "Write a database that maps \"module names\" as they appear in the relevant ELF section of '.ko' files, to actual file names. This format is Guix-specific. It aims to deal with inconsistent naming, in particular hyphens vs. underscores." (define mapping (map (lambda (file) (match (module-formal-name file) (#f (cons (basename file ".ko") file)) (name (cons name file)))) (find-files directory "\\.ko$"))) (call-with-output-file (string-append directory "/modules.name") (lambda (port) (display ";; Module name to file name mapping. ;; ;; This format is Guix-specific; it is not supported by upstream Linux tools. \n" port) (pretty-print mapping port)))) (define (write-module-alias-database directory) "Traverse the '.ko' files in DIRECTORY and create the corresponding 'modules.alias' file." (define aliases (map (lambda (file) (cons (file-name->module-name file) (module-aliases file))) (find-files directory "\\.ko$"))) (call-with-output-file (string-append directory "/modules.alias") (lambda (port) (display "# Aliases extracted from modules themselves.\n" port) (for-each (match-lambda ((module . aliases) (for-each (lambda (alias) (format port "alias ~a ~a\n" alias module)) aliases))) aliases)))) (define (aliases->device-tuple aliases) "Traverse ALIASES, a list of module aliases, and search for \"char-major-M-N\", \"block-major-M-N\", or \"devname:\" aliases. When they are found, return a tuple (DEVNAME TYPE MAJOR MINOR), otherwise return #f." (define (char/block-major? alias) (or (string-prefix? "char-major-" alias) (string-prefix? "block-major-" alias))) (define (char/block-major->tuple alias) (match (string-tokenize alias %not-dash) ((type "major" (= string->number major) (= string->number minor)) (list (match type ("char" "c") ("block" "b")) major minor)))) (let* ((devname (any (lambda (alias) (and (string-prefix? "devname:" alias) (string-drop alias 8))) aliases)) (major/minor (match (find char/block-major? aliases) (#f #f) (str (char/block-major->tuple str))))) (and devname major/minor (cons devname major/minor)))) (define %not-dash (char-set-complement (char-set #\-))) (define (write-module-device-database directory) "Traverse the '.ko' files in DIRECTORY and create the corresponding 'modules.devname' file. This file contains information about modules that can be loaded on-demand, such as file system modules." (define aliases (filter-map (lambda (file) (match (aliases->device-tuple (module-aliases file)) (#f #f) (tuple (cons (file-name->module-name file) tuple)))) (find-files directory "\\.ko$"))) (call-with-output-file (string-append directory "/modules.devname") (lambda (port) (display "# Device nodes to trigger on-demand module loading.\n" port) (for-each (match-lambda ((module devname type major minor) (format port "~a ~a ~a~a:~a~%" module devname type major minor))) aliases)))) (define (depmod version directory) "Given an (existing) DIRECTORY, invoke depmod on it for kernel version VERSION." (let ((destination-directory (string-append directory "/lib/modules/" version)) ;; Note: "System.map" is an input file. (maps-file (string-append directory "/System.map")) ;; Note: "Module.symvers" is an input file. (symvers-file (string-append directory "/Module.symvers"))) ;; These files will be regenerated by depmod below. (for-each (lambda (basename) (when (and (string-prefix? "modules." basename) ;; Note: "modules.builtin" is an input file. (not (string=? "modules.builtin" basename)) ;; Note: "modules.order" is an input file. (not (string=? "modules.order" basename))) (delete-file (string-append destination-directory "/" basename)))) (scandir destination-directory)) (invoke "depmod" "-e" ; Report symbols that aren't supplied ;"-w" ; Warn on duplicates "-b" directory "-F" maps-file ;"-E" symvers-file ; using both "-E" and "-F" is not possible. version))) (define (make-linux-module-directory inputs version output) "Create a new directory OUTPUT and ensure that the directory OUTPUT/lib/modules/VERSION can be used as a source of Linux kernel modules for the first kmod in PATH now to eventually load. Take modules to put into OUTPUT from INPUTS. Right now that means it creates @code{modules.*.bin} which @command{modprobe} will use to find loadable modules." (union-build output inputs #:create-all-directories? #t) (depmod version output)) ;;; linux-modules.scm ends here