mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-06 23:16:13 -05:00
build-system: Add 'channel-build-system'.
* gnu/ci.scm (channel-build-system, channel-source->package): Remove. * gnu/packages/package-management.scm (channel-source->package): New procedure, moved from (gnu ci). * guix/build-system/channel.scm: New file, with code moved from (gnu ci). * doc/guix.texi (Build Systems): Document it.
This commit is contained in:
parent
0d9eef0a06
commit
5bce4c8242
6 changed files with 87 additions and 42 deletions
|
@ -142,6 +142,7 @@ MODULES = \
|
|||
guix/build-system/android-ndk.scm \
|
||||
guix/build-system/ant.scm \
|
||||
guix/build-system/cargo.scm \
|
||||
guix/build-system/channel.scm \
|
||||
guix/build-system/chicken.scm \
|
||||
guix/build-system/clojure.scm \
|
||||
guix/build-system/cmake.scm \
|
||||
|
|
|
@ -9568,6 +9568,15 @@ with @code{build-expression->derivation} (@pxref{Derivations,
|
|||
@code{build-expression->derivation}}).
|
||||
@end defvr
|
||||
|
||||
@defvr {Scheme Variable} channel-build-system
|
||||
This variable is exported by @code{(guix build-system channel)}.
|
||||
|
||||
This build system is meant primarily for internal use. It requires two
|
||||
arguments, @code{#:commit} and @code{#:source}, and builds a Guix
|
||||
instance from that channel, in the same way @command{guix time-machine}
|
||||
would do it (@pxref{Channels}).
|
||||
@end defvr
|
||||
|
||||
@node Build Phases
|
||||
@section Build Phases
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2016, 2018-2020, 2022 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -20,7 +20,6 @@
|
|||
(gnu packages package-management)
|
||||
(guix monads)
|
||||
(guix store)
|
||||
((gnu ci) #:select (channel-source->package))
|
||||
((guix git-download) #:select (git-predicate))
|
||||
((guix utils) #:select (current-source-directory))
|
||||
(git)
|
||||
|
|
42
gnu/ci.scm
42
gnu/ci.scm
|
@ -21,9 +21,9 @@
|
|||
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gnu ci)
|
||||
#:use-module (guix channels)
|
||||
#:use-module (guix build-system channel)
|
||||
#:use-module (guix config)
|
||||
#:use-module (guix describe)
|
||||
#:autoload (guix describe) (package-channels)
|
||||
#:use-module (guix store)
|
||||
#:use-module (guix grafts)
|
||||
#:use-module (guix profiles)
|
||||
|
@ -32,7 +32,6 @@ (define-module (gnu ci)
|
|||
#:use-module (guix channels)
|
||||
#:use-module (guix config)
|
||||
#:use-module (guix derivations)
|
||||
#:use-module (guix build-system)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix ui)
|
||||
|
@ -71,7 +70,6 @@ (define-module (gnu ci)
|
|||
image->job
|
||||
|
||||
%core-packages
|
||||
channel-source->package
|
||||
|
||||
arguments->systems
|
||||
cuirass-jobs))
|
||||
|
@ -288,42 +286,6 @@ (define MiB
|
|||
'()))
|
||||
'()))
|
||||
|
||||
(define channel-build-system
|
||||
;; Build system used to "convert" a channel instance to a package.
|
||||
(let* ((build (lambda* (name inputs
|
||||
#:key source commit system
|
||||
#:allow-other-keys)
|
||||
(mlet* %store-monad ((source (if (string? source)
|
||||
(return source)
|
||||
(lower-object source)))
|
||||
(instance
|
||||
-> (checkout->channel-instance
|
||||
source #:commit commit)))
|
||||
(channel-instances->derivation (list instance)))))
|
||||
(lower (lambda* (name #:key system source commit
|
||||
#:allow-other-keys)
|
||||
(bag
|
||||
(name name)
|
||||
(system system)
|
||||
(build build)
|
||||
(arguments `(#:source ,source
|
||||
#:commit ,commit))))))
|
||||
(build-system (name 'channel)
|
||||
(description "Turn a channel instance into a package.")
|
||||
(lower lower))))
|
||||
|
||||
(define* (channel-source->package source #:key commit)
|
||||
"Return a package for the given channel SOURCE, a lowerable object."
|
||||
(package
|
||||
(inherit guix)
|
||||
(version (string-append (package-version guix) "+"))
|
||||
(build-system channel-build-system)
|
||||
(arguments `(#:source ,source
|
||||
#:commit ,commit))
|
||||
(inputs '())
|
||||
(native-inputs '())
|
||||
(propagated-inputs '())))
|
||||
|
||||
(define* (system-test-jobs store system
|
||||
#:key source commit)
|
||||
"Return a list of jobs for the system tests."
|
||||
|
|
|
@ -110,6 +110,7 @@ (define-module (gnu packages package-management)
|
|||
#:use-module (gnu packages xml)
|
||||
#:use-module (gnu packages xorg)
|
||||
#:use-module (gnu packages version-control)
|
||||
#:autoload (guix build-system channel) (channel-build-system)
|
||||
#:use-module (guix build-system glib-or-gtk)
|
||||
#:use-module (guix build-system gnu)
|
||||
#:use-module (guix build-system guile)
|
||||
|
@ -489,6 +490,21 @@ (define code
|
|||
(license license:gpl3+)
|
||||
(properties '((ftp-server . "alpha.gnu.org"))))))
|
||||
|
||||
(define* (channel-source->package source #:key commit)
|
||||
"Return a package for the given channel SOURCE, a lowerable object."
|
||||
(package
|
||||
(inherit guix)
|
||||
(version (string-append (package-version guix) "."
|
||||
(if commit (string-take commit 7) "")))
|
||||
(build-system channel-build-system)
|
||||
(arguments `(#:source ,source
|
||||
#:commit ,commit))
|
||||
(inputs '())
|
||||
(native-inputs '())
|
||||
(propagated-inputs '())))
|
||||
|
||||
(export channel-source->package)
|
||||
|
||||
(define-public guix-for-cuirass
|
||||
;; Known-good revision before commit
|
||||
;; bd86bbd300474204878e927f6cd3f0defa1662a5, which introduced
|
||||
|
|
58
guix/build-system/channel.scm
Normal file
58
guix/build-system/channel.scm
Normal file
|
@ -0,0 +1,58 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2019-2021 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (guix build-system channel)
|
||||
#:use-module ((guix store) #:select (%store-monad))
|
||||
#:use-module ((guix gexp) #:select (lower-object))
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix channels)
|
||||
#:use-module (guix build-system)
|
||||
#:export (channel-build-system))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
;;; The "channel" build system lets you build Guix instances from channel
|
||||
;;; specifications, similar to how 'guix time-machine' would do it, as regular
|
||||
;;; packages.
|
||||
;;;
|
||||
;;; Code:
|
||||
|
||||
(define channel-build-system
|
||||
;; Build system used to "convert" a channel instance to a package.
|
||||
(let* ((build (lambda* (name inputs
|
||||
#:key source commit system
|
||||
#:allow-other-keys)
|
||||
(mlet* %store-monad ((source (if (string? source)
|
||||
(return source)
|
||||
(lower-object source)))
|
||||
(instance
|
||||
-> (checkout->channel-instance
|
||||
source #:commit commit)))
|
||||
(channel-instances->derivation (list instance)))))
|
||||
(lower (lambda* (name #:key system source commit
|
||||
#:allow-other-keys)
|
||||
(bag
|
||||
(name name)
|
||||
(system system)
|
||||
(build build)
|
||||
(arguments `(#:source ,source
|
||||
#:commit ,commit))))))
|
||||
(build-system (name 'channel)
|
||||
(description "Turn a channel instance into a package.")
|
||||
(lower lower))))
|
||||
|
Loading…
Reference in a new issue