Files
fruix/tests/system/validate-phase16-freebsd-source.scm

70 lines
2.4 KiB
Scheme

(use-modules (fruix packages freebsd)
(ice-9 format))
(define (assert condition message . rest)
(unless condition
(apply error message rest)))
(define local-source
(freebsd-source
#:name "host-usr-src"
#:kind 'local-tree
#:path "/usr/src"))
(define git-source
(freebsd-source
#:name "stable15-git"
#:kind 'git
#:ref "stable/15"))
(define txz-source
(freebsd-source
#:name "release-15.0-txz"
#:kind 'src-txz
#:url "https://download.freebsd.org/releases/amd64/15.0-RELEASE/src.txz"
#:sha256 "example-sha256"))
(define git-base
(freebsd-base
#:name "git-base"
#:source git-source
#:source-root "/usr/src"))
(define txz-base
(freebsd-base
#:name "txz-base"
#:source txz-source
#:source-root "/usr/src"))
(assert (eq? (freebsd-source-kind local-source) 'local-tree)
"unexpected local source kind")
(assert (string=? (freebsd-source-path local-source) "/usr/src")
"unexpected local source path")
(assert (eq? (freebsd-source-kind git-source) 'git)
"unexpected git source kind")
(assert (string=? (freebsd-source-url git-source) "https://git.FreeBSD.org/src.git")
"unexpected default git source URL")
(assert (string=? (freebsd-source-ref git-source) "stable/15")
"unexpected git source ref")
(assert (eq? (freebsd-source-kind txz-source) 'src-txz)
"unexpected txz source kind")
(assert (string=? (freebsd-source-url txz-source)
"https://download.freebsd.org/releases/amd64/15.0-RELEASE/src.txz")
"unexpected txz source URL")
(assert (string=? (freebsd-source-sha256 txz-source) "example-sha256")
"unexpected txz source sha256")
(assert (freebsd-source? (freebsd-base-source git-base))
"git base did not preserve source record")
(assert (freebsd-source? (freebsd-base-source txz-base))
"txz base did not preserve source record")
(format #t "local_kind=~a~%" (freebsd-source-kind local-source))
(format #t "local_path=~a~%" (freebsd-source-path local-source))
(format #t "git_kind=~a~%" (freebsd-source-kind git-source))
(format #t "git_url=~a~%" (freebsd-source-url git-source))
(format #t "git_ref=~a~%" (freebsd-source-ref git-source))
(format #t "txz_kind=~a~%" (freebsd-source-kind txz-source))
(format #t "txz_url=~a~%" (freebsd-source-url txz-source))
(format #t "txz_sha256=~a~%" (freebsd-source-sha256 txz-source))
(format #t "base_source_accessor=ok~%")