hydra: Add support for manifests.

* build-aux/hydra/gnu-system.scm (arguments->manifests, manifests->packages):
New procedures.
(hydra-jobs): Add a "manifests" subset.
* doc/guix.texi (Continuous Integration): Update accordingly.
This commit is contained in:
Clément Lassieur 2018-08-27 22:47:14 +02:00
parent 73dc7834de
commit 88bfabf111
No known key found for this signature in database
GPG Key ID: 89F96D4808F359C7
2 changed files with 71 additions and 16 deletions

View File

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -56,6 +57,7 @@
(guix packages) (guix packages)
(guix derivations) (guix derivations)
(guix monads) (guix monads)
(guix ui)
((guix licenses) #:select (gpl3+)) ((guix licenses) #:select (gpl3+))
((guix utils) #:select (%current-system)) ((guix utils) #:select (%current-system))
((guix scripts system) #:select (read-operating-system)) ((guix scripts system) #:select (read-operating-system))
@ -311,6 +313,30 @@ valid."
packages))) packages)))
#:select? (const #t))) ;include hidden packages #:select? (const #t))) ;include hidden packages
(define (arguments->manifests arguments)
"Return the list of manifests extracted from ARGUMENTS."
(map (match-lambda
((input-name . relative-path)
(let* ((checkout (assq-ref arguments (string->symbol input-name)))
(base (assq-ref checkout 'file-name)))
(in-vicinity base relative-path))))
(assq-ref arguments 'manifests)))
(define (manifests->packages store manifests)
"Return the list of packages found in MANIFESTS."
(define (load-manifest manifest)
(save-module-excursion
(lambda ()
(set-current-module (make-user-module '((guix profiles) (gnu))))
(primitive-load manifest))))
(parameterize ((%graft? #f))
(delete-duplicates!
(map manifest-entry-item
(append-map (compose manifest-entries
load-manifest)
manifests)))))
;;; ;;;
;;; Hydra entry point. ;;; Hydra entry point.
@ -323,6 +349,7 @@ valid."
("core" 'core) ; only build core packages ("core" 'core) ; only build core packages
("hello" 'hello) ; only build hello ("hello" 'hello) ; only build hello
(((? string?) (? string?) ...) 'list) ; only build selected list of packages (((? string?) (? string?) ...) 'list) ; only build selected list of packages
("manifests" 'manifests) ; only build packages in the list of manifests
(_ 'all))) ; build everything (_ 'all))) ; build everything
(define systems (define systems
@ -419,6 +446,14 @@ valid."
package system)) package system))
packages)) packages))
'())) '()))
((manifests)
;; Build packages in the list of manifests.
(let* ((manifests (arguments->manifests arguments))
(packages (manifests->packages store manifests)))
(map (lambda (package)
(package-job store (job-name package)
package system))
packages)))
(else (else
(error "unknown subset" subset)))) (error "unknown subset" subset))))
systems))) systems)))

View File

@ -18165,23 +18165,43 @@ The type of the Cuirass service. Its value must be a
@code{cuirass-configuration} object, as described below. @code{cuirass-configuration} object, as described below.
@end defvr @end defvr
To add build jobs, you have to set the @code{specifications} field of To add build jobs, you have to set the @code{specifications} field of the
the configuration. Here is an example of a service defining a build job configuration. Here is an example of a service that polls the Guix repository
based on a specification that can be found in Cuirass source tree. This and builds the packages from a manifest. Some of the packages are defined in
service polls the Guix repository and builds a subset of the Guix the @code{"custom-packages"} input, which is the equivalent of
packages, as prescribed in the @file{gnu-system.scm} example spec: @code{GUIX_PACKAGE_PATH}.
@example @example
(let ((spec #~((#:name . "guix") (define %cuirass-specs
#~(list
'((#:name . "my-manifest")
(#:load-path-inputs . ("guix"))
(#:package-path-inputs . ("custom-packages"))
(#:proc-input . "guix")
(#:proc-file . "build-aux/cuirass/gnu-system.scm")
(#:proc . cuirass-jobs)
(#:proc-args . ((subset . "manifests")
(systems . ("x86_64-linux"))
(manifests . (("config" . "guix/manifest.scm")))))
(#:inputs . (((#:name . "guix")
(#:url . "git://git.savannah.gnu.org/guix.git") (#:url . "git://git.savannah.gnu.org/guix.git")
(#:load-path . ".") (#:load-path . ".")
(#:file . "build-aux/cuirass/gnu-system.scm") (#:branch . "master")
(#:proc . cuirass-jobs) (#:no-compile? . #t))
(#:arguments (subset . "hello")) ((#:name . "config")
(#:branch . "master")))) (#:url . "git://git.example.org/config.git")
(#:load-path . ".")
(#:branch . "master")
(#:no-compile? . #t))
((#:name . "custom-packages")
(#:url . "git://git.example.org/custom-packages.git")
(#:load-path . ".")
(#:branch . "master")
(#:no-compile? . #t)))))))
(service cuirass-service-type (service cuirass-service-type
(cuirass-configuration (cuirass-configuration
(specifications #~(list '#$spec))))) (specifications %cuirass-specs)))
@end example @end example
While information related to build jobs is located directly in the While information related to build jobs is located directly in the
@ -18208,7 +18228,7 @@ Owner's group of the @code{cuirass} process.
Number of seconds between the poll of the repositories followed by the Number of seconds between the poll of the repositories followed by the
Cuirass jobs. Cuirass jobs.
@item @code{database} (default: @code{"/var/run/cuirass/cuirass.db"}) @item @code{database} (default: @code{"/var/lib/cuirass/cuirass.db"})
Location of sqlite database which contains the build results and previously Location of sqlite database which contains the build results and previously
added specifications. added specifications.