transformations.scm 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016-2017, 2019-2023 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (test-transformations)
  20. #:use-module (guix tests)
  21. #:use-module (guix store)
  22. #:use-module ((guix gexp) #:select (lower-object))
  23. #:use-module ((guix profiles)
  24. #:select (package->manifest-entry
  25. manifest-entry-properties))
  26. #:use-module (guix derivations)
  27. #:use-module (guix packages)
  28. #:use-module (guix git-download)
  29. #:use-module (guix build-system)
  30. #:use-module (guix build-system gnu)
  31. #:use-module (guix transformations)
  32. #:use-module ((guix gexp)
  33. #:select (local-file? local-file-file
  34. computed-file? computed-file-gexp
  35. gexp-input-thing gexp->approximate-sexp))
  36. #:use-module (guix ui)
  37. #:use-module (guix utils)
  38. #:use-module (guix git)
  39. #:use-module (guix upstream)
  40. #:use-module (guix diagnostics)
  41. #:use-module (gnu packages)
  42. #:use-module (gnu packages base)
  43. #:use-module (gnu packages busybox)
  44. #:use-module (ice-9 match)
  45. #:use-module (srfi srfi-1)
  46. #:use-module (srfi srfi-26)
  47. #:use-module (srfi srfi-34)
  48. #:use-module (srfi srfi-64))
  49. (test-begin "transformations")
  50. (test-assert "options->transformation, no transformations"
  51. (let ((p (dummy-package "foo"))
  52. (t (options->transformation '())))
  53. (eq? (t p) p)))
  54. (test-assert "options->transformation, with-source"
  55. ;; Our pseudo-package is called 'guix.scm' so the 'guix.scm' source should
  56. ;; be applicable.
  57. (let* ((p (dummy-package "guix.scm"))
  58. (s (search-path %load-path "guix.scm"))
  59. (t (options->transformation `((with-source . ,s)))))
  60. (with-store store
  61. (let* ((new (t p))
  62. (source (run-with-store store
  63. (lower-object (package-source new)))))
  64. (and (not (eq? new p))
  65. (string=? source
  66. (add-to-store store "guix.scm" #t
  67. "sha256" s)))))))
  68. (test-assert "options->transformation, with-source, replacement"
  69. ;; Same, but this time the original package has a 'replacement' field. We
  70. ;; expect that replacement to be set to #f in the new package.
  71. (let* ((p (dummy-package "guix.scm" (replacement coreutils)))
  72. (s (search-path %load-path "guix.scm"))
  73. (t (options->transformation `((with-source . ,s)))))
  74. (let ((new (t p)))
  75. (and (not (eq? new p))
  76. (not (package-replacement new))))))
  77. (test-assert "options->transformation, with-source, with version"
  78. ;; Our pseudo-package is called 'guix.scm' so the 'guix.scm-2.0' source
  79. ;; should be applicable, and its version should be extracted.
  80. (let ((p (dummy-package "foo"))
  81. (s (search-path %load-path "guix.scm")))
  82. (call-with-temporary-directory
  83. (lambda (directory)
  84. (let* ((f (string-append directory "/foo-42.0.tar.gz"))
  85. (t (options->transformation `((with-source . ,f)))))
  86. (copy-file s f)
  87. (with-store store
  88. (let* ((new (t p))
  89. (source (run-with-store store
  90. (lower-object (package-source new)))))
  91. (and (not (eq? new p))
  92. (string=? (package-name new) (package-name p))
  93. (string=? (package-version new) "42.0")
  94. (string=? source
  95. (add-to-store store (basename f) #t
  96. "sha256" f))))))))))
  97. (test-assert "options->transformation, with-source, no matches"
  98. (let* ((p (dummy-package "foobar"))
  99. (s (search-path %load-path "guix.scm"))
  100. (t (options->transformation `((with-source . ,s)))))
  101. (eq? (package-source (t p))
  102. (package-source p))))
  103. (test-assert "options->transformation, with-source, PKG=URI"
  104. (let* ((p (dummy-package "foo"))
  105. (s (search-path %load-path "guix.scm"))
  106. (f (string-append "foo=" s))
  107. (t (options->transformation `((with-source . ,f)))))
  108. (with-store store
  109. (let* ((new (t p))
  110. (source (run-with-store store
  111. (lower-object (package-source new)))))
  112. (and (not (eq? new p))
  113. (string=? (package-name new) (package-name p))
  114. (string=? (package-version new)
  115. (package-version p))
  116. (string=? source
  117. (add-to-store store (basename s) #t
  118. "sha256" s)))))))
  119. (test-assert "options->transformation, with-source, PKG@VER=URI"
  120. (let* ((p (dummy-package "foo"))
  121. (s (search-path %load-path "guix.scm"))
  122. (f (string-append "foo@42.0=" s))
  123. (t (options->transformation `((with-source . ,f)))))
  124. (with-store store
  125. (let* ((new (t p))
  126. (source (run-with-store store
  127. (lower-object (package-source new)))))
  128. (and (not (eq? new p))
  129. (string=? (package-name new) (package-name p))
  130. (string=? (package-version new) "42.0")
  131. (string=? source
  132. (add-to-store store (basename s) #t
  133. "sha256" s)))))))
  134. (test-assert "options->transformation, with-source, in depth"
  135. (let* ((p0 (dummy-package "foo" (version "0.0")))
  136. (s (search-path %load-path "guix.scm"))
  137. (f (string-append "foo@42.0=" s))
  138. (t (options->transformation `((with-source . ,f))))
  139. (p1 (dummy-package "bar" (inputs (list p0))))
  140. (p2 (dummy-package "baz" (inputs (list p1)))))
  141. (with-store store
  142. (let ((new (t p2)))
  143. (and (not (eq? new p2))
  144. (match (package-inputs new)
  145. ((("bar" p1*))
  146. (match (package-inputs p1*)
  147. ((("foo" p0*))
  148. (and (not (eq? p0* p0))
  149. (string=? (package-name p0*) (package-name p0))
  150. (string=? (package-version p0*) "42.0")
  151. (string=? (add-to-store store (basename s) #t
  152. "sha256" s)
  153. (run-with-store store
  154. (lower-object
  155. (package-source p0*))))))))))))))
  156. (test-assert "options->transformation, with-input"
  157. (let* ((p (dummy-package "guix.scm"
  158. (inputs `(("foo" ,(specification->package "coreutils"))
  159. ("bar" ,(specification->package "grep"))
  160. ("baz" ,(dummy-package "chbouib"
  161. (native-inputs `(("x" ,grep)))))))))
  162. (t (options->transformation '((with-input . "coreutils=busybox")
  163. (with-input . "grep=findutils")))))
  164. (let ((new (t p)))
  165. (and (not (eq? new p))
  166. (match (package-inputs new)
  167. ((("foo" dep1) ("bar" dep2) ("baz" dep3))
  168. (and (string=? (package-full-name dep1)
  169. (package-full-name busybox))
  170. (string=? (package-full-name dep2)
  171. (package-full-name findutils))
  172. (string=? (package-name dep3) "chbouib")
  173. (match (package-native-inputs dep3)
  174. ((("x" dep))
  175. (string=? (package-full-name dep)
  176. (package-full-name findutils)))))))))))
  177. (test-assert "options->transformation, with-graft"
  178. (let* ((p (dummy-package "guix.scm"
  179. (inputs `(("foo" ,grep)
  180. ("bar" ,(dummy-package "chbouib"
  181. (native-inputs `(("x" ,grep)))))))))
  182. (t (options->transformation '((with-graft . "grep=findutils")))))
  183. (let ((new (t p)))
  184. (and (not (eq? new p))
  185. (match (package-inputs new)
  186. ((("foo" dep1) ("bar" dep2))
  187. (and (string=? (package-full-name dep1)
  188. (package-full-name grep))
  189. (string=? (package-full-name (package-replacement dep1))
  190. (package-full-name findutils))
  191. (string=? (package-name dep2) "chbouib")
  192. (match (package-native-inputs dep2)
  193. ((("x" dep))
  194. (with-store store
  195. (string=? (derivation-file-name
  196. (package-derivation store findutils))
  197. (derivation-file-name
  198. (package-derivation store dep)))))))))))))
  199. (test-equal "options->transformation, with-branch"
  200. (git-checkout (url "https://example.org")
  201. (branch "devel")
  202. (recursive? #t))
  203. (let* ((p (dummy-package "guix.scm"
  204. (inputs `(("foo" ,grep)
  205. ("bar" ,(dummy-package "chbouib"
  206. (source (origin
  207. (method git-fetch)
  208. (uri (git-reference
  209. (url "https://example.org")
  210. (commit "cabba9e")))
  211. (sha256 #f)))))))))
  212. (t (options->transformation '((with-branch . "chbouib=devel")))))
  213. (let ((new (t p)))
  214. (and (not (eq? new p))
  215. (match (package-inputs new)
  216. ((("foo" dep1) ("bar" dep2))
  217. (and (string=? (package-full-name dep1)
  218. (package-full-name grep))
  219. (string=? (package-name dep2) "chbouib")
  220. (package-source dep2))))))))
  221. (test-equal "options->transformation, with-commit"
  222. (git-checkout (url "https://example.org")
  223. (commit "abcdef")
  224. (recursive? #t))
  225. (let* ((p (dummy-package "guix.scm"
  226. (inputs `(("foo" ,grep)
  227. ("bar" ,(dummy-package "chbouib"
  228. (source (origin
  229. (method git-fetch)
  230. (uri (git-reference
  231. (url "https://example.org")
  232. (commit "cabba9e")))
  233. (sha256 #f)))))))))
  234. (t (options->transformation '((with-commit . "chbouib=abcdef")))))
  235. (let ((new (t p)))
  236. (and (not (eq? new p))
  237. (match (package-inputs new)
  238. ((("foo" dep1) ("bar" dep2))
  239. (and (string=? (package-full-name dep1)
  240. (package-full-name grep))
  241. (string=? (package-name dep2) "chbouib")
  242. (package-source dep2))))))))
  243. (test-equal "options->transformation, with-commit, version transformation"
  244. '("1.0" "1.0-rc1-2-gabc123" "git.abc123")
  245. (map (lambda (commit)
  246. (let* ((p (dummy-package "guix.scm"
  247. (inputs `(("foo" ,(dummy-package "chbouib"
  248. (source (origin
  249. (method git-fetch)
  250. (uri (git-reference
  251. (url "https://example.org")
  252. (commit "cabba9e")))
  253. (sha256 #f)))))))))
  254. (t (options->transformation
  255. `((with-commit . ,(string-append "chbouib=" commit))))))
  256. (let ((new (t p)))
  257. (and (not (eq? new p))
  258. (match (package-inputs new)
  259. ((("foo" dep1))
  260. (package-version dep1)))))))
  261. '("v1.0" "1.0-rc1-2-gabc123" "abc123")))
  262. (test-equal "options->transformation, with-git-url"
  263. (let ((source (git-checkout (url "https://example.org")
  264. (recursive? #t))))
  265. (list source source))
  266. (let* ((p (dummy-package "guix.scm"
  267. (inputs `(("foo" ,grep)
  268. ("bar" ,(dummy-package "chbouib"
  269. (native-inputs `(("x" ,grep)))))))))
  270. (t (options->transformation '((with-git-url . "grep=https://example.org")))))
  271. (let ((new (t p)))
  272. (and (not (eq? new p))
  273. (match (package-inputs new)
  274. ((("foo" dep1) ("bar" dep2))
  275. (and (string=? (package-full-name dep1)
  276. (package-full-name grep))
  277. (string=? (package-name dep2) "chbouib")
  278. (match (package-native-inputs dep2)
  279. ((("x" dep3))
  280. (map package-source (list dep1 dep3)))))))))))
  281. (test-equal "options->transformation, with-git-url + with-branch"
  282. ;; Combine the two options and make sure the 'with-branch' transformation
  283. ;; comes after the 'with-git-url' transformation.
  284. (let ((source (git-checkout (url "https://example.org")
  285. (branch "BRANCH")
  286. (recursive? #t))))
  287. (list source source))
  288. (let* ((p (dummy-package "guix.scm"
  289. (inputs `(("foo" ,grep)
  290. ("bar" ,(dummy-package "chbouib"
  291. (native-inputs `(("x" ,grep)))))))))
  292. (t (options->transformation
  293. (reverse '((with-git-url
  294. . "grep=https://example.org")
  295. (with-branch . "grep=BRANCH"))))))
  296. (let ((new (t p)))
  297. (and (not (eq? new p))
  298. (match (package-inputs new)
  299. ((("foo" dep1) ("bar" dep2))
  300. (and (string=? (package-name dep1) "grep")
  301. (string=? (package-name dep2) "chbouib")
  302. (match (package-native-inputs dep2)
  303. ((("x" dep3))
  304. (map package-source (list dep1 dep3)))))))))))
  305. (define* (depends-on-toolchain? p #:optional (toolchain "gcc-toolchain"))
  306. "Return true if P depends on TOOLCHAIN instead of the default tool chain."
  307. (define toolchain-packages
  308. '("gcc" "binutils" "glibc" "ld-wrapper"))
  309. (define (package-name* obj)
  310. (and (package? obj) (package-name obj)))
  311. (match (bag-build-inputs (package->bag p))
  312. (((_ (= package-name* packages) . _) ...)
  313. (and (not (any (cut member <> packages) toolchain-packages))
  314. (member toolchain packages)))))
  315. (test-assert "options->transformation, with-c-toolchain"
  316. (let* ((dep0 (dummy-package "chbouib"
  317. (build-system gnu-build-system)
  318. (native-inputs `(("y" ,grep)))))
  319. (dep1 (dummy-package "stuff"
  320. (native-inputs `(("x" ,dep0)))))
  321. (p (dummy-package "thingie"
  322. (build-system gnu-build-system)
  323. (inputs `(("foo" ,grep)
  324. ("bar" ,dep1)))))
  325. (t (options->transformation
  326. '((with-c-toolchain . "chbouib=gcc-toolchain")))))
  327. ;; Here we check that the transformation applies to DEP0 and all its
  328. ;; dependents: DEP0 must use GCC-TOOLCHAIN, DEP1 must use GCC-TOOLCHAIN
  329. ;; and the DEP0 that uses GCC-TOOLCHAIN, and so on.
  330. (let ((new (t p)))
  331. (and (depends-on-toolchain? new "gcc-toolchain")
  332. (match (bag-build-inputs (package->bag new))
  333. ((("foo" dep0) ("bar" dep1) _ ...)
  334. (and (depends-on-toolchain? dep1 "gcc-toolchain")
  335. (not (depends-on-toolchain? dep0 "gcc-toolchain"))
  336. (string=? (package-full-name dep0)
  337. (package-full-name grep))
  338. (match (bag-build-inputs (package->bag dep1))
  339. ((("x" dep) _ ...)
  340. (and (depends-on-toolchain? dep "gcc-toolchain")
  341. (match (bag-build-inputs (package->bag dep))
  342. ((("y" dep) _ ...) ;this one is unchanged
  343. (eq? dep grep)))))))))))))
  344. (test-equal "options->transformation, with-c-toolchain twice"
  345. (package-full-name grep)
  346. (let* ((dep0 (dummy-package "chbouib"))
  347. (dep1 (dummy-package "stuff"))
  348. (p (dummy-package "thingie"
  349. (build-system gnu-build-system)
  350. (inputs `(("foo" ,dep0)
  351. ("bar" ,dep1)
  352. ("baz" ,grep)))))
  353. (t (options->transformation
  354. '((with-c-toolchain . "chbouib=clang-toolchain")
  355. (with-c-toolchain . "stuff=clang-toolchain")))))
  356. (let ((new (t p)))
  357. (and (depends-on-toolchain? new "clang-toolchain")
  358. (match (bag-build-inputs (package->bag new))
  359. ((("foo" dep0) ("bar" dep1) ("baz" dep2) _ ...)
  360. (and (depends-on-toolchain? dep0 "clang-toolchain")
  361. (depends-on-toolchain? dep1 "clang-toolchain")
  362. (not (depends-on-toolchain? dep2 "clang-toolchain"))
  363. (package-full-name dep2))))))))
  364. (test-assert "options->transformation, with-c-toolchain, no effect"
  365. (let ((p (dummy-package "thingie"))
  366. (t (options->transformation
  367. '((with-c-toolchain . "does-not-exist=gcc-toolchain")))))
  368. ;; When it has no effect, '--with-c-toolchain' returns P.
  369. (eq? (t p) p)))
  370. (test-equal "options->transformation, with-debug-info"
  371. '(#:strip-binaries? #f)
  372. (let* ((dep (dummy-package "chbouib"))
  373. (p (dummy-package "thingie"
  374. (build-system gnu-build-system)
  375. (inputs `(("foo" ,dep)
  376. ("bar" ,grep)))))
  377. (t (options->transformation
  378. '((with-debug-info . "chbouib")))))
  379. (let ((new (t p)))
  380. (match (package-inputs new)
  381. ((("foo" dep0) ("bar" dep1))
  382. (and (string=? (package-full-name dep1)
  383. (package-full-name grep))
  384. (package-arguments (package-replacement dep0))))))))
  385. (test-equal "options->transformation, with-configure-flag"
  386. '(append '() '("--flag=42"))
  387. (let* ((p (dummy-package "foo"
  388. (build-system gnu-build-system)))
  389. (t (options->transformation
  390. '((with-configure-flag . "foo=--flag=42")))))
  391. (let ((new (t p)))
  392. (match (package-arguments new)
  393. ((#:configure-flags flags)
  394. (gexp->approximate-sexp flags))))))
  395. (test-assert "options->transformation, without-tests"
  396. (let* ((dep (dummy-package "dep"))
  397. (p (dummy-package "foo"
  398. (inputs `(("dep" ,dep)))))
  399. (t (options->transformation '((without-tests . "dep")
  400. (without-tests . "tar")))))
  401. (let ((new (t p)))
  402. (match (bag-direct-inputs (package->bag new))
  403. ((("dep" dep) ("tar" tar) _ ...)
  404. (and (equal? (package-arguments dep) '(#:tests? #f))
  405. (match (memq #:tests? (package-arguments tar))
  406. ((#:tests? #f _ ...) #t))))))))
  407. (test-equal "options->transformation, with-patch"
  408. (search-patches "glibc-locales.patch" "guile-relocatable.patch")
  409. (let* ((dep (dummy-package "dep"
  410. (source (dummy-origin))))
  411. (p (dummy-package "foo"
  412. (inputs `(("dep" ,dep)))))
  413. (patch1 (search-patch "glibc-locales.patch"))
  414. (patch2 (search-patch "guile-relocatable.patch"))
  415. (t (options->transformation
  416. `((with-patch . ,(string-append "dep=" patch1))
  417. (with-patch . ,(string-append "dep=" patch2))
  418. (with-patch . ,(string-append "tar=" patch1))))))
  419. (let ((new (t p)))
  420. (match (bag-direct-inputs (package->bag new))
  421. ((("dep" dep) ("tar" tar) _ ...)
  422. (and (member patch1
  423. (filter-map (lambda (patch)
  424. (and (local-file? patch)
  425. (local-file-file patch)))
  426. (origin-patches (package-source tar))))
  427. (map local-file-file
  428. (origin-patches (package-source dep)))))))))
  429. (test-equal "options->transformation, with-commit + with-patch"
  430. '(#t #t)
  431. (let* ((patch (search-patch "glibc-locales.patch"))
  432. (commit "f8934ec94df5868ee8baf1fb0f8ed0f24e7e91eb")
  433. (t (options->transformation
  434. ;; Note: options are applied in reverse order, so
  435. ;; 'with-patch' comes on top.
  436. `((with-patch . ,(string-append "guile-gcrypt=" patch))
  437. (with-commit
  438. . ,(string-append "guile-gcrypt=" commit))))))
  439. (let ((new (t (@ (gnu packages gnupg) guile-gcrypt))))
  440. (match (package-source new)
  441. ((? computed-file? source)
  442. (let* ((gexp (computed-file-gexp source))
  443. (inputs (map gexp-input-thing
  444. ((@@ (guix gexp) gexp-inputs) gexp))))
  445. (list (any (lambda (input)
  446. (and (git-checkout? input)
  447. (string=? commit (git-checkout-commit input))))
  448. inputs)
  449. (any (lambda (input)
  450. (and (local-file? input)
  451. (string=? (local-file-file input) patch)))
  452. inputs))))))))
  453. (test-equal "options->transformation, property order"
  454. ;; See <https://issues.guix.gnu.org/54942>.
  455. '((with-debug-info . "does-not-exist")
  456. (with-commit . "does-not-exist=aaaaaaa")
  457. (without-tests . "does-not-exist"))
  458. (let* ((t (options->transformation
  459. '((with-debug-info . "does-not-exist")
  460. (with-commit . "does-not-exist=aaaaaaa")
  461. (without-tests . "does-not-exist")))))
  462. (let ((new (t coreutils)))
  463. (assq-ref (package-properties new) 'transformations))))
  464. (test-equal "options->transformation, with-latest"
  465. "42.0"
  466. (mock ((guix upstream) %updaters
  467. (delay (list (upstream-updater
  468. (name 'dummy)
  469. (pred (const #t))
  470. (description "")
  471. (import (const (upstream-source
  472. (package "foo")
  473. (version "42.0")
  474. (urls '("http://example.org")))))))))
  475. (let* ((p (dummy-package "foo" (version "1.0")))
  476. (t (options->transformation
  477. `((with-latest . "foo")))))
  478. (package-version (t p)))))
  479. (test-equal "options->transformation, with-version"
  480. "1.0"
  481. (mock ((guix upstream) %updaters
  482. (delay (list (upstream-updater
  483. (name 'dummy)
  484. (pred (const #t))
  485. (description "")
  486. (import (const (upstream-source
  487. (package "foo")
  488. (version "1.0")
  489. (urls '("http://example.org")))))))))
  490. (let* ((p0 (dummy-package "foo" (version "7.7")))
  491. (p1 (dummy-package "bar" (inputs (list p0))))
  492. (t (options->transformation
  493. `((with-version . "foo=1.0")))))
  494. (package-version (lookup-package-input (t p1) "foo")))))
  495. (test-equal "options->transformation, tune"
  496. '(cpu-tuning . "superfast")
  497. (let* ((p0 (dummy-package "p0"))
  498. (p1 (dummy-package "p1"
  499. (inputs `(("p0" ,p0)))
  500. (properties '((tunable? . #t)))))
  501. (p2 (dummy-package "p2"
  502. (inputs `(("p1" ,p1)))))
  503. (t (options->transformation '((tune . "superfast"))))
  504. (p3 (t p2)))
  505. (and (not (package-replacement p3))
  506. (match (package-inputs p3)
  507. ((("p1" tuned))
  508. (match (package-inputs tuned)
  509. ((("p0" p0))
  510. (and (not (package-replacement p0))
  511. (assq 'cpu-tuning
  512. (package-properties
  513. (package-replacement tuned)))))))))))
  514. (test-assert "options->transformations, tune, wrong micro-architecture"
  515. (let ((p (dummy-package "tunable"
  516. (properties '((tunable? . #t)))))
  517. (t (options->transformation '((tune . "nonexistent-superfast")))))
  518. ;; Because GCC used by P's build system does not support
  519. ;; '-march=nonexistent-superfast', we should see an error when lowering
  520. ;; the tuned package.
  521. (guard (c ((formatted-message? c)
  522. (member "nonexistent-superfast"
  523. (formatted-message-arguments c))))
  524. (package->bag (t p))
  525. #f)))
  526. (test-equal "options->transformation + package->manifest-entry"
  527. '((transformations . ((without-tests . "foo"))))
  528. (let* ((p (dummy-package "foo"))
  529. (t (options->transformation '((without-tests . "foo"))))
  530. (e (package->manifest-entry (t p))))
  531. (manifest-entry-properties e)))
  532. (test-end)
  533. ;;; Local Variables:
  534. ;;; eval: (put 'dummy-package 'scheme-indent-function 1)
  535. ;;; End: