2013-01-05 23:47:50 +00:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2018-01-21 00:42:59 +00:00
|
|
|
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
2017-09-27 20:04:44 +00:00
|
|
|
;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
2019-11-17 12:29:19 +00:00
|
|
|
;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org>
|
2012-11-18 17:35:26 +00:00
|
|
|
;;;
|
2013-01-05 23:47:50 +00:00
|
|
|
;;; This file is part of GNU Guix.
|
2012-11-18 17:35:26 +00:00
|
|
|
;;;
|
2013-01-05 23:47:50 +00:00
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
2012-11-18 17:35:26 +00:00
|
|
|
;;; 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.
|
|
|
|
;;;
|
2013-01-05 23:47:50 +00:00
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
2012-11-18 17:35:26 +00:00
|
|
|
;;; 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
|
2013-01-05 23:47:50 +00:00
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
2012-11-18 17:35:26 +00:00
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; This file defines build jobs for the Hydra continuation integration
|
|
|
|
;;; tool.
|
|
|
|
;;;
|
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(use-modules (guix inferior) (guix channels)
|
|
|
|
(guix)
|
|
|
|
(guix ui)
|
|
|
|
(srfi srfi-1)
|
|
|
|
(ice-9 match))
|
2017-12-13 22:09:27 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
;; XXX: Debugging hack: since `hydra-eval-guile-jobs' redirects the output
|
|
|
|
;; port to the bit bucket, let us write to the error port instead.
|
|
|
|
(setvbuf (current-error-port) _IOLBF)
|
|
|
|
(set-current-output-port (current-error-port))
|
2013-03-27 23:14:38 +00:00
|
|
|
|
2019-11-17 12:29:19 +00:00
|
|
|
(define (find-current-checkout arguments)
|
|
|
|
"Find the first checkout of ARGUMENTS that provided the current file.
|
|
|
|
Return #f if no such checkout is found."
|
|
|
|
(let ((current-root
|
|
|
|
(canonicalize-path
|
|
|
|
(string-append (dirname (current-filename)) "/../.."))))
|
|
|
|
(find (lambda (argument)
|
|
|
|
(and=> (assq-ref argument 'file-name)
|
|
|
|
(lambda (name)
|
|
|
|
(string=? name current-root)))) arguments)))
|
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(define (hydra-jobs store arguments)
|
|
|
|
"Return a list of jobs where each job is a NAME/THUNK pair."
|
2019-11-17 12:29:19 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(define checkout
|
2019-11-17 12:29:19 +00:00
|
|
|
(find-current-checkout arguments))
|
2017-12-13 22:09:27 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(define commit
|
|
|
|
(assq-ref checkout 'revision))
|
2013-03-27 23:14:38 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(define source
|
|
|
|
(assq-ref checkout 'file-name))
|
2018-04-08 15:57:13 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(define instance
|
|
|
|
(checkout->channel-instance source #:commit commit))
|
2013-03-26 23:24:54 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(define derivation
|
|
|
|
;; Compute the derivation of Guix for COMMIT.
|
|
|
|
(run-with-store store
|
|
|
|
(channel-instances->derivation (list instance))))
|
2012-11-18 17:35:26 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(show-what-to-build store (list derivation))
|
|
|
|
(build-derivations store (list derivation))
|
|
|
|
|
|
|
|
;; Open an inferior for the just-built Guix.
|
|
|
|
(let ((inferior (open-inferior (derivation->output-path derivation))))
|
|
|
|
(inferior-eval '(use-modules (gnu ci) (ice-9 match)) inferior)
|
2012-11-20 23:57:47 +00:00
|
|
|
|
2018-11-26 16:17:45 +00:00
|
|
|
(map (match-lambda
|
|
|
|
((name . fields)
|
|
|
|
;; Hydra expects a thunk, so here it is.
|
|
|
|
(cons name (lambda () fields))))
|
2019-11-17 12:29:19 +00:00
|
|
|
(inferior-eval-with-store
|
|
|
|
inferior store
|
|
|
|
`(lambda (store)
|
|
|
|
(map (match-lambda
|
|
|
|
((name . thunk)
|
|
|
|
(cons name (thunk))))
|
|
|
|
(hydra-jobs store '((superior-guix-checkout . ,checkout)
|
|
|
|
,@arguments))))))))
|