Suivant: Récapitulatif, Précédent: Level 3: Setting Up Continuous Integration, Monter: Développement logiciel [Table des matières][Index]
The Cuirass spec above is convenient: it builds every package in our channel, which includes a few variants (voir Level 3: Setting Up Continuous Integration). However, this might be insufficiently expressive in some cases: one might want specific cross-compilation jobs, transformations, Docker images, RPM/Deb packages, or even system tests.
To achieve that, you can write a manifest (voir Writing Manifests dans GNU Guix Reference Manual). The one we have for Guile has entries for the package variants we defined above, as well as additional variants and cross builds:
;; This is ‘.guix/manifest.scm’. (use-modules (guix) (guix profiles) (guile-package)) ;import our own package module (define* (package->manifest-entry* package system #:key target) "Return a manifest entry for PACKAGE on SYSTEM, optionally cross-compiled to TARGET." (manifest-entry (inherit (package->manifest-entry package)) (name (string-append (package-name package) "." system (if target (string-append "." target) ""))) (item (with-parameters ((%current-system system) (%current-target-system target)) package)))) (define native-builds (manifest (append (map (lambda (system) (package->manifest-entry* guile system)) '("x86_64-linux" "i686-linux" "aarch64-linux" "armhf-linux" "powerpc64le-linux")) (map (lambda (guile) (package->manifest-entry* guile "x86_64-linux")) (cons (package (inherit (package-with-c-toolchain guile `(("clang-toolchain" ,(specification->package "clang-toolchain"))))) (name "guile-clang")) (list guile-without-threads guile-without-networking guile-debug guile-strict-typing)))))) (define cross-builds (manifest (map (lambda (target) (package->manifest-entry* guile "x86_64-linux" #:target target)) '("i586-pc-gnu" "aarch64-linux-gnu" "riscv64-linux-gnu" "i686-w64-mingw32" "x86_64-linux-gnu")))) (concatenate-manifests (list native-builds cross-builds))
We won’t go into the details of this manifest; suffice to say that it provides additional flexibility. We now need to tell Cuirass to build this manifest, which is done with a spec slightly different from the previous one:
;; Cuirass spec file to build all the packages of the ‘guile’ channel. (list (specification (name "guile") (build '(manifest ".guix/manifest.scm")) (channels (append (list (channel (name 'guile) (url "https://git.savannah.gnu.org/git/guile.git") (branch "main"))) %default-channels))))
We changed the (build …)
part of the spec to '(manifest
".guix/manifest.scm")
so that it would pick our manifest, and that’s it!
Suivant: Récapitulatif, Précédent: Level 3: Setting Up Continuous Integration, Monter: Développement logiciel [Table des matières][Index]