guix-modular.scm 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. ;;;
  19. ;;; This file defines a continuous integration job to build the same modular
  20. ;;; Guix as 'guix pull', which is defined in (guix self).
  21. ;;;
  22. (use-modules (guix store)
  23. (guix config)
  24. (guix utils)
  25. ((guix packages) #:select (%hydra-supported-systems))
  26. (guix derivations)
  27. (guix monads)
  28. ((guix licenses) #:prefix license:)
  29. (srfi srfi-1)
  30. (ice-9 match))
  31. ;; XXX: Debugging hack: since `hydra-eval-guile-jobs' redirects the output
  32. ;; port to the bit bucket, let us write to the error port instead.
  33. (setvbuf (current-error-port) _IOLBF)
  34. (set-current-output-port (current-error-port))
  35. (define* (build-job store source version system)
  36. "Return a Hydra job a list building the modular Guix derivation from SOURCE
  37. for SYSTEM. Use VERSION as the version identifier."
  38. (lambda ()
  39. (define build
  40. (primitive-load (string-append source "/build-aux/build-self.scm")))
  41. `((derivation . ,(derivation-file-name
  42. (run-with-store store
  43. (build source #:version version #:system system
  44. #:pull-version 1
  45. #:guile-version "2.2")))) ;the latest 2.2.x
  46. (description . "Modular Guix")
  47. (long-description
  48. . "This is the modular Guix package as produced by 'guix pull'.")
  49. (license . ,license:gpl3+)
  50. (home-page . ,%guix-home-page-url)
  51. (maintainers . (,%guix-bug-report-address)))))
  52. (define (hydra-jobs store arguments)
  53. "Return Hydra jobs."
  54. (define systems
  55. (match (assoc-ref arguments 'systems)
  56. (#f %hydra-supported-systems)
  57. ((lst ...) lst)
  58. ((? string? str) (call-with-input-string str read))))
  59. (define guix-checkout
  60. (or (assq-ref arguments 'guix) ;Hydra on hydra
  61. (assq-ref arguments 'guix-modular))) ;Cuirass on berlin
  62. (define version
  63. (or (assq-ref guix-checkout 'revision)
  64. "0.unknown"))
  65. (let ((file (assq-ref guix-checkout 'file-name)))
  66. (format (current-error-port) "using checkout ~s (~s; arguments: ~s)~%"
  67. guix-checkout file arguments)
  68. (map (lambda (system)
  69. (let ((name (string->symbol
  70. (string-append "guix." system))))
  71. `(,name
  72. . ,(build-job store file version system))))
  73. systems)))