diff options
| author | Romain GARBAGE <romain.garbage@inria.fr> | 2025-04-25 10:32:20 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2025-05-05 12:15:47 +0200 |
| commit | 79bc4ebb332d30c31913164b18105c6d8e637c7a (patch) | |
| tree | cf7a54cb09806123e2c885a412561cfaef6c54cd /tests/transformations.scm | |
| parent | 63088c295d81cc3d0e808c478d4fe479a2c90102 (diff) | |
transformations: Git source transformations honour RECURSIVE?.
* guix/transformations.scm (package-git-url+recursive?): New variable.
(package-git-url): Remove variable.
(evaluate-git-replacement-specs): Use package-git-url+recursive?.
(transform-package-source-branch, transform-package-source-commit, transform-package-source-git-url): Update
according to changes above.
* doc/guix.texi (Package Transformation Options): Update documentation.
* tests/transformations.scm: Update tests. Add tests for RECURSIVE?
inheritance with WITH-COMMIT and WITH-SOURCE.
Change-Id: Id6a5e6957a9955c8173b06b3e14f2986c6dfc4bc
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests/transformations.scm')
| -rw-r--r-- | tests/transformations.scm | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/tests/transformations.scm b/tests/transformations.scm index 5285d98f17e..9f5aacc41b4 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm | |||
| @@ -217,6 +217,28 @@ | |||
| 217 | 217 | ||
| 218 | (test-equal "options->transformation, with-branch" | 218 | (test-equal "options->transformation, with-branch" |
| 219 | (git-checkout (url "https://example.org") | 219 | (git-checkout (url "https://example.org") |
| 220 | (branch "devel")) | ||
| 221 | (let* ((p (dummy-package "guix.scm" | ||
| 222 | (inputs `(("foo" ,grep) | ||
| 223 | ("bar" ,(dummy-package "chbouib" | ||
| 224 | (source (origin | ||
| 225 | (method git-fetch) | ||
| 226 | (uri (git-reference | ||
| 227 | (url "https://example.org") | ||
| 228 | (commit "cabba9e"))) | ||
| 229 | (sha256 #f))))))))) | ||
| 230 | (t (options->transformation '((with-branch . "chbouib=devel"))))) | ||
| 231 | (let ((new (t p))) | ||
| 232 | (and (not (eq? new p)) | ||
| 233 | (match (package-inputs new) | ||
| 234 | ((("foo" dep1) ("bar" dep2)) | ||
| 235 | (and (string=? (package-full-name dep1) | ||
| 236 | (package-full-name grep)) | ||
| 237 | (string=? (package-name dep2) "chbouib") | ||
| 238 | (package-source dep2)))))))) | ||
| 239 | |||
| 240 | (test-equal "options->transformation, with-branch, recursive? inheritance" | ||
| 241 | (git-checkout (url "https://example.org") | ||
| 220 | (branch "devel") | 242 | (branch "devel") |
| 221 | (recursive? #t)) | 243 | (recursive? #t)) |
| 222 | (let* ((p (dummy-package "guix.scm" | 244 | (let* ((p (dummy-package "guix.scm" |
| @@ -226,7 +248,8 @@ | |||
| 226 | (method git-fetch) | 248 | (method git-fetch) |
| 227 | (uri (git-reference | 249 | (uri (git-reference |
| 228 | (url "https://example.org") | 250 | (url "https://example.org") |
| 229 | (commit "cabba9e"))) | 251 | (commit "cabba9e") |
| 252 | (recursive? #t))) | ||
| 230 | (sha256 #f))))))))) | 253 | (sha256 #f))))))))) |
| 231 | (t (options->transformation '((with-branch . "chbouib=devel"))))) | 254 | (t (options->transformation '((with-branch . "chbouib=devel"))))) |
| 232 | (let ((new (t p))) | 255 | (let ((new (t p))) |
| @@ -240,6 +263,28 @@ | |||
| 240 | 263 | ||
| 241 | (test-equal "options->transformation, with-commit" | 264 | (test-equal "options->transformation, with-commit" |
| 242 | (git-checkout (url "https://example.org") | 265 | (git-checkout (url "https://example.org") |
| 266 | (commit "abcdef")) | ||
| 267 | (let* ((p (dummy-package "guix.scm" | ||
| 268 | (inputs `(("foo" ,grep) | ||
| 269 | ("bar" ,(dummy-package "chbouib" | ||
| 270 | (source (origin | ||
| 271 | (method git-fetch) | ||
| 272 | (uri (git-reference | ||
| 273 | (url "https://example.org") | ||
| 274 | (commit "cabba9e"))) | ||
| 275 | (sha256 #f))))))))) | ||
| 276 | (t (options->transformation '((with-commit . "chbouib=abcdef"))))) | ||
| 277 | (let ((new (t p))) | ||
| 278 | (and (not (eq? new p)) | ||
| 279 | (match (package-inputs new) | ||
| 280 | ((("foo" dep1) ("bar" dep2)) | ||
| 281 | (and (string=? (package-full-name dep1) | ||
| 282 | (package-full-name grep)) | ||
| 283 | (string=? (package-name dep2) "chbouib") | ||
| 284 | (package-source dep2)))))))) | ||
| 285 | |||
| 286 | (test-equal "options->transformation, with-commit, recursive? inheritance" | ||
| 287 | (git-checkout (url "https://example.org") | ||
| 243 | (commit "abcdef") | 288 | (commit "abcdef") |
| 244 | (recursive? #t)) | 289 | (recursive? #t)) |
| 245 | (let* ((p (dummy-package "guix.scm" | 290 | (let* ((p (dummy-package "guix.scm" |
| @@ -249,7 +294,8 @@ | |||
| 249 | (method git-fetch) | 294 | (method git-fetch) |
| 250 | (uri (git-reference | 295 | (uri (git-reference |
| 251 | (url "https://example.org") | 296 | (url "https://example.org") |
| 252 | (commit "cabba9e"))) | 297 | (commit "cabba9e") |
| 298 | (recursive? #t))) | ||
| 253 | (sha256 #f))))))))) | 299 | (sha256 #f))))))))) |
| 254 | (t (options->transformation '((with-commit . "chbouib=abcdef"))))) | 300 | (t (options->transformation '((with-commit . "chbouib=abcdef"))))) |
| 255 | (let ((new (t p))) | 301 | (let ((new (t p))) |
