diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/guix-jobs.scm | 38 | ||||
-rw-r--r-- | examples/guix-track-git.scm | 26 | ||||
-rw-r--r-- | examples/hello-git.scm | 55 | ||||
-rw-r--r-- | examples/hello-singleton.scm | 28 | ||||
-rw-r--r-- | examples/hello-subset.scm | 39 | ||||
-rw-r--r-- | examples/random-jobs.scm | 7 | ||||
-rw-r--r-- | examples/random.scm | 17 |
7 files changed, 116 insertions, 94 deletions
diff --git a/examples/guix-jobs.scm b/examples/guix-jobs.scm index 862cff7..963c7ff 100644 --- a/examples/guix-jobs.scm +++ b/examples/guix-jobs.scm @@ -1,5 +1,6 @@ ;;; guix-jobs.scm -- job specification test for Guix ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of Cuirass. ;;; @@ -16,22 +17,29 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>. -(define (local-file file) - ;; In the common case jobs will be defined relative to the repository. - ;; However for testing purpose use local gnu-system.scm instead. - (string-append (dirname (current-filename)) "/" file)) - -(define job-base - `((#:name . "guix") - (#:url . "git://git.savannah.gnu.org/guix.git") - (#:load-path . ".") - (#:file . ,(local-file "gnu-system.scm")) - (#:proc . hydra-jobs))) +(define (job-base key value) + `((#:name . ,(string-append "guix-" value)) + (#:load-path-inputs . ("guix")) + (#:package-path-inputs . ()) + (#:proc-input . "cuirass") + (#:proc-file . "examples/gnu-system.scm") + (#:proc . hydra-jobs) + (#:proc-args (subset . "hello")) + (#:inputs . (,(acons key value + '((#:name . "guix") + (#:url . "git://git.savannah.gnu.org/guix.git") + (#:load-path . ".") + (#:no-compile? . #t))) + ((#:name . "cuirass") + (#:url . "https://git.savannah.gnu.org/git/guix/guix-cuirass.git") + (#:load-path . ".") + (#:branch . "master") + (#:no-compile? . #t)))))) (define guix-master - (acons #:branch "master" job-base)) + (job-base #:branch "master")) -(define guix-0.10 - (acons #:tag "v0.10.0" job-base)) +(define guix-0.15 + (job-base #:tag "v0.15.0")) -(list guix-master guix-0.10) +(list guix-master guix-0.15) diff --git a/examples/guix-track-git.scm b/examples/guix-track-git.scm index 2a538fa..ab8abaa 100644 --- a/examples/guix-track-git.scm +++ b/examples/guix-track-git.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of Cuirass. ;;; @@ -154,7 +155,7 @@ valid." (string-map (lambda (c) (if (memq c (string->list ":/")) #\- c)) url) #\-)) -(define* (package->spec pkg #:key (branch "master") commit url) +(define* (package->input pkg #:key (branch "master") commit url) (let ((url (or url ((compose git-reference-url origin-uri package-source) pkg)))) `((#:name . ,(url->file-name url)) (#:url . ,url) @@ -195,17 +196,18 @@ valid." (uri (origin-uri source))) (if (not branch) pkg - (let* ((spec (package->spec pkg #:branch branch #:commit commit #:url url))) - (let-values (((checkout commit) - (fetch-repository store spec))) - (let* ((url (or url (git-reference-url uri))) - ; maybe (string-append (%package-cachedir) "/" (url->file-name url)) - (git-dir checkout) - (hash (bytevector->nix-base32-string (file-hash git-dir))) - (source (origin (uri (git-reference (url url) (commit commit))) - (method git-fetch) - (sha256 (base32 hash))))) - (set-fields pkg ((package-source) source)))))))) + (let* ((input (package->input pkg #:branch branch #:commit commit #:url url)) + (checkout (fetch-input store input)) + (url (or url (git-reference-url uri))) + ;; maybe (string-append (%package-cachedir) "/" (url->file-name url)) + (git-dir (assq-ref checkout #:directory)) + (hash (bytevector->nix-base32-string (file-hash git-dir))) + (source (origin (uri (git-reference + (url url) + (commit (assq-ref checkout #:commit)))) + (method git-fetch) + (sha256 (base32 hash))))) + (set-fields pkg ((package-source) source)))))) ;;; diff --git a/examples/hello-git.scm b/examples/hello-git.scm index f6df99c..6468452 100644 --- a/examples/hello-git.scm +++ b/examples/hello-git.scm @@ -1,6 +1,7 @@ ;;; hello-git.scm -- job specification test for hello git repository ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of Cuirass. ;;; @@ -17,37 +18,29 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>. -(use-modules (srfi srfi-1)) - -(define (local-file file) - ;; In the common case jobs will be defined relative to the repository. - ;; However for testing purpose use local gnu-system.scm instead. - (string-append (dirname (current-filename)) "/" file)) - -(define (url->file-name url) - (string-trim - (string-map (lambda (c) (if (memq c (string->list ":/")) #\- c)) url) - #\-)) - -(define vc - ;; where your version-control checkouts live - (string-append (getenv "HOME") "/src")) -(define guix-checkout (string-append vc "/guix")) - ;; building GNU hello from git is too much work -;; (define hello-checkout (string-append vc "/hello")) -;; (define hello-git "http://git.savannah.gnu.org/r/hello.git") +(define cuirass-git "https://git.savannah.gnu.org/git/guix/guix-cuirass.git") ;; ... so let's track cuirass' git -(define cuirass-checkout (string-append vc "/cuirass")) -(define cuirass-git "https://notabug.org/mthl/cuirass") -;;(define cuirass-git "https://gitlab.com/janneke/cuirass.git") -(list - `((#:name . ,(url->file-name cuirass-checkout)) - (#:url . ,cuirass-git) - (#:branch . "master") - (#:no-compile? . #t) - (#:load-path . ,guix-checkout) - (#:proc . guix-jobs) - (#:file . ,(local-file "guix-track-git.scm")) - (#:arguments (name . "cuirass") (url . ,cuirass-git)))) +;; This builds the Guix Cuirass package with its source replaced by the last +;; commit of Cuirass' git repository. +(let ((top-srcdir (canonicalize-path + (string-append (dirname (current-filename)) "/..")))) + (list + `((#:name . "cuirass") + (#:load-path-inputs . ("guix")) + (#:package-path-inputs . ()) + (#:proc-input . "cuirass") + (#:proc-file . "examples/guix-track-git.scm") + (#:proc . guix-jobs) + (#:proc-args (name . "cuirass") (url . ,cuirass-git)) + (#:inputs . (((#:name . "guix") + (#:url . "git://git.savannah.gnu.org/guix.git") + (#:load-path . ".") + (#:branch . "master") + (#:no-compile? . #t)) + ((#:name . "cuirass") + (#:url . ,(string-append "file://" top-srcdir)) + (#:load-path . ".") + (#:branch . "master") + (#:no-compile? . #t))))))) diff --git a/examples/hello-singleton.scm b/examples/hello-singleton.scm index 5ff2e82..a39191f 100644 --- a/examples/hello-singleton.scm +++ b/examples/hello-singleton.scm @@ -1,5 +1,6 @@ ;;; hello-singleton.scm -- job specification test for hello in master ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of Cuirass. ;;; @@ -16,18 +17,23 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>. -(define (local-file file) - ;; In the common case jobs will be defined relative to the repository. - ;; However for testing purpose use local gnu-system.scm instead. - (string-append (dirname (current-filename)) "/" file)) - (define hello-master - `((#:name . "guix") - (#:url . "git://git.savannah.gnu.org/guix.git") - (#:load-path . ".") - (#:file . ,(local-file "gnu-system.scm")) + '((#:name . "guix-master") + (#:load-path-inputs . ("guix")) + (#:package-path-inputs . ()) + (#:proc-input . "cuirass") + (#:proc-file . "examples/gnu-system.scm") (#:proc . hydra-jobs) - (#:arguments (subset . "hello")) - (#:branch . "master"))) + (#:proc-args (subset . "hello")) + (#:inputs . (((#:name . "guix") + (#:url . "git://git.savannah.gnu.org/guix.git") + (#:load-path . ".") + (#:branch . "master") + (#:no-compile? . #t)) + ((#:name . "cuirass") + (#:url . "https://git.savannah.gnu.org/git/guix/guix-cuirass.git") + (#:load-path . ".") + (#:branch . "master") + (#:no-compile? . #t)))))) (list hello-master) diff --git a/examples/hello-subset.scm b/examples/hello-subset.scm index 60764fc..8c0d990 100644 --- a/examples/hello-subset.scm +++ b/examples/hello-subset.scm @@ -1,5 +1,6 @@ ;;; hello-subset.scm -- job specification test for hello subset ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of Cuirass. ;;; @@ -16,28 +17,34 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>. -(define (local-file file) - ;; In the common case jobs will be defined relative to the repository. - ;; However for testing purpose use local gnu-system.scm instead. - (string-append (dirname (current-filename)) "/" file)) - -(define job-base - `((#:name . "guix") - (#:url . "git://git.savannah.gnu.org/guix.git") - (#:load-path . ".") - (#:file . ,(local-file "gnu-system.scm")) +(define (job-base key value) + `((#:name . ,(string-append "guix-" value)) + (#:load-path-inputs . ("guix")) + (#:package-path-inputs . ()) + (#:proc-input . "cuirass") + (#:proc-file . "examples/gnu-system.scm") (#:proc . hydra-jobs) - (#:arguments (subset . "hello")))) + (#:proc-args (subset . "hello")) + (#:inputs . (,(acons key value + '((#:name . "guix") + (#:url . "git://git.savannah.gnu.org/guix.git") + (#:load-path . ".") + (#:no-compile? . #t))) + ((#:name . "cuirass") + (#:url . "https://git.savannah.gnu.org/git/guix/guix-cuirass.git") + (#:load-path . ".") + (#:branch . "master") + (#:no-compile? . #t)))))) (define guix-master - (acons #:branch "master" job-base)) + (job-base #:branch "master")) (define guix-core-updates - (acons #:branch "core-updates" job-base)) + (job-base #:branch "core-updates")) -(define guix-0.10 - (acons #:tag "v0.10.0" job-base)) +(define guix-0.15 + (job-base #:tag "v0.15.0")) (list guix-master guix-core-updates - guix-0.10) + guix-0.15) diff --git a/examples/random-jobs.scm b/examples/random-jobs.scm index 78a09f4..6521734 100644 --- a/examples/random-jobs.scm +++ b/examples/random-jobs.scm @@ -1,5 +1,6 @@ ;;; random.scm -- Definition of the random build jobs ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of Cuirass. ;;; @@ -42,11 +43,11 @@ (mkdir #$output)))))) (define (make-random-jobs store arguments) - (let ((random (assq-ref arguments 'random))) + (let ((checkout (assq-ref arguments 'cuirass))) (format (current-error-port) "evaluating random jobs from directory ~s, commit ~s~%" - (assq-ref random 'file-name) - (assq-ref random 'revision))) + (assq-ref checkout 'file-name) + (assq-ref checkout 'revision))) (unfold (cut > <> 10) (lambda (i) diff --git a/examples/random.scm b/examples/random.scm index 820ac8d..37b97a2 100644 --- a/examples/random.scm +++ b/examples/random.scm @@ -1,5 +1,6 @@ ;;; random.scm -- Job specification that creates random build jobs ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; ;;; This file is part of Cuirass. ;;; @@ -20,10 +21,14 @@ (string-append (dirname (current-filename)) "/..")))) (list `((#:name . "random") - (#:url . ,(string-append "file://" top-srcdir)) - (#:branch . "master") - (#:no-compile? . #t) - (#:load-path . ".") + (#:load-path-inputs . ()) ;use the Guix shipped with Cuirass + (#:package-path-inputs . ()) + (#:proc-input . "cuirass") + (#:proc-file . "examples/random-jobs.scm") (#:proc . make-random-jobs) - (#:file . "examples/random-jobs.scm") - (#:arguments . ())))) + (#:proc-args . ()) + (#:inputs . (((#:name . "cuirass") + (#:url . ,(string-append "file://" top-srcdir)) + (#:load-path . ".") + (#:branch . "master") + (#:no-compile? . #t))))))) |