aboutsummaryrefslogtree
aboutsummaryrefslogtreecommit2022-02-09make resource dependency specifier an objectWojtek Kosior
2022-02-09rework Hydrilla to use a separate tool for building its source packagesWojtek Kosior
* Hydrilla now depends on "Hydrilla builder" developed at: https://git.koszko.org/hydrilla-builder/ * Hydrilla repository is now REUSE-compliant * The debian packaging is temporarily not tested and likely to be broken * JSON schemas are now in use (through 'jsonschema' Python library) * This is not yet a release and some minor changes to the API on-fisk format are going to occur before that
quot;) (call-with-test-package '((inputs `(("GMP" ,gmp) ("Mpfr" ,mpfr))) (arguments ;"trivial" arguments '(#:tests? #f #:test-target "whatever"))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "inputs" "--input-simplification=safe") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs))))) (test-equal "input labels, 'safe' policy, nothing changed" (list `(("GMP" ,gmp) ("ACL" ,acl)) "\ (inputs `((\"GMP\" ,gmp) (\"ACL\" ,acl)))\n") (call-with-test-package '((inputs `(("GMP" ,gmp) ("ACL" ,acl))) ;; Non-empty argument list, so potentially unsafe ;; input simplification. (arguments '(#:configure-flags (assoc-ref %build-inputs "GMP")))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "inputs" "--input-simplification=safe") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs))))) (test-equal "input labels, margin comment" (list `(("gmp" ,gmp)) `(("acl" ,acl)) " (inputs (list gmp)) ;margin comment\n" " (native-inputs (list acl)) ;another one\n") (call-with-test-package '((inputs `(("gmp" ,gmp))) (native-inputs `(("acl" ,acl)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file (("\"gmp\"(.*)$" _ rest) (string-append "\"gmp\"" (string-trim-right rest) " ;margin comment\n")) (("\"acl\"(.*)$" _ rest) (string-append "\"acl\"" (string-trim-right rest) " ;another one\n"))) (system* "cat" file) (system* "guix" "style" "-L" directory "-S" "inputs" "my-coreutils") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (package-native-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs) (read-package-field (@ (my-packages) my-coreutils) 'native-inputs))))) (test-equal "input labels, margin comment on long list" (list (concatenate (make-list 4 `(("gmp" ,gmp) ("acl" ,acl)))) "\ (list gmp ;margin comment acl gmp ;margin comment acl gmp ;margin comment acl gmp ;margin comment acl))\n") (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) ("gmp" ,gmp) ("acl" ,acl) ("gmp" ,gmp) ("acl" ,acl) ("gmp" ,gmp) ("acl" ,acl)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file (("\"gmp\"(.*)$" _ rest) (string-append "\"gmp\"" (string-trim-right rest) " ;margin comment\n"))) (system* "cat" file) (system* "guix" "style" "-L" directory "-S" "inputs" "my-coreutils") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs 8))))) (test-equal "input labels, line comment" (list `(("gmp" ,gmp) ("acl" ,acl)) "\ (inputs (list gmp ;; line comment! acl))\n") (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file ((",gmp\\)(.*)$" _ rest) (string-append ",gmp)\n ;; line comment!\n" rest))) (system* "guix" "style" "-L" directory "-S" "inputs" "my-coreutils") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs 3))))) (test-equal "input labels, modify-inputs and margin comment" (list `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr)) "\ (modify-inputs (package-propagated-inputs coreutils) (prepend gmp ;margin comment acl ;another one mpfr)))\n") (call-with-test-package '((inputs `(("gmp" ,gmp) ("acl" ,acl) ("mpfr" ,mpfr) ,@(package-propagated-inputs coreutils)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file ((",gmp\\)(.*)$" _ rest) (string-append ",gmp) ;margin comment" rest)) ((",acl\\)(.*)$" _ rest) (string-append ",acl) ;another one" rest))) (system* "guix" "style" "-L" directory "-S" "inputs" "my-coreutils") (load file) (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs 4))))) (test-assert "gexpify arguments, already gexpified" (call-with-test-package '((arguments (list #:configure-flags #~'("--help")))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (define (fingerprint file) (let ((stat (stat file))) (list (stat:mtime stat) (stat:size stat)))) (define before (fingerprint file)) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "arguments") (equal? (fingerprint file) before)))) (test-equal "gexpify arguments, non-gexp arguments, margin comment" (list (list #:tests? #f #:test-target "check") "\ (arguments (list #:tests? #f ;no tests #:test-target \"check\"))\n") (call-with-test-package '((arguments '(#:tests? #f #:test-target "check"))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file (("#:tests\\? #f" all) (string-append all " ;no tests\n"))) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "arguments") (load file) (list (package-arguments (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'arguments 2))))) (test-equal "gexpify arguments, phases and flags" "\ (list #:tests? #f #:configure-flags #~'(\"--fast\") #:make-flags #~(list (string-append \"CC=\" #$(cc-for-target))) #:phases #~(modify-phases %standard-phases ;; Line comment. whatever)))\n" (call-with-test-package '((arguments `(#:tests? #f #:configure-flags '("--fast") #:make-flags (list (string-append "CC=" ,(cc-for-target))) #:phases (modify-phases %standard-phases whatever)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (substitute* file (("whatever") "\n;; Line comment. whatever")) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "arguments") (load file) (read-package-field (@ (my-packages) my-coreutils) 'arguments 7)))) (test-equal "gexpify arguments, append arguments" "\ (append (list #:tests? #f #:configure-flags #~'(\"--fast\")) (package-arguments coreutils)))\n" (call-with-test-package '((arguments `(#:tests? #f #:configure-flags '("--fast") ,@(package-arguments coreutils)))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "arguments") (load file) (read-package-field (@ (my-packages) my-coreutils) 'arguments 3)))) (test-equal "gexpify arguments, substitute-keyword-arguments" "\ (substitute-keyword-arguments (package-arguments coreutils) ((#:tests? _ #f) #t) ((#:make-flags flags #~'()) #~(cons \"-DXYZ=yes\" #$flags))))\n" (call-with-test-package '((arguments (substitute-keyword-arguments (package-arguments coreutils) ((#:tests? _ #f) #t) ((#:make-flags flags ''()) `(cons "-DXYZ=yes" ,flags))))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "arguments") (load file) (read-package-field (@ (my-packages) my-coreutils) 'arguments 7)))) (test-equal "gexpify arguments, substitute-keyword-arguments + unquote-splicing" "\ (substitute-keyword-arguments (package-arguments coreutils) ((#:make-flags flags #~'()) #~(cons \"-DXYZ=yes\" #$@(if #t flags '())))))\n" (call-with-test-package '((arguments (substitute-keyword-arguments (package-arguments coreutils) ((#:make-flags flags ''()) `(cons "-DXYZ=yes" ,@(if #t flags '())))))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "arguments") (load file) (read-package-field (@ (my-packages) my-coreutils) 'arguments 6)))) (test-equal "gexpify arguments, append substitute-keyword-arguments" "\ (append (list #:tests? #f) (substitute-keyword-arguments (package-arguments coreutils) ((#:make-flags flags) #~(append `(\"-n\" ,%output) #$flags)))))\n" (call-with-test-package '((arguments `(#:tests? #f ,@(substitute-keyword-arguments (package-arguments coreutils) ((#:make-flags flags) `(append `("-n" ,%output) ,flags)))))) (lambda (directory) (define file (string-append directory "/my-packages.scm")) (system* "guix" "style" "-L" directory "my-coreutils" "-S" "arguments") (load file) (read-package-field (@ (my-packages) my-coreutils) 'arguments 5)))) (test-end) ;; Local Variables: ;; eval: (put 'with-test-package 'scheme-indent-function 1) ;; eval: (put 'call-with-test-package 'scheme-indent-function 1) ;; End: