job: Add 'commit' and 'tag' field to <job-spec>.

pull/3/head
Mathieu Lirzin 2016-07-01 16:46:10 +02:00
parent efef5c29c8
commit ca6b5d6677
3 changed files with 21 additions and 5 deletions

View File

@ -61,12 +61,16 @@ DIR if required."
(with-directory-excursion cachedir
(let ((name (job-spec-name spec))
(url (job-spec-url spec))
(branch (job-spec-branch spec)))
(branch (job-spec-branch spec))
(commit (job-spec-commit spec))
(tag (job-spec-tag spec)))
(or (file-exists? name) (system* "git" "clone" url name))
(with-directory-excursion name
(and (zero? (system* "git" "fetch"))
(zero? (system* "git" "reset" "--hard"
(string-append "origin/" branch))))))))
(or tag
commit
(string-append "origin/" branch)))))))))
(define (evaluate store db cachedir spec)
"Evaluate and build package derivations. Return a list a jobs."

View File

@ -33,6 +33,8 @@
job-spec-name
job-spec-url
job-spec-branch
job-spec-commit
job-spec-tag
job-spec-file
job-spec-proc
job-spec-arguments))
@ -56,14 +58,17 @@
metadata)))))
(define-record-type <job-spec>
(%make-job-spec name url branch file proc arguments)
(%make-job-spec name url branch commit file proc arguments)
job-spec?
(name job-spec-name) ;string
(url job-spec-url) ;string
(branch job-spec-branch) ;string
(commit job-spec-commit) ;string
(tag job-spec-tag) ;string
(file job-spec-file) ;string
(proc job-spec-proc) ;symbol
(arguments job-spec-arguments)) ;alist
(define* (make-job-spec #:key name url branch file proc arguments)
(%make-job-spec name url branch file proc arguments))
(define* (make-job-spec #:key name url commit tag file proc arguments
(branch "master"))
(%make-job-spec name url branch tag file proc arguments))

View File

@ -37,4 +37,11 @@
#:branch "core-updates"
#:file (local-file "gnu-system.scm")
#:proc 'hydra-jobs
#:arguments '((subset . "hello")))
(make-job-spec
#:name "guix"
#:url "git://git.savannah.gnu.org/guix.git"
#:tag "v0.9.0"
#:file (local-file "gnu-system.scm")
#:proc 'hydra-jobs
#:arguments '((subset . "hello"))))