From 08d4a34d8d90add70915bab5017fb167ad3b93d3 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Fri, 7 Aug 2020 14:32:42 +0200 Subject: [PATCH] Load new per-release index manifests (#479) * Migrate testsuite indexes to new split manifests * Alire.Index: update community version * Refactor Alr.OS_Lib.Traverse_Folder into Alire As Alire.Directories.Traverse_Tree * Alire.TOML_Index: traverse new folder structure Also adapt the checks to the new structure, and double-check that the file name matches the manifest contents (name, version). * Refactor Crate internals for new flat manifests Since now each release is truly independent, crates need not to store the common information as previously. This is done now only for external definitions in a narrower scope. Several loading functions can also be streamlined since now it's simpler to get a proper complete release without requiring its enclosing crate. The bulk of the refactoring emanates from merging Alire.Crates.With_Releases into simply Alire.Crates, and repurposing the Alire.Crates.Sections enum. * Use new [[depends-on]] dependencies Nothing outwards has changed yet; the manifest is still entirely machine generated. This commit only changes the table [depends-on] into an array of [[depends-on]] tables. * Testsuite fixes for new format Fixes in code detected by the testsuite, and small changes in output due to code refactorings. * New tests for index structure * Review cleanup Assorted minor refactors * Code review: restore lost comments in testsuite --- src/alire/alire-containers.ads | 2 +- src/alire/alire-crates-containers.ads | 7 +- src/alire/alire-crates-with_releases.adb | 267 ---------- src/alire/alire-crates-with_releases.ads | 66 --- src/alire/alire-crates.adb | 272 +++++++++- src/alire/alire-crates.ads | 108 +++- src/alire/alire-dependencies-states.adb | 33 +- src/alire/alire-dependencies.ads | 1 + src/alire/alire-directories.adb | 40 ++ src/alire/alire-directories.ads | 9 + src/alire/alire-externals.adb | 25 +- src/alire/alire-index.adb | 68 ++- src/alire/alire-index.ads | 29 +- src/alire/alire-origins-tweaks.adb | 40 +- src/alire/alire-policies.ads | 17 + src/alire/alire-properties-from_toml.ads | 111 +++-- src/alire/alire-properties-labeled.adb | 12 +- src/alire/alire-properties-labeled.ads | 30 +- src/alire/alire-releases.adb | 183 ++++--- src/alire/alire-releases.ads | 45 +- src/alire/alire-root.adb | 4 +- src/alire/alire-roots.adb | 3 +- src/alire/alire-solutions.adb | 4 +- src/alire/alire-solver.adb | 2 +- src/alire/alire-toml_adapters.adb | 12 + src/alire/alire-toml_adapters.ads | 3 + src/alire/alire-toml_expressions-cases.ads | 2 +- src/alire/alire-toml_expressions.ads | 2 +- src/alire/alire-toml_index.adb | 466 +++++++----------- src/alire/alire-toml_index.ads | 23 +- src/alire/alire-toml_keys.ads | 2 + src/alire/alire-toml_load.adb | 111 ++++- src/alire/alire-toml_load.ads | 23 +- src/alire/alire-types.ads | 2 +- src/alire/alire.ads | 2 +- src/alr/alr-bootstrap.ads | 6 +- src/alr/alr-commands-get.adb | 2 +- src/alr/alr-commands-search.adb | 10 +- src/alr/alr-commands-show.adb | 7 +- src/alr/alr-commands-test.adb | 9 +- src/alr/alr-os_lib.adb | 36 -- src/alr/alr-os_lib.ads | 10 - src/alr/alr.ads | 3 - testsuite/drivers/alr.py | 4 +- testsuite/fix-versions.sh | 4 +- testsuite/fixtures/basic_index/he/hello.toml | 25 - .../basic_index/he/hello/hello-1.0.0.toml | 14 + .../basic_index/he/hello/hello-1.0.1.toml | 14 + testsuite/fixtures/basic_index/index.toml | 2 +- .../fixtures/basic_index/li/libhello.toml | 14 - .../li/libhello/libhello-1.0.0.toml | 13 + .../ma/make/make-external.toml} | 6 +- testsuite/fixtures/cases_index/he/hello.toml | 54 -- .../cases_index/he/hello/hello-1.0.1.toml | 55 +++ testsuite/fixtures/cases_index/index.toml | 2 +- .../fixtures/cases_index/li/libhello.toml | 34 -- .../li/libhello/libhello-1.0.0-linuxonly.toml | 13 + .../li/libhello/libhello-1.0.0-unavail.toml | 8 + .../li/libhello/libhello-1.0.0.toml | 7 + .../li/libhello/libhello-external.toml | 18 + testsuite/fixtures/checked_index/index.toml | 2 +- .../fixtures/checked_index/li/libhello.toml | 17 - .../li/libhello/libhello-1.0.0-git.toml | 8 + .../li/libhello/libhello-1.0.0-gitbad.toml | 8 + .../li/libhello/libhello-1.0.0-tarball.toml | 8 + testsuite/fixtures/git_index/index.toml | 2 +- .../libfoo-1.0.0-git.toml} | 7 +- testsuite/fixtures/native_index/index.toml | 2 +- .../fixtures/native_index/li/libhello.toml | 12 - .../libhello-0.9.0-test-unav-native.toml | 10 + .../li/libhello/libhello-1.0.0.toml | 7 + .../ma/make/make-external.toml} | 4 +- testsuite/fixtures/run_index/index.toml | 2 +- testsuite/fixtures/run_index/no/noop.toml | 19 - .../run_index/no/noop/noop-1.0.0-default.toml | 8 + .../run_index/no/noop/noop-1.0.0-multi.toml | 9 + .../run_index/no/noop/noop-1.0.0-nondef.toml | 9 + testsuite/fixtures/solver_index/he/hello.toml | 40 -- .../solver_index/he/hello/hello-1.0.0.toml | 12 + .../solver_index/he/hello/hello-1.0.1.toml | 13 + .../solver_index/he/hello/hello-2.0.0.toml | 14 + .../solver_index/he/hello/hello-3.0.0.toml | 13 + .../solver_index/he/hello/hello-4.0.0.toml | 14 + testsuite/fixtures/solver_index/index.toml | 2 +- .../fixtures/solver_index/li/libhello.toml | 17 - .../li/libhello/libhello-1.0.0.toml | 7 + .../li/libhello/libhello-1.0.1.toml | 7 + .../li/libhello/libhello-1.1.0.toml | 7 + .../li/libhello/libhello-2.0.0.toml | 7 + .../ma/{make.toml => make/make-external.toml} | 4 +- .../superhello-1.0.0.toml} | 16 +- .../cr/{crate.toml => crate/crate-1.0.0.toml} | 7 +- .../local-index/my_index/index/index.toml | 2 +- .../basic/my_index/index/index.toml | 1 - .../my_index/index/li/libhello_nogprwith.toml | 11 - .../my_index/index/gp/gpr_in_subdir.toml | 12 - .../gpr_in_subdir/my_index/index/index.toml | 1 - .../index/ba/{bad.toml => bad/bad-1.0.0.toml} | 9 +- .../go/{good.toml => good/good-1.0.0.toml} | 9 +- .../tests/get/build/my_index/index/index.toml | 2 +- .../my_index/index.toml | 1 + .../my_index/index/index.toml | 1 - .../ma/main.toml => ma/main/main-1.0.0.toml} | 15 +- .../make.toml => ma/make/make-external.toml} | 6 +- .../indirect-link/my_index/index/index.toml | 2 +- .../ti/{tier1.toml => tier1/tier1-1.0.0.toml} | 12 +- .../ti/{tier2.toml => tier2/tier2-1.0.0.toml} | 12 +- .../ti/{tier3.toml => tier3/tier3-1.0.0.toml} | 12 +- .../my_index/index/he/hello_world.toml | 12 - .../he/hello_world/hello_world-0.1.0.toml | 10 + .../my_index/index/index.toml | 2 +- .../tests/index/bad-action-command/test.py | 2 +- .../my_index/index/index.toml | 2 +- .../my_index/index/he/hello_world.toml | 8 - .../he/hello_world/hello_world-0.1.0.toml | 7 + .../bad-license/my_index/index/index.toml | 2 +- testsuite/tests/index/bad-license/test.py | 2 +- .../my_index/index/he/hello_world.toml | 9 - .../he/hello_world/hello_world-0.1.0.toml | 8 + .../index/bad-tag/my_index/index/index.toml | 2 +- testsuite/tests/index/bad-tag/test.py | 5 +- .../my_index/index/he/hello_world.toml | 9 - .../he/hello_world/hello_world-0.1.0.toml | 8 + .../index/empty-tag/my_index/index/index.toml | 2 +- testsuite/tests/index/empty-tag/test.py | 5 +- .../environment/my_index/index/he/hello.toml | 22 - .../my_index/index/he/hello/hello-1.0.0.toml | 35 ++ .../environment/my_index/index/index.toml | 2 +- .../{crate.toml => crate/crate-external.toml} | 9 +- .../external-available/my_index/index.toml | 2 +- .../my_index/index/index.toml | 2 +- .../ma/{make.toml => make/make-external.toml} | 5 +- .../{crate.toml => crate/crate-external.toml} | 8 +- .../my_index/cr/crate_master.toml | 15 - .../cr/crate_master/crate_master-1.0.0.toml | 11 + .../index/external-hint/my_index/index.toml | 2 +- .../dialog/dialog-external.toml} | 8 +- .../index/external-msys2/my_index/index.toml | 1 + .../external-msys2/my_index/index/index.toml | 1 - .../ma/main.toml => ma/main/main-1.0.0.toml} | 19 +- .../my_index/index/he/hello_world.toml | 17 - .../he/hello_world/hello_world-0.1.0.toml | 9 + .../he/hello_world/hello_world-external.toml | 9 + .../my_index/index/index.toml | 2 +- .../my_index/index/he/hello_world.toml | 14 - .../he/hello_world/hello_world-0.1.0.toml | 9 + .../my_index/index/index.toml | 2 +- .../hello_world-0.1.0.toml} | 9 +- .../index/long-tag/my_index/index/index.toml | 2 +- testsuite/tests/index/long-tag/test.py | 7 +- .../my_index/index/he/hello_world.toml | 8 - .../he/hello_world/hello_world-0.1.0.toml | 7 + .../maint-bad-email/my_index/index/index.toml | 2 +- testsuite/tests/index/maint-bad-email/test.py | 5 +- .../my_index/index/he/hello_world.toml | 8 - .../he/hello_world/hello_world-0.1.0.toml | 7 + .../maint-bad-login/my_index/index/index.toml | 2 +- testsuite/tests/index/maint-bad-login/test.py | 5 +- .../index/cr/crate/misplaced_crate-1.0.0.toml | 7 + .../my_index/index/index.toml | 1 + .../tests/index/mismatched-crate/test.py | 14 + .../tests/index/mismatched-crate/test.yaml | 4 + .../index/cr/bad_parent/crate-1.0.0.toml | 7 + .../my_index/index/index.toml | 1 + .../tests/index/mismatched-parent/test.py | 14 + .../tests/index/mismatched-parent/test.yaml | 4 + .../he/{hello.toml => hello/hello-1.0.0.toml} | 9 +- .../bad_index_1/index.toml | 2 +- .../he/{hello.toml => hello/hello-1.0.0.toml} | 9 +- .../bad_index_2/index.toml | 2 +- .../hello_world-0.1.0.toml} | 11 +- .../my_index/index/index.toml | 2 +- .../hello_world-0.1.0.toml} | 9 +- .../my_index/index/index.toml | 2 +- .../hello_world-0.1.0.toml} | 7 +- .../my_index/index/index.toml | 2 +- .../index/too-long-short-description/test.py | 7 +- .../my_index/index/cr/crate/crate-1.0.0.toml} | 8 +- .../my_index/index/index.toml | 1 + .../my_index/index/shouldnt_be_here | 0 .../tests/index/unexpected-contents/test.py | 14 + .../tests/index/unexpected-contents/test.yaml | 4 + testsuite/tests/misc/bad-lockfile/test.yaml | 2 + testsuite/tests/misc/sync-manual-edit/test.py | 2 +- .../{hello1.toml => hello1/hello1-0.1.0.toml} | 9 +- .../index/he/hello2/hello2-0.1.0.toml | 7 + .../tests/pin/all/my_index/index/index.toml | 2 +- .../crates/libhello_1.0.0/libhello.gpr | 24 - .../crates/libhello_1.0.0/src/libhello.ads | 3 - .../tests/pin/change-type/my_index/index.toml | 1 + .../pin/change-type/my_index/index/index.toml | 1 - .../libhello/libhello-1.0.0.toml} | 7 +- testsuite/tests/pin/change-type/test.py | 4 +- testsuite/tests/pin/change-type/test.yaml | 1 + .../pin/downgrade/my_index/index/index.toml | 2 +- .../index/li/libchild/libchild-0.1.0.toml} | 10 +- .../libchild-0.2.0.toml} | 10 +- .../index/li/libparent/libparent-1.0.0.toml} | 9 +- testsuite/tests/pin/downgrade/test.py | 4 +- .../pin-dir-with-regular/my_index/index.toml | 1 + .../my_index/index/index.toml | 1 - .../libhello/libhello-1.0.0.toml} | 7 +- .../tests/pin/pin-dir/my_index/index.toml | 1 + .../pin/pin-dir/my_index/index/index.toml | 1 - .../libhello/libhello-1.0.0.toml} | 7 +- testsuite/tests/pin/pin-dir/test.py | 4 +- .../pin/post-update/my_index/index/index.toml | 2 +- .../libchild-0.1.0.toml} | 10 +- .../index/li/libchild/libchild-0.2.0.toml} | 9 +- .../index/li/libparent/libparent-1.0.0.toml} | 9 +- testsuite/tests/pin/post-update/test.py | 4 +- .../unneeded-held/my_index/index/index.toml | 2 +- .../index/li/libchild/libchild-0.1.0.toml | 7 + .../index/li/libchild/libchild-0.2.0.toml | 7 + .../libparent-1.0.0.toml} | 9 +- testsuite/tests/pin/unpin/test.yaml | 3 +- .../my_index/index/ch/checkenv.toml | 18 - .../index/ch/checkenv/checkenv-1.0.0.toml | 17 + .../ch/checkparent/checkparent-1.0.0.toml | 10 + .../my_index/index/index.toml | 2 +- .../crates/crate_1234/alire/crate_1234.lock | 4 +- .../crates/crate_1234/alire/crate_1234.toml | 13 +- .../linked-paths/my_index/index/index.toml | 2 +- .../he/{hello.toml => hello/hello-1.0.0.toml} | 11 +- .../action-test/my_index/index/index.toml | 2 +- .../selective/my_index/index/he/hello1.toml | 8 - .../index/he/hello1/hello1-0.1.0.toml | 7 + .../selective/my_index/index/he/hello2.toml | 8 - .../index/he/hello2/hello2-0.1.0.toml | 7 + .../selective/my_index/index/index.toml | 2 +- .../my_index/updated/index/he/hello1.toml | 11 - .../updated/index/he/hello1/hello1-0.1.0.toml | 7 + .../updated/index/he/hello1/hello1-0.2.0.toml | 7 + .../my_index/updated/index/he/hello2.toml | 11 - .../updated/index/he/hello2/hello2-0.1.0.toml | 7 + .../updated/index/he/hello2/hello2-0.2.0.toml | 7 + .../my_index/updated/index/index.toml | 2 +- .../my_index/ex/extern/extern-external.toml} | 9 +- .../auto-gpr-with/basic/my_index/index.toml | 1 + .../libhello_nogprwith-1.0.0.toml | 9 + .../{ => with}/auto-gpr-with/basic/test.py | 0 .../{ => with}/auto-gpr-with/basic/test.yaml | 0 .../gp/gpr_in_subdir/gpr_in_subdir-1.0.0.toml | 8 + .../gpr_in_subdir/my_index/index.toml | 1 + .../auto-gpr-with/gpr_in_subdir/test.py | 0 .../auto-gpr-with/gpr_in_subdir/test.yaml | 0 .../with/pin-dir/my_index/index/index.toml | 2 +- .../libhello-1.0.0.toml} | 7 +- .../hello_world-0.1.0.toml} | 16 +- .../action-command/my_index/index/index.toml | 2 +- 250 files changed, 1901 insertions(+), 1819 deletions(-) delete mode 100644 src/alire/alire-crates-with_releases.adb delete mode 100644 src/alire/alire-crates-with_releases.ads create mode 100644 src/alire/alire-policies.ads delete mode 100644 testsuite/fixtures/basic_index/he/hello.toml create mode 100644 testsuite/fixtures/basic_index/he/hello/hello-1.0.0.toml create mode 100644 testsuite/fixtures/basic_index/he/hello/hello-1.0.1.toml delete mode 100644 testsuite/fixtures/basic_index/li/libhello.toml create mode 100644 testsuite/fixtures/basic_index/li/libhello/libhello-1.0.0.toml rename testsuite/fixtures/{native_index/ma/make.toml => basic_index/ma/make/make-external.toml} (68%) delete mode 100644 testsuite/fixtures/cases_index/he/hello.toml create mode 100644 testsuite/fixtures/cases_index/he/hello/hello-1.0.1.toml delete mode 100644 testsuite/fixtures/cases_index/li/libhello.toml create mode 100644 testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-linuxonly.toml create mode 100644 testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-unavail.toml create mode 100644 testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0.toml create mode 100644 testsuite/fixtures/cases_index/li/libhello/libhello-external.toml delete mode 100644 testsuite/fixtures/checked_index/li/libhello.toml create mode 100644 testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-git.toml create mode 100644 testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-gitbad.toml create mode 100644 testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-tarball.toml rename testsuite/fixtures/git_index/li/{libfoo.toml => libfoo/libfoo-1.0.0-git.toml} (56%) delete mode 100644 testsuite/fixtures/native_index/li/libhello.toml create mode 100644 testsuite/fixtures/native_index/li/libhello/libhello-0.9.0-test-unav-native.toml create mode 100644 testsuite/fixtures/native_index/li/libhello/libhello-1.0.0.toml rename testsuite/fixtures/{basic_index/ma/make.toml => native_index/ma/make/make-external.toml} (94%) delete mode 100644 testsuite/fixtures/run_index/no/noop.toml create mode 100644 testsuite/fixtures/run_index/no/noop/noop-1.0.0-default.toml create mode 100644 testsuite/fixtures/run_index/no/noop/noop-1.0.0-multi.toml create mode 100644 testsuite/fixtures/run_index/no/noop/noop-1.0.0-nondef.toml delete mode 100644 testsuite/fixtures/solver_index/he/hello.toml create mode 100644 testsuite/fixtures/solver_index/he/hello/hello-1.0.0.toml create mode 100644 testsuite/fixtures/solver_index/he/hello/hello-1.0.1.toml create mode 100644 testsuite/fixtures/solver_index/he/hello/hello-2.0.0.toml create mode 100644 testsuite/fixtures/solver_index/he/hello/hello-3.0.0.toml create mode 100644 testsuite/fixtures/solver_index/he/hello/hello-4.0.0.toml delete mode 100644 testsuite/fixtures/solver_index/li/libhello.toml create mode 100644 testsuite/fixtures/solver_index/li/libhello/libhello-1.0.0.toml create mode 100644 testsuite/fixtures/solver_index/li/libhello/libhello-1.0.1.toml create mode 100644 testsuite/fixtures/solver_index/li/libhello/libhello-1.1.0.toml create mode 100644 testsuite/fixtures/solver_index/li/libhello/libhello-2.0.0.toml rename testsuite/fixtures/solver_index/ma/{make.toml => make/make-external.toml} (94%) rename testsuite/fixtures/solver_index/su/{superhello.toml => superhello/superhello-1.0.0.toml} (73%) rename testsuite/skels/local-index/my_index/index/cr/{crate.toml => crate/crate-1.0.0.toml} (58%) delete mode 100644 testsuite/tests/auto-gpr-with/basic/my_index/index/index.toml delete mode 100644 testsuite/tests/auto-gpr-with/basic/my_index/index/li/libhello_nogprwith.toml delete mode 100644 testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/gp/gpr_in_subdir.toml delete mode 100644 testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/index.toml rename testsuite/tests/get/build/my_index/index/ba/{bad.toml => bad/bad-1.0.0.toml} (59%) rename testsuite/tests/get/build/my_index/index/go/{good.toml => good/good-1.0.0.toml} (58%) create mode 100644 testsuite/tests/get/external-tool-dependency/my_index/index.toml delete mode 100644 testsuite/tests/get/external-tool-dependency/my_index/index/index.toml rename testsuite/tests/get/external-tool-dependency/my_index/{index/ma/main.toml => ma/main/main-1.0.0.toml} (70%) rename testsuite/tests/get/external-tool-dependency/my_index/{index/ma/make.toml => ma/make/make-external.toml} (79%) rename testsuite/tests/get/indirect-link/my_index/index/ti/{tier1.toml => tier1/tier1-1.0.0.toml} (68%) rename testsuite/tests/get/indirect-link/my_index/index/ti/{tier2.toml => tier2/tier2-1.0.0.toml} (68%) rename testsuite/tests/get/indirect-link/my_index/index/ti/{tier3.toml => tier3/tier3-1.0.0.toml} (68%) delete mode 100644 testsuite/tests/index/bad-action-command/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/bad-action-command/my_index/index/he/hello_world/hello_world-0.1.0.toml delete mode 100644 testsuite/tests/index/bad-license/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/bad-license/my_index/index/he/hello_world/hello_world-0.1.0.toml delete mode 100644 testsuite/tests/index/bad-tag/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/bad-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml delete mode 100644 testsuite/tests/index/empty-tag/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/empty-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml delete mode 100644 testsuite/tests/index/environment/my_index/index/he/hello.toml create mode 100644 testsuite/tests/index/environment/my_index/index/he/hello/hello-1.0.0.toml rename testsuite/tests/index/external-available/my_index/cr/{crate.toml => crate/crate-external.toml} (50%) rename testsuite/tests/index/external-from-output/my_index/index/ma/{make.toml => make/make-external.toml} (79%) rename testsuite/tests/index/external-hint/my_index/cr/{crate.toml => crate/crate-external.toml} (54%) delete mode 100644 testsuite/tests/index/external-hint/my_index/cr/crate_master.toml create mode 100644 testsuite/tests/index/external-hint/my_index/cr/crate_master/crate_master-1.0.0.toml rename testsuite/tests/index/external-msys2/my_index/{index/di/dialog.toml => di/dialog/dialog-external.toml} (65%) create mode 100644 testsuite/tests/index/external-msys2/my_index/index.toml delete mode 100644 testsuite/tests/index/external-msys2/my_index/index/index.toml rename testsuite/tests/index/external-msys2/my_index/{index/ma/main.toml => ma/main/main-1.0.0.toml} (68%) delete mode 100644 testsuite/tests/index/external-unindexed/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-0.1.0.toml create mode 100644 testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-external.toml delete mode 100644 testsuite/tests/index/long-description/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/long-description/my_index/index/he/hello_world/hello_world-0.1.0.toml rename testsuite/tests/index/long-tag/my_index/index/he/{hello_world.toml => hello_world/hello_world-0.1.0.toml} (50%) delete mode 100644 testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world/hello_world-0.1.0.toml delete mode 100644 testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world.toml create mode 100644 testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world/hello_world-0.1.0.toml create mode 100644 testsuite/tests/index/mismatched-crate/my_index/index/cr/crate/misplaced_crate-1.0.0.toml create mode 100644 testsuite/tests/index/mismatched-crate/my_index/index/index.toml create mode 100644 testsuite/tests/index/mismatched-crate/test.py create mode 100644 testsuite/tests/index/mismatched-crate/test.yaml create mode 100644 testsuite/tests/index/mismatched-parent/my_index/index/cr/bad_parent/crate-1.0.0.toml create mode 100644 testsuite/tests/index/mismatched-parent/my_index/index/index.toml create mode 100644 testsuite/tests/index/mismatched-parent/test.py create mode 100644 testsuite/tests/index/mismatched-parent/test.yaml rename testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/he/{hello.toml => hello/hello-1.0.0.toml} (54%) rename testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/he/{hello.toml => hello/hello-1.0.0.toml} (57%) rename testsuite/tests/index/origin-no-archive-name/my_index/index/he/{hello_world.toml => hello_world/hello_world-0.1.0.toml} (60%) rename testsuite/tests/index/origin-unknown-kind/my_index/index/he/{hello_world.toml => hello_world/hello_world-0.1.0.toml} (56%) rename testsuite/tests/index/too-long-short-description/my_index/index/he/{hello_world.toml => hello_world/hello_world-0.1.0.toml} (75%) rename testsuite/tests/{setenv/env-during-fetch/my_index/index/ch/checkparent.toml => index/unexpected-contents/my_index/index/cr/crate/crate-1.0.0.toml} (73%) create mode 100644 testsuite/tests/index/unexpected-contents/my_index/index/index.toml create mode 100644 testsuite/tests/index/unexpected-contents/my_index/index/shouldnt_be_here create mode 100644 testsuite/tests/index/unexpected-contents/test.py create mode 100644 testsuite/tests/index/unexpected-contents/test.yaml rename testsuite/tests/pin/all/my_index/index/he/{hello1.toml => hello1/hello1-0.1.0.toml} (53%) create mode 100644 testsuite/tests/pin/all/my_index/index/he/hello2/hello2-0.1.0.toml delete mode 100644 testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/libhello.gpr delete mode 100644 testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/src/libhello.ads create mode 100644 testsuite/tests/pin/change-type/my_index/index.toml delete mode 100644 testsuite/tests/pin/change-type/my_index/index/index.toml rename testsuite/tests/pin/change-type/my_index/{index/li/libhello.toml => li/libhello/libhello-1.0.0.toml} (54%) rename testsuite/tests/pin/{unneeded-held/my_index/index/li/libchild.toml => downgrade/my_index/index/li/libchild/libchild-0.1.0.toml} (72%) rename testsuite/tests/pin/downgrade/my_index/index/li/{libchild.toml => libchild/libchild-0.2.0.toml} (72%) rename testsuite/tests/pin/{post-update/my_index/index/li/libparent.toml => downgrade/my_index/index/li/libparent/libparent-1.0.0.toml} (73%) create mode 100644 testsuite/tests/pin/pin-dir-with-regular/my_index/index.toml delete mode 100644 testsuite/tests/pin/pin-dir-with-regular/my_index/index/index.toml rename testsuite/tests/pin/pin-dir-with-regular/my_index/{index/li/libhello.toml => li/libhello/libhello-1.0.0.toml} (54%) create mode 100644 testsuite/tests/pin/pin-dir/my_index/index.toml delete mode 100644 testsuite/tests/pin/pin-dir/my_index/index/index.toml rename testsuite/tests/pin/pin-dir/my_index/{index/li/libhello.toml => li/libhello/libhello-1.0.0.toml} (54%) rename testsuite/tests/pin/post-update/my_index/index/li/{libchild.toml => libchild/libchild-0.1.0.toml} (72%) rename testsuite/tests/pin/{all/my_index/index/he/hello2.toml => post-update/my_index/index/li/libchild/libchild-0.2.0.toml} (57%) rename testsuite/tests/pin/{downgrade/my_index/index/li/libparent.toml => post-update/my_index/index/li/libparent/libparent-1.0.0.toml} (73%) create mode 100644 testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.1.0.toml create mode 100644 testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.2.0.toml rename testsuite/tests/pin/unneeded-held/my_index/index/li/{libparent.toml => libparent/libparent-1.0.0.toml} (73%) delete mode 100644 testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv.toml create mode 100644 testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv/checkenv-1.0.0.toml create mode 100644 testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent/checkparent-1.0.0.toml rename testsuite/tests/test/action-test/my_index/index/he/{hello.toml => hello/hello-1.0.0.toml} (65%) delete mode 100644 testsuite/tests/update/selective/my_index/index/he/hello1.toml create mode 100644 testsuite/tests/update/selective/my_index/index/he/hello1/hello1-0.1.0.toml delete mode 100644 testsuite/tests/update/selective/my_index/index/he/hello2.toml create mode 100644 testsuite/tests/update/selective/my_index/index/he/hello2/hello2-0.1.0.toml delete mode 100644 testsuite/tests/update/selective/my_index/updated/index/he/hello1.toml create mode 100644 testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.1.0.toml create mode 100644 testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.2.0.toml delete mode 100644 testsuite/tests/update/selective/my_index/updated/index/he/hello2.toml create mode 100644 testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.1.0.toml create mode 100644 testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.2.0.toml rename testsuite/tests/{auto-gpr-with/basic/my_index/index/ex/extern.toml => with/auto-gpr-with/basic/my_index/ex/extern/extern-external.toml} (69%) create mode 100644 testsuite/tests/with/auto-gpr-with/basic/my_index/index.toml create mode 100644 testsuite/tests/with/auto-gpr-with/basic/my_index/li/libhello_nogprwith/libhello_nogprwith-1.0.0.toml rename testsuite/tests/{ => with}/auto-gpr-with/basic/test.py (100%) rename testsuite/tests/{ => with}/auto-gpr-with/basic/test.yaml (100%) create mode 100644 testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/gp/gpr_in_subdir/gpr_in_subdir-1.0.0.toml create mode 100644 testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/index.toml rename testsuite/tests/{ => with}/auto-gpr-with/gpr_in_subdir/test.py (100%) rename testsuite/tests/{ => with}/auto-gpr-with/gpr_in_subdir/test.yaml (100%) rename testsuite/tests/with/pin-dir/my_index/index/li/{libhello.toml => libhello/libhello-1.0.0.toml} (54%) rename testsuite/tests/workflows/action-command/my_index/index/he/{hello_world.toml => hello_world/hello_world-0.1.0.toml} (60%) diff --git a/src/alire/alire-containers.ads b/src/alire/alire-containers.ads index 49bd2879..3b3a4f13 100644 --- a/src/alire/alire-containers.ads +++ b/src/alire/alire-containers.ads @@ -9,7 +9,7 @@ with Alire.Milestones; with Alire.Properties; with Alire.Releases; -package Alire.Containers with Preelaborate is +package Alire.Containers is package Crate_Name_Sets is new Ada.Containers.Indefinite_Ordered_Sets (Crate_Name); diff --git a/src/alire/alire-crates-containers.ads b/src/alire/alire-crates-containers.ads index 4d297109..bbb10c94 100644 --- a/src/alire/alire-crates-containers.ads +++ b/src/alire/alire-crates-containers.ads @@ -1,13 +1,8 @@ with Ada.Containers.Indefinite_Ordered_Maps; -with Alire.Crates.With_Releases; - package Alire.Crates.Containers is - use type With_Releases.Crate; - package Maps is new Ada.Containers.Indefinite_Ordered_Maps - (Crate_Name, - With_Releases.Crate); + (Crate_Name, Crate); end Alire.Crates.Containers; diff --git a/src/alire/alire-crates-with_releases.adb b/src/alire/alire-crates-with_releases.adb deleted file mode 100644 index ec2a13b1..00000000 --- a/src/alire/alire-crates-with_releases.adb +++ /dev/null @@ -1,267 +0,0 @@ -with Alire.Conditional; -with Alire.Errors; -with Alire.Origins; -with Alire.Properties.Labeled; -with Alire.Requisites; -with Alire.TOML_Keys; -with Alire.Utils.TTY; - -with TOML; - -package body Alire.Crates.With_Releases is - - package Keys is new Containers.Release_Sets.Generic_Keys - (Semantic_Versioning.Version, - Alire.Releases.Version, - Semantic_Versioning."<"); - - --------- - -- Add -- - --------- - - procedure Add (This : in out Crate; - Release : Alire.Releases.Release) is - begin - This.Releases.Insert (Release); - end Add; - - ---------- - -- Base -- - ---------- - - function Base (This : Crate) return Alire.Releases.Release is - use type Conditional.Properties; - All_Props : constant Properties.Vector := - Conditional.Enumerate (This.Properties); - Props : Conditional.Properties; - begin - for Label in Properties.Labeled.Labels loop - if Properties.Labeled.Mandatory (Label) then - for Prop of Properties.Labeled.Filter (All_Props, Label) loop - Props := Props and Conditional.For_Properties.New_Value (Prop); - end loop; - end if; - end loop; - - return Alire.Releases.New_Release - (Name => This.Name, - Version => Semantic_Versioning.Parse ("0"), - Origin => Origins.New_Filesystem ("."), - Notes => "", - Dependencies => Conditional.No_Dependencies, - Properties => (Props), - Available => Requisites.No_Requisites); - end Base; - - -------------- - -- Contains -- - -------------- - - function Contains (This : Crate; - Version : Semantic_Versioning.Version) return Boolean - is - begin - return Keys.Contains (This.Releases, Version); - end Contains; - - --------------- - -- Externals -- - --------------- - - function Externals (This : Crate) return Alire.Externals.Lists.List is - (This.Externals); - - --------------- - -- From_TOML -- - --------------- - - overriding - function From_TOML (This : in out Crate; - From : TOML_Adapters.Key_Queue) - return Outcome - is - package Semver renames Semantic_Versioning; - - -------------------- - -- Load_Externals -- - -------------------- - - procedure Load_Externals is - TOML_Externals : TOML.TOML_Value; - Has_Externals : constant Boolean := - From.Pop (TOML_Keys.External, TOML_Externals); - begin - if Has_Externals then - if TOML_Externals.Kind not in TOML.TOML_Array then - From.Checked_Error ("external entries must be TOML arrays"); - else - for I in 1 .. TOML_Externals.Length loop - This.Externals.Append - (Alire.Externals.From_TOML - (From.Descend (TOML_Externals.Item (I), - "external index" & I'Img))); - end loop; - end if; - end if; - end Load_Externals; - - begin - -- Process the general key - declare - package APL renames Alire.Properties.Labeled; - use all type TOML.Any_Value_Kind; - - Val : TOML.TOML_Value; - begin - if not From.Pop (TOML_Keys.General, Val) then - return From.Failure ("missing general section in crate"); - elsif Val.Kind /= TOML_Table then - return From.Failure ("general section must be a table"); - end if; - - -- Ensure mandatory properties are there: - for Label in APL.Mandatory'Range loop - if APL.Mandatory (Label) then - if not Val.Has (APL.Key (Label)) then - return From.Failure - ("mandatory property missing: " & APL.Key (Label)); - end if; - end if; - end loop; - - -- Load the [general] crate part - declare - Result : constant Outcome := - General (This) - .From_TOML (From.Descend (Val, Context => "general")); - begin - if not Result.Success then - return Result; - end if; - end; - end; - - -- Process any external detectors - - Load_Externals; - - -- Process remaining keys, that must be releases - loop - declare - Val : TOML.TOML_Value; - Key : constant String := From.Pop (Val); - Ver : Semver.Version; - begin - exit when Key = ""; - - Ver := Semver.Parse (Key, Relaxed => False); - - declare - Release : Alire.Releases.Release := - Alire.Releases - .New_Working_Release (Name => This.Name) - .Retagging (Ver) - .Replacing (Properties => This.Properties) - .Replacing (Dependencies => This.Dependencies) - .Replacing (Available => This.Available); - Result : constant Outcome := - Release - .From_TOML (From.Descend (Val, Context => Key)); - begin - if not Result.Success then - return Result; - end if; - - This.Releases.Insert (Release); - end; - - exception - when Semver.Malformed_Input => - return Outcome_Failure ("Bad crate version: " & Key); - end; - end loop; - - -- There cannot be any remaining keys at this level, as any unknown key - -- has been processed as a version or already reported as invalid. - - if This.Releases.Is_Empty then - Trace.Debug ("Crate contains no releases: " & (+This.Name)); - -- This does not make much sense currently, but it might serve as a - -- placeholder, or if in the future we rescue child crates. - end if; - - return Outcome_Success; - - exception - when E : Alire.Checked_Error => - return Errors.Get (E); - end From_TOML; - - ----------------- - -- Description -- - ----------------- - - function Description (This : Crate) return Description_String is - Descr : constant Properties.Vector := - Properties.Labeled.Filter - (Conditional.Enumerate (This.Properties), - Properties.Labeled.Description); - begin - if Natural (Descr.Length) > 1 then - raise Program_Error with "Multiple descriptions!"; - -- Shouldn't happen because the loader checks for multiplicity. - else - return Properties.Labeled.Label (Descr.First_Element).Value; - end if; - end Description; - - --------------------- - -- TTY_Description -- - --------------------- - - function TTY_Description (This : Crate) return String - is (Utils.TTY.Description (This.Description)); - - ---------- - -- Name -- - ---------- - - function Name (This : Crate) return Crate_Name is (+(+This.Name)); - - -------------- - -- TTY_Name -- - -------------- - - function TTY_Name (This : Crate) return String - is (Utils.TTY.Name (+This.Name)); - - --------------- - -- New_Crate -- - --------------- - - function New_Crate (Name : Crate_Name) return Crate is - (Crate'(General with - Len => Name.Length, - Name => Name, - Externals => <>, - Releases => <>)); - - -------------- - -- Releases -- - -------------- - - function Releases (This : Crate) return Containers.Release_Set is - (This.Releases); - - ------------- - -- Replace -- - ------------- - - procedure Replace (This : in out Crate; - Release : Alire.Releases.Release) - is - begin - Keys.Replace (This.Releases, Release.Version, Release); - end Replace; - -end Alire.Crates.With_Releases; diff --git a/src/alire/alire-crates-with_releases.ads b/src/alire/alire-crates-with_releases.ads deleted file mode 100644 index da4e1eb7..00000000 --- a/src/alire/alire-crates-with_releases.ads +++ /dev/null @@ -1,66 +0,0 @@ -with Alire.Interfaces; -with Alire.Containers; -with Alire.Externals.Lists; -with Alire.Releases; -with Alire.TOML_Adapters; - -with Semantic_Versioning; - -package Alire.Crates.With_Releases is - - type Crate (<>) is new General and Interfaces.Detomifiable - with private; - -- A complete crate with its releases. - - function New_Crate (Name : Crate_Name) return Crate; - - function Name (This : Crate) return Crate_Name; - - function TTY_Name (This : Crate) return String; - - procedure Add (This : in out Crate; - Release : Releases.Release) with Pre => - not This.Contains (Release.Version) or else - raise Checked_Error with - "Crate already contains given release: " - & Semantic_Versioning.Image (Release.Version); - - function Base (This : Crate) return Releases.Release; - -- Returns a release sharing only this crate mandatory properties (see - -- Alire.Properties.Labeled.Mandatory) that can be used as template for - -- new releases in this crate (e.g., by externally detected releases). - - function Contains (This : Crate; - Version : Semantic_Versioning.Version) return Boolean; - - function Description (This : Crate) return Description_String; - - function TTY_Description (This : Crate) return String; - - function Externals (This : Crate) return Alire.Externals.Lists.List; - - function Releases (This : Crate) return Containers.Release_Set; - - overriding - function From_TOML (This : in out Crate; - From : TOML_Adapters.Key_Queue) - return Outcome; - - procedure Replace (This : in out Crate; - Release : Alire.Releases.Release) with Pre => - This.Contains (Release.Version) or else - raise Checked_Error with - "Crate does not contain given release: " - & Semantic_Versioning.Image (Release.Version); - -private - - type Crate (Len : Natural) is new General and - Interfaces.Detomifiable with - record - Name : Crate_Name (Len); - Externals : Alire.Externals.Lists.List; - Releases : Containers.Release_Set; - end record; - -end Alire.Crates.With_Releases; diff --git a/src/alire/alire-crates.adb b/src/alire/alire-crates.adb index 267fcdcd..d812eb0f 100644 --- a/src/alire/alire-crates.adb +++ b/src/alire/alire-crates.adb @@ -1,34 +1,16 @@ +with Alire.Origins; +with Alire.Properties.Labeled; +with Alire.TOML_Keys; with Alire.TOML_Load; +with Alire.Utils.TTY; -package body Alire.Crates is +with TOML; - --------------- - -- From_TOML -- - --------------- - - overriding - function From_TOML (This : in out General; - From : TOML_Adapters.Key_Queue) - return Outcome - is - Result : constant Outcome := - TOML_Load.Load_Crate_Section - (General_Section, - From, - This.Properties, - This.Dependencies, - This.Available); - - begin - if not Result.Success then - return Result; - end if; +package body Alire.Crates is - -- Check for remaining keys, which must be erroneous. - -- TODO: Should we instead emit a warning (or make it an option) to - -- allow for unforeseen future keys in the index? - return From.Report_Extra_Keys; - end From_TOML; + ----------------------- + -- Naming_Convention -- + ----------------------- function Naming_Convention return Utils.String_Vector is (Utils.Empty_Vector @@ -41,4 +23,240 @@ package body Alire.Crates is & " to" & Alire.Max_Name_Length'Img & " characters.")); + ---------- + -- Keys -- + ---------- + + package Keys is new Containers.Release_Sets.Generic_Keys + (Semantic_Versioning.Version, + Alire.Releases.Version, + Semantic_Versioning."<"); + + --------- + -- Add -- + --------- + + procedure Add (This : in out Crate; + Release : Alire.Releases.Release) is + begin + This.Releases.Insert (Release); + end Add; + + ---------- + -- Base -- + ---------- + + function Base (This : Crate) return Alire.Releases.Release is + begin + return Alire.Releases.New_Release + (Name => This.Name, + Version => Semantic_Versioning.Parse ("0"), + Origin => Origins.New_Filesystem ("."), + Notes => "", + Dependencies => Conditional.No_Dependencies, + Properties => This.Externals.Properties, + Available => Requisites.No_Requisites); + end Base; + + -------------- + -- Contains -- + -------------- + + function Contains (This : Crate; + Version : Semantic_Versioning.Version) return Boolean + is + begin + return Keys.Contains (This.Releases, Version); + end Contains; + + --------------- + -- Externals -- + --------------- + + function Externals (This : Crate) return Alire.Externals.Lists.List is + (This.Externals.Detectors); + + ----------------------------- + -- From_Externals_Manifest -- + ----------------------------- + + function From_Externals_Manifest (From : TOML_Adapters.Key_Queue) + return Crate + is + begin + From.Assert_Key (TOML_Keys.Name, TOML.TOML_String); + + return This : Crate := + New_Crate (+From.Unwrap.Get (TOML_Keys.Name).As_String) + do + This.Load_Externals (From); + end return; + end From_Externals_Manifest; + + -------------------- + -- Load_Externals -- + -------------------- + + procedure Load_Externals + (This : in out Crate; + From : TOML_Adapters.Key_Queue; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing) + is + -------------------- + -- Load_Externals -- + -------------------- + + procedure Load_Externals_Array is + TOML_Externals : TOML.TOML_Value; + Has_Externals : constant Boolean := + From.Pop (TOML_Keys.External, TOML_Externals); + begin + if Has_Externals then + if TOML_Externals.Kind not in TOML.TOML_Array then + From.Checked_Error ("external entries must be TOML arrays"); + else + for I in 1 .. TOML_Externals.Length loop + This.Externals.Detectors.Append + (Alire.Externals.From_TOML + (From.Descend (TOML_Externals.Item (I), + "external index" & I'Img))); + end loop; + end if; + end if; + end Load_Externals_Array; + + begin + if From.Unwrap.Kind not in TOML.TOML_Table then + From.Checked_Error ("top-level section must be a table"); + end if; + + -- Process any external detectors + + Load_Externals_Array; + + -- Load the shared section + + declare + Unused_Avail : Requisites.Tree; + Unused_Deps : Conditional.Dependencies; + Properties : Conditional.Properties; + begin + TOML_Load.Load_Crate_Section + (Section => External_Shared_Section, + From => From, + Props => Properties, + Deps => Unused_Deps, + Avail => Unused_Avail); + + case Policy is + when Policies.Merge_Priorizing_Existing => + if This.Externals.Properties.Is_Empty then + This.Externals.Properties := Properties; + else + Trace.Debug ("Discarding new properties for externals base"); + end if; + end case; + end; + + From.Report_Extra_Keys; + end Load_Externals; + + --------------------- + -- Merge_Externals -- + --------------------- + + procedure Merge_Externals + (This : in out Crate; + From : Crate; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing) + is + use type Alire.Externals.External'Class; + begin + -- Merge new external detectors + + case Policy is + when Policies.Merge_Priorizing_Existing => + if This.Externals.Properties.Is_Empty then + This.Externals.Properties := From.Externals.Properties; + end if; + + for Ext of From.Externals.Detectors loop + if not (for some Existing of This.Externals.Detectors => + Ext = Existing) + then + This.Externals.Detectors.Append (Ext); + end if; + end loop; + end case; + end Merge_Externals; + + ----------------- + -- Description -- + ----------------- + + function Description (This : Crate) return Description_String is + Descr : constant Properties.Vector := + Properties.Labeled.Filter + (Conditional.Enumerate (This.Externals.Properties), + Properties.Labeled.Description); + begin + if not This.Releases.Is_Empty then + return This.Releases.Last_Element.Description; + elsif not Descr.Is_Empty then + return Properties.Labeled.Label (Descr.First_Element).Value; + else + return "Crate is empty and a description cannot thus be provided"; + end if; + end Description; + + --------------------- + -- TTY_Description -- + --------------------- + + function TTY_Description (This : Crate) return String + is (Utils.TTY.Description (This.Description)); + + ---------- + -- Name -- + ---------- + + function Name (This : Crate) return Crate_Name is (This.Name); + + -------------- + -- TTY_Name -- + -------------- + + function TTY_Name (This : Crate) return String + is (Utils.TTY.Name (+This.Name)); + + --------------- + -- New_Crate -- + --------------- + + function New_Crate (Name : Crate_Name) return Crate is + (Crate'(Len => Name.Length, + Name => Name, + Externals => <>, + Releases => <>)); + + -------------- + -- Releases -- + -------------- + + function Releases (This : Crate) return Containers.Release_Set is + (This.Releases); + + ------------- + -- Replace -- + ------------- + + procedure Replace (This : in out Crate; + Release : Alire.Releases.Release) + is + begin + Keys.Replace (This.Releases, Release.Version, Release); + end Replace; + end Alire.Crates; diff --git a/src/alire/alire-crates.ads b/src/alire/alire-crates.ads index 8215adaf..64b8308a 100644 --- a/src/alire/alire-crates.ads +++ b/src/alire/alire-crates.ads @@ -1,48 +1,108 @@ with Alire.Conditional; -with Alire.Interfaces; +with Alire.Containers; +with Alire.Externals.Lists; +with Alire.Policies; with Alire.Properties; +with Alire.Releases; with Alire.Requisites; with Alire.TOML_Adapters; with Alire.Utils; -package Alire.Crates with Preelaborate is +with Semantic_Versioning; + +package Alire.Crates is function Naming_Convention return Utils.String_Vector; -- Return a description of the naming restrictions on crates/indexes. - type Named is limited interface; + type Sections is (Release_Section, + -- Top-level table, with all info about a release + + External_Shared_Section, + -- Top-level table, with only info valid for externals + + External_Private_Section + -- Info that can be provided by all external definitions, + -- but already in their private [[external]] entry. + ); + + type Crate (<>) is tagged private; + -- A complete crate with its releases and external definitions. + + function New_Crate (Name : Crate_Name) return Crate; + + function Name (This : Crate) return Crate_Name; + + function TTY_Name (This : Crate) return String; - function Name (N : Named) return Crate_Name is abstract; + procedure Add (This : in out Crate; + Release : Releases.Release) with Pre => + not This.Contains (Release.Version) or else + raise Checked_Error with + "Crate already contains given release: " + & Semantic_Versioning.Image (Release.Version); - type Sections is (General_Section, -- In [general] - Release_Section, -- In a release - External_Section); -- In a [[external]] + function Base (This : Crate) return Releases.Release + with Pre => not This.Externals.Is_Empty; + -- Returns a release sharing only this crate mandatory properties (see + -- Alire.Properties.Labeled.Mandatory) that can be used as template for + -- new releases in this crate (e.g., by externally detected releases). - ------------- - -- General -- - ------------- + function Contains (This : Crate; + Version : Semantic_Versioning.Version) return Boolean; - -- A crate contains mandatory information, some of it overridable by its - -- releases. See doc/catalog-format-spec.md. + function Description (This : Crate) return Description_String; + -- Will return the last release description, or the one in the external + -- base properties, or a message saying the crate is totally empty. - type General is new Interfaces.Detomifiable with private; - -- The General portion of a Crate + function TTY_Description (This : Crate) return String; - overriding - function From_TOML (This : in out General; - From : TOML_Adapters.Key_Queue) - return Outcome; + function Externals (This : Crate) return Alire.Externals.Lists.List; - -- TODO: Releases.Release should probable inherit from General. + function From_Externals_Manifest (From : TOML_Adapters.Key_Queue) + return Crate; + -- Load a manifest containing only external definitions for a crate + + procedure Load_Externals + (This : in out Crate; + From : TOML_Adapters.Key_Queue; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing); + -- Load externals detectors into an existing crate + + procedure Merge_Externals + (This : in out Crate; + From : Crate; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing); + -- Merge external definitions from both crates, applying some index merging + -- policy. + + function Releases (This : Crate) return Containers.Release_Set; + + procedure Replace (This : in out Crate; + Release : Alire.Releases.Release) with Pre => + This.Contains (Release.Version) or else + raise Checked_Error with + "Crate does not contain given release: " + & Semantic_Versioning.Image (Release.Version); private - type General is new Interfaces.Detomifiable with record - Properties : Conditional.Properties; - Dependencies : Conditional.Dependencies; - Forbidden : Conditional.Dependencies; + type External_Data is record + Properties : Conditional.Properties; + -- Properties that are defined with external definitions, used as + -- base of any detected release (description, etc). This will be + -- empty for crates without external definitions. + + Detectors : Alire.Externals.Lists.List; + -- External detectors defined for the crate + end record; - Available : Requisites.Tree; + type Crate (Len : Natural) is tagged record + Name : Crate_Name (Len); + Externals : External_Data; + Releases : Containers.Release_Set; end record; end Alire.Crates; diff --git a/src/alire/alire-dependencies-states.adb b/src/alire/alire-dependencies-states.adb index d99d59ff..d023eed4 100644 --- a/src/alire/alire-dependencies-states.adb +++ b/src/alire/alire-dependencies-states.adb @@ -1,6 +1,6 @@ with Alire.Roots; -with Alire.Crates.With_Releases; +with Alire.Crates; package body Alire.Dependencies.States is @@ -68,8 +68,6 @@ package body Alire.Dependencies.States is Data : Fulfillment_Data (Fulfillments'Value (From.Checked_Pop (Keys.Fulfilment, TOML_String).As_String)); - Crate : Crates.With_Releases.Crate := - Crates.With_Releases.New_Crate (From_TOML.Crate); begin -- Load particulars @@ -89,22 +87,12 @@ package body Alire.Dependencies.States is when Missed => null; when Solved => - Assert (Crate.From_TOML -- Load crate - (From.Descend -- from adapter that is under 'release' - (From.Checked_Pop (Keys.Release, TOML_Table) - .Get (+Crate.Name), -- get the release top entry - "release: " & (+Crate.Name)))); - - if Crate.Releases.Length not in 1 then - Raise_Checked_Error - ("Expected one release per solved dependency" - & " in lockfile, but got:" & Crate.Releases.Length'Img); - end if; - Data.Release := Containers.Release_Holders.To_Holder - (Crate.Releases.First_Element); - + (Releases.From_TOML + (From.Descend + (From.Checked_Pop (Keys.Release, TOML_Table), + "release: " & (+Crate)))); end case; return Data; @@ -165,15 +153,8 @@ package body Alire.Dependencies.States is when Missed => null; when Solved => - declare - Name : constant TOML_Value := Create_Table; - -- This extra table is not really necessary, but it makes - -- the output clearer and the tests simpler. - begin - Name.Set (+This.Crate, - This.Fulfilled.Release.Constant_Reference.To_TOML); - Table.Set (Keys.Release, Name); - end; + Table.Set (Keys.Release, + This.Fulfilled.Release.Constant_Reference.To_TOML); end case; end To_TOML; diff --git a/src/alire/alire-dependencies.ads b/src/alire/alire-dependencies.ads index ee4cd09d..5b406e77 100644 --- a/src/alire/alire-dependencies.ads +++ b/src/alire/alire-dependencies.ads @@ -59,6 +59,7 @@ package Alire.Dependencies with Preelaborate is overriding function To_TOML (Dep : Dependency) return TOML.TOML_Value; + -- Creates the RHS of the "crate = 'version'" overriding function To_YAML (Dep : Dependency) return String; diff --git a/src/alire/alire-directories.adb b/src/alire/alire-directories.adb index 26758d0e..785fc306 100644 --- a/src/alire/alire-directories.adb +++ b/src/alire/alire-directories.adb @@ -301,6 +301,46 @@ package body Alire.Directories is Exception_Information (E)); end Finalize; + ------------------- + -- Traverse_Tree -- + ------------------- + + procedure Traverse_Tree (Start : Relative_Path; + Doing : access procedure + (Item : Ada.Directories.Directory_Entry_Type; + Stop : in out Boolean); + Recurse : Boolean := False) + is + use Ada.Directories; + + procedure Go_Down (Item : Directory_Entry_Type) is + Stop : Boolean := False; + begin + if Simple_Name (Item) /= "." and then Simple_Name (Item) /= ".." then + Doing (Item, Stop); + if Stop then + return; + end if; + + if Recurse and then Kind (Item) = Directory then + Traverse_Tree (Start / Simple_Name (Item), Doing, Recurse); + end if; + end if; + end Go_Down; + + begin + Trace.Debug ("Traversing folder: " & Start); + + Search (Start, + "", + (Directory => True, Ordinary_File => True, others => False), + Go_Down'Access); + end Traverse_Tree; + + --------------- + -- With_Name -- + --------------- + function With_Name (Name : String) return Temp_File is (Temp_File'(Ada.Finalization.Limited_Controlled with Keep => <>, diff --git a/src/alire/alire-directories.ads b/src/alire/alire-directories.ads index c3f32b6a..2ca2d2d4 100644 --- a/src/alire/alire-directories.ads +++ b/src/alire/alire-directories.ads @@ -44,6 +44,15 @@ package Alire.Directories is -- Finds a single file in a folder with the given extension and return its -- absolute path. If more than one, or none, returns "". + procedure Traverse_Tree (Start : Relative_Path; + Doing : access procedure + (Item : Ada.Directories.Directory_Entry_Type; + Stop : in out Boolean); + Recurse : Boolean := False); + -- Traverse all items in a folder, optionally recursively If recursively, + -- the directory entry is passed before entering it "." and ".." are + -- ignored. If Stop is set to True, traversal will not continue. + ---------------- -- GUARD TYPE -- ---------------- diff --git a/src/alire/alire-externals.adb b/src/alire/alire-externals.adb index 48fa7cf8..843ec02e 100644 --- a/src/alire/alire-externals.adb +++ b/src/alire/alire-externals.adb @@ -76,25 +76,12 @@ package body Alire.Externals is -- Load common external fields - declare - Result : constant Outcome := - TOML_Load.Load_Crate_Section - (Section => Crates.External_Section, - From => From, - Props => Ext.Properties, - Deps => Deps, - Avail => Ext.Available); - begin - Assert (Result); - - -- Ensure that no dependencies have been defined for the external. - -- This may be handy in the future, but until the need arises - -- better not have it complicating things. - end; - - if not Deps.Is_Empty then - From.Checked_Error ("externals cannot have dependencies"); - end if; + TOML_Load.Load_Crate_Section + (Section => Crates.External_Private_Section, + From => From, + Props => Ext.Properties, + Deps => Deps, + Avail => Ext.Available); From.Report_Extra_Keys; -- Table must be exhausted at this point end return; diff --git a/src/alire/alire-index.adb b/src/alire/alire-index.adb index a0732f39..a6840b9b 100644 --- a/src/alire/alire-index.adb +++ b/src/alire/alire-index.adb @@ -10,22 +10,28 @@ package body Alire.Index is -- Add -- --------- - procedure Add (Crate : Crates.With_Releases.Crate; - Policy : Addition_Policies := Merge_Priorizing_Existing) is - pragma Unreferenced (Policy); + procedure Add (Crate : Crates.Crate; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing) is begin if Exists (Crate.Name) then declare - Old : Crates.With_Releases.Crate := Contents (Crate.Name); + Old : Crates.Crate := Contents (Crate.Name); begin - for Release of Crate.Releases loop - if Old.Contains (Release.Version) then - Trace.Debug ("Not registering release already indexed: " - & Release.Milestone.Image); - else - Old.Add (Release); - end if; - end loop; + case Policy is + when Policies.Merge_Priorizing_Existing => + for Release of Crate.Releases loop + if Old.Contains (Release.Version) then + Trace.Debug + ("Not registering release already indexed: " + & Release.Milestone.Image); + else + Old.Add (Release); + end if; + end loop; + end case; + + Old.Merge_Externals (Crate, Policy); Contents.Include (Crate.Name, Old); end; @@ -34,28 +40,42 @@ package body Alire.Index is end if; end Add; - ----------------------- - -- Add_All_Externals -- - ----------------------- + --------- + -- Add -- + --------- - procedure Add_All_Externals (Env : Properties.Vector) is + procedure Add (Release : Releases.Release; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing) + is + Crate : Crates.Crate := Crates.New_Crate (Release.Name); + begin + Crate.Add (Release); + Add (Crate, Policy); + end Add; + + -------------------------- + -- Detect_All_Externals -- + -------------------------- + + procedure Detect_All_Externals (Env : Properties.Vector) is begin Trace.Detail ("Detecting external releases..."); for Crate of Contents loop - Add_Externals (Crate.Name, Env); + Detect_Externals (Crate.Name, Env); end loop; - end Add_All_Externals; + end Detect_All_Externals; package Name_Sets is new Ada.Containers.Indefinite_Ordered_Sets (Crate_Name); Already_Detected : Name_Sets.Set; - ------------------- - -- Add_Externals -- - ------------------- + ---------------------- + -- Detect_Externals -- + ---------------------- - procedure Add_Externals (Name : Crate_Name; Env : Properties.Vector) is + procedure Detect_Externals (Name : Crate_Name; Env : Properties.Vector) is begin if Already_Detected.Contains (Name) then Trace.Debug @@ -70,7 +90,7 @@ package body Alire.Index is Contents (Name).Add (Release); end loop; end if; - end Add_Externals; + end Detect_Externals; ---------------- -- All_Crates -- @@ -83,7 +103,7 @@ package body Alire.Index is -- Crate -- ----------- - function Crate (Name : Crate_Name) return Crates.With_Releases.Crate + function Crate (Name : Crate_Name) return Crates.Crate is (Contents (Name)); ----------------- diff --git a/src/alire/alire-index.ads b/src/alire/alire-index.ads index e8e918ba..f9facaf2 100644 --- a/src/alire/alire-index.ads +++ b/src/alire/alire-index.ads @@ -5,7 +5,7 @@ with Alire.Dependencies; with Alire.GPR; with Alire.Origins; with Alire.Crates.Containers; -with Alire.Crates.With_Releases; +with Alire.Policies; with Alire.Properties; with Alire.Properties.Licenses; with Alire.Releases; @@ -35,7 +35,7 @@ package Alire.Index is and then Branch_String (Branch_String'Last) /= '-' and then (for some C of Branch_String => C = '-'); - Community_Branch : constant String := "devel-0.3"; + Community_Branch : constant String := "tmp-0.1"; -- The branch used for the community index Version : constant Semantic_Versioning.Version := @@ -50,26 +50,19 @@ package Alire.Index is -- INDEX POPULATION -- ------------------------ - type Addition_Policies is - (Merge_Priorizing_Existing - -- Merge two crates but the properties of the old one stand, new - -- properties are not added, and any existing releases will be kept - -- over ones with the same version in the new crate. This is the only - -- behavior existing since multiple indexes were introduced. + procedure Add (Crate : Crates.Crate; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing); - -- We might envision other policies, like not allowing releases from two - -- indexes at the same time, keeping only the first seen or overriding - -- with the last seen. - ); + procedure Add (Release : Releases.Release; + Policy : Policies.For_Index_Merging := + Policies.Merge_Priorizing_Existing); - procedure Add (Crate : Crates.With_Releases.Crate; - Policy : Addition_Policies := Merge_Priorizing_Existing); - - procedure Add_All_Externals (Env : Properties.Vector); + procedure Detect_All_Externals (Env : Properties.Vector); -- Goes over the list of crates and applies external detection, indexing -- any found externals. This has effect only the first time it is called. - procedure Add_Externals (Name : Crate_Name; Env : Properties.Vector); + procedure Detect_Externals (Name : Crate_Name; Env : Properties.Vector); -- Add only the externals of this crate. This has effect only the first -- time it is called for a crate. @@ -77,7 +70,7 @@ package Alire.Index is -- BASIC QUERIES -- --------------------- - function Crate (Name : Crate_Name) return Crates.With_Releases.Crate + function Crate (Name : Crate_Name) return Crates.Crate with Pre => Exists (Name) or else raise Checked_Error with "Requested crate not in index: " & (+Name); diff --git a/src/alire/alire-origins-tweaks.adb b/src/alire/alire-origins-tweaks.adb index ff06abe7..a96e4a77 100644 --- a/src/alire/alire-origins-tweaks.adb +++ b/src/alire/alire-origins-tweaks.adb @@ -1,6 +1,9 @@ +with Ada.Directories; + +with Alire.OS_Lib; with Alire.Utils; -with GNATCOLL.VFS; +with Alire.URI; package body Alire.Origins.Tweaks is @@ -11,28 +14,22 @@ package body Alire.Origins.Tweaks is function Fixed_Origin (TOML_Path : String; This : Origin) return Origin is - use GNATCOLL.VFS; + use OS_Lib.Operators; -------------------- -- Fix_Filesystem -- -------------------- function Fix_Filesystem return Origin is + use Ada.Directories; begin - if Create (+This.Path).Is_Absolute_Path then + if Check_Absolute_Path (This.Path) then return This; end if; - declare - Base : constant Virtual_File := Create (+TOML_Path); - Target : constant Virtual_File := Create (+This.Path); - Fixed : Origins.Origin := This; -- Copy contents - begin - Fixed.Data.Path := - +(+Full_Name (Base.Dir / Target, Normalize => True)); - - return Fixed; - end; + return Fixed : Origins.Origin := This do -- Copy contents + Fixed.Data.Path := +Full_Name (TOML_Path / This.Path); + end return; end Fix_Filesystem; ------------- @@ -40,6 +37,7 @@ package body Alire.Origins.Tweaks is ------------- function Fix_VCS return Origin is + use Ada.Directories; use Utils; URL : constant String := This.URL; -- Doesn't include @commit begin @@ -49,27 +47,29 @@ package body Alire.Origins.Tweaks is end if; declare - Base : constant Virtual_File := Create (+TOML_Path); - Rel_Path : constant Relative_Path := - Tail (Tail (URL, '/'), '/'); - Target : constant Virtual_File := Create (+Rel_Path); + Rel_Path : constant Relative_Path := URI.Local_Path (URL); Absolute : Origin := This; begin -- Check that path is indeed relative... - if Target.Is_Absolute_Path then + if Check_Absolute_Path (Rel_Path) then return This; end if; -- Rebuild the filesystem path as absolute for the VCS in hand: Absolute.Data.Repo_URL := + -- Unbounded string - (Prefix_File & - (+Full_Name (Base.Dir / Target, Normalize => True))); + (Prefix_File & Full_Name (TOML_Path / Rel_Path)); return Absolute; end; end Fix_VCS; begin + -- If we receive the manifest file path instead of its parent folder: + if Ada.Directories.Kind (TOML_Path) in Ada.Directories.Ordinary_File then + return Fixed_Origin (Ada.Directories.Containing_Directory (TOML_Path), + This); + end if; + -- We must fix filesystem, or VCSs with a filesystem upstream (that are -- used in the testsuite). case This.Kind is diff --git a/src/alire/alire-policies.ads b/src/alire/alire-policies.ads new file mode 100644 index 00000000..b1f13b95 --- /dev/null +++ b/src/alire/alire-policies.ads @@ -0,0 +1,17 @@ +package Alire.Policies with Preelaborate is + + type For_Index_Merging is + (Merge_Priorizing_Existing + -- Merge two crates but any existing releases will be kept over ones + -- with the same version when adding more release. This is the only + -- behavior existing since multiple indexes were introduced. + -- + -- For the case of externals, the shared properties of the first time a + -- crate externals are added take precedence as well. + + -- We might envision other policies, like not allowing releases from two + -- indexes at the same time, keeping only the first seen or overriding + -- with the last seen. + ); + +end Alire.Policies; diff --git a/src/alire/alire-properties-from_toml.ads b/src/alire/alire-properties-from_toml.ads index 8ae5fd50..08ee34a6 100644 --- a/src/alire/alire-properties-from_toml.ads +++ b/src/alire/alire-properties-from_toml.ads @@ -8,7 +8,7 @@ with Alire.Properties.Scenarios; with Alire.Properties.Bool; with Alire.TOML_Adapters; -package Alire.Properties.From_TOML with Preelaborate is +package Alire.Properties.From_TOML is subtype Property_Loader is Conditional.Property_Loader; @@ -25,49 +25,88 @@ package Alire.Properties.From_TOML with Preelaborate is Long_Description, Maintainers, Maintainers_Logins, + Name, Notes, Project_Files, - Website, - Tags); + Tags, + Version, + Website); -- These enum values must match the toml key they represent with '-' => '_' + -- The following array describes which properties are mandatory, depending + -- on what we are loading. + + Mandatory : array (Crates.Sections, Property_Keys) of Boolean := + + (Crates.External_Private_Section => + (others => False), + + Crates.External_Shared_Section => + (Description | + Maintainers | + Maintainers_Logins | + Name => True, + others => False), + + Crates.Release_Section => + (Description | + Maintainers | + Maintainers_Logins | + Name | + Version => True, + others => False)); + type Loader_Array is array (Property_Keys range <>) of Property_Loader; - -- We use these arrays to determine which properties may appear in each - -- crate section. These loaders will always receive a table of the form - -- prop_name = prop_value. Dynamic expressions are resolved prior to + -- We use the following arrays to determine which properties may appear + -- in a manifest section. These loaders will always receive a table of the + -- form prop_name = prop_value. Dynamic expressions are resolved prior to -- dispatching to these loaders, so they need not to care. - External_Loaders : constant Loader_Array (Property_Keys) := - (Hint => Labeled.From_TOML'Access, - others => null); - -- This loader is used for properties common to all external classes - - General_Loaders : constant Loader_Array (Property_Keys) := - (Actions => Properties.Actions.From_TOML'Access, - Environment => Properties.Environment.From_TOML'Access, - GPR_Externals .. - GPR_Set_Externals - => Scenarios.From_TOML'Access, - Hint => null, -- Only apply to externals - Licenses => Properties.Licenses.From_TOML'Access, - Auto_GPR_With => Bool.From_TOML'Access, - others => Labeled.From_TOML'Access); - -- This loader is used in the [general] crate section + External_Private_Loaders : constant Loader_Array (Property_Keys) := + (Hint => Labeled.From_TOML'Access, + others => null); + -- This loader is used for properties common to all external classes, found + -- in their private [[external]] sections + + External_Shared_Loaders : constant Loader_Array (Property_Keys) := + (Authors | + Description => Labeled.From_TOML'Access, + Licenses => + Properties.Licenses.From_TOML'Access, + Long_Description | + Maintainers | + Maintainers_Logins | + Name | + Tags | + Website => Labeled.From_TOML'Access, + others => null); + -- This loader is used for properties a manifest containing externals may + -- provide, shared by all external definitions found therein Release_Loaders : constant Loader_Array (Property_Keys) := (Actions => Properties.Actions.From_TOML'Access, + Authors => Labeled.From_TOML'Access, + Auto_GPR_With => Bool.From_TOML'Access, + Description => Labeled.From_TOML'Access, Environment => Properties.Environment.From_TOML'Access, Executables => Labeled.From_TOML'Access, - GPR_Externals .. + GPR_Externals | GPR_Set_Externals => Scenarios.From_TOML'Access, - Notes => Labeled.From_TOML'Access, - Project_Files => Labeled.From_TOML'Access, - Auto_GPR_With => Bool.From_TOML'Access, - others => null); - -- This loader applies to release sections + Hint => null, + Licenses => Properties.Licenses.From_TOML'Access, + Long_Description | + Maintainers | + Maintainers_Logins | + Name | + Notes | + Project_Files | + Tags | + Version | + Website => Labeled.From_TOML'Access); + -- This loader applies to a normal release manifest -- The following array determines which properties accept dynamic -- expressions, per index semantics. All other properties must be static. @@ -93,13 +132,13 @@ package Alire.Properties.From_TOML with Preelaborate is use all type Crates.Sections; - function External_Loader (From : TOML_Adapters.Key_Queue) - return Conditional.Properties is - (Loader (From, External_Loaders, External_Section)); + function External_Private_Loader (From : TOML_Adapters.Key_Queue) + return Conditional.Properties is + (Loader (From, External_Private_Loaders, External_Private_Section)); - function General_Loader (From : TOML_Adapters.Key_Queue) + function External_Shared_Loader (From : TOML_Adapters.Key_Queue) return Conditional.Properties is - (Loader (From, General_Loaders, General_Section)); + (Loader (From, External_Shared_Loaders, External_Shared_Section)); function Release_Loader (From : TOML_Adapters.Key_Queue) return Conditional.Properties is @@ -109,8 +148,8 @@ package Alire.Properties.From_TOML with Preelaborate is array (Crates.Sections) of access function (From : TOML_Adapters.Key_Queue) return Conditional.Properties - := (External_Section => External_Loader'Access, - General_Section => General_Loader'Access, - Release_Section => Release_Loader'Access); + := (External_Private_Section => External_Private_Loader'Access, + External_Shared_Section => External_Shared_Loader'Access, + Release_Section => Release_Loader'Access); end Alire.Properties.From_TOML; diff --git a/src/alire/alire-properties-labeled.adb b/src/alire/alire-properties-labeled.adb index 69b6af9f..10b84751 100644 --- a/src/alire/alire-properties-labeled.adb +++ b/src/alire/alire-properties-labeled.adb @@ -1,5 +1,3 @@ -with Alire.Errors; - package body Alire.Properties.Labeled is ------------ @@ -90,9 +88,11 @@ package body Alire.Properties.Labeled is end; end return; exception + when Checked_Error => + raise; -- Let the more informative error raise when E : others => Log_Exception (E); - raise Checked_Error with "Cannot read valid property from " & Key; + From.Checked_Error ("Cannot read valid property from " & Key); end From_TOML; ------------------------ @@ -190,12 +190,6 @@ package body Alire.Properties.Labeled is when others => null; end case; - - exception - when E : Checked_Error => - -- Print the error for the user before raising: - Trace.Error (Errors.Get (E, Clear => False)); - raise; end Validate; end Alire.Properties.Labeled; diff --git a/src/alire/alire-properties-labeled.ads b/src/alire/alire-properties-labeled.ads index a2906c36..709a8ebc 100644 --- a/src/alire/alire-properties-labeled.ads +++ b/src/alire/alire-properties-labeled.ads @@ -31,6 +31,9 @@ package Alire.Properties.Labeled with Preelaborate is Maintainers_Logins, -- E-mails used by the maintainers of a crate to log in to GitHub + Name, + -- Crate name + Notes, -- Specific information about a release @@ -40,6 +43,9 @@ package Alire.Properties.Labeled with Preelaborate is Project_File, -- Buildable project files in the release, with full relative path + Version, + -- Semantic version of the release + Website, -- A website other than the repository @@ -59,28 +65,14 @@ package Alire.Properties.Labeled with Preelaborate is Long_Description => Unique, Maintainer => Multiple, Maintainers_Logins => Multiple, + Name => Unique, Notes => Unique, Path => Multiple, Project_File => Multiple, + Version => Unique, Website => Unique, Tag => Multiple); - Mandatory : array (Labels) of Boolean := - (Author => False, - Description => True, - Executable => False, - Hint => False, - Long_Description => False, - Maintainer => True, - Maintainers_Logins => True, - Notes => False, - Path => False, - Project_File => False, - Website => False, - Tag => False); - -- Some properties are mandatory in the [general] section; we used this - -- array to check their presence. - type Label (<>) is new Properties.Property and Interfaces.Tomifiable @@ -187,11 +179,13 @@ private when Long_Description => TOML_Keys.Long_Descr, when Maintainer => TOML_Keys.Maintainer, when Maintainers_Logins => TOML_Keys.Maint_Logins, + when Name => TOML_Keys.Name, when Notes => TOML_Keys.Notes, when Path => TOML_Keys.Path, when Project_File => TOML_Keys.Project_File, - when Website => TOML_Keys.Website, - when Tag => TOML_Keys.Tag); + when Tag => TOML_Keys.Tag, + when Version => TOML_Keys.Version, + when Website => TOML_Keys.Website); overriding function Key (L : Label) return String is (Key (L.Name)); diff --git a/src/alire/alire-releases.adb b/src/alire/alire-releases.adb index 4be7113a..fdd2c54e 100644 --- a/src/alire/alire-releases.adb +++ b/src/alire/alire-releases.adb @@ -1,5 +1,6 @@ with Ada.Strings.Fixed; +with Alire.Crates; with Alire.Defaults; with Alire.Requisites.Booleans; with Alire.TOML_Load; @@ -87,14 +88,6 @@ package body Alire.Releases is end return; end Renaming; - -------------- - -- Renaming -- - -------------- - - function Renaming (Base : Release; - Provides : Crates.Named'Class) return Release is - (Base.Renaming (Provides.Name)); - --------------- -- Replacing -- --------------- @@ -232,17 +225,25 @@ package body Alire.Releases is Properties => Properties, Available => Available); + ----------------------- + -- New_Empty_Release -- + ----------------------- + + function New_Empty_Release (Name : Crate_Name) return Release + is (New_Working_Release (Name => Name, + Properties => Conditional.No_Properties)); + ------------------------- -- New_Working_Release -- ------------------------- function New_Working_Release (Name : Crate_Name; - Origin : Origins.Origin := Origins.New_Filesystem (".."); + Origin : Origins.Origin := Origins.New_Filesystem (".."); Dependencies : Conditional.Dependencies := Conditional.For_Dependencies.Empty; Properties : Conditional.Properties := - Conditional.For_Properties.Empty) + Default_Properties) return Release is (Prj_Len => Name.Length, Notes_Len => 0, @@ -253,10 +254,9 @@ package body Alire.Releases is Notes => "", Dependencies => Dependencies, Forbidden => Conditional.For_Dependencies.Empty, - Properties => (if Properties = Conditional.For_Properties.Empty - then Default_Properties - else Properties), - Available => Requisites.Booleans.Always_True); + Properties => Properties, + Available => Requisites.Trees.Empty_Tree -- empty evaluates to True + ); ------------------------- -- On_Platform_Actions -- @@ -519,6 +519,26 @@ package body Alire.Releases is end if; end Print; + -------------- + -- Property -- + -------------- + + function Property (R : Release; + Key : Alire.Properties.Labeled.Labels) + return String + is + use Alire.Properties.Labeled; + Target : constant Alire.Properties.Vector := + Filter (R.Properties, Key); + begin + if Target.Length not in 1 then + raise Constraint_Error with + "Unexpected property count:" & Target.Length'Img; + end if; + + return Label (Target.First_Element).Value; + end Property; + ----------------------- -- Property_Contains -- ----------------------- @@ -545,15 +565,41 @@ package body Alire.Releases is return False; end Property_Contains; + ------------------- + -- From_Manifest -- + ------------------- + + function From_Manifest (File_Name : Any_Path) return Release + is + (From_TOML + (TOML_Adapters.From + (TOML_Load.Load_File (File_Name), + "Loading release from manifest: " & File_Name))); + + --------------- + -- From_TOML -- + --------------- + + function From_TOML (From : TOML_Adapters.Key_Queue) return Release is + begin + From.Assert_Key (TOML_Keys.Name, TOML.TOML_String); + + return This : Release := New_Empty_Release + (Name => +From.Unwrap.Get (TOML_Keys.Name).As_String) + do + Assert (This.From_TOML (From)); + end return; + end From_TOML; + --------------- -- From_TOML -- --------------- - overriding function From_TOML (This : in out Release; From : TOML_Adapters.Key_Queue) return Outcome is + package Labeled renames Alire.Properties.Labeled; begin Trace.Debug ("Loading release " & This.Milestone.Image); @@ -569,19 +615,19 @@ package body Alire.Releases is -- Properties - declare - Result : constant Outcome := - TOML_Load.Load_Crate_Section - (Crates.Release_Section, - From, - This.Properties, - This.Dependencies, - This.Available); - begin - if not Result.Success then - return Result; - end if; - end; + TOML_Load.Load_Crate_Section + (Crates.Release_Section, + From, + This.Properties, + This.Dependencies, + This.Available); + + -- Consolidate/validate some properties as fields: + + Assert (This.Name_Str = This.Property (Labeled.Name), + "Mismatched name property and given name at release creation"); + + This.Version := Semver.New_Version (This.Property (Labeled.Version)); -- Check for remaining keys, which must be erroneous: return From.Report_Extra_Keys; @@ -607,59 +653,57 @@ package body Alire.Releases is use all type Alire.Properties.Labeled.Cardinalities; use all type Alire.Requisites.Tree; use TOML_Adapters; - Root : constant TOML.TOML_Value := TOML.Create_Table; - Relinfo : TOML.TOML_Value := TOML.Create_Table; + Root : TOML.TOML_Value := R.Properties.To_TOML; begin + -- Name + Root.Set (TOML_Keys.Name, +R.Name_Str); - -- TODO: move generation of the [general] crate part to Alire.Crates. + -- Version + Root.Set (TOML_Keys.Version, +Semver.Image (R.Version)); - -- General properties - declare - General : constant TOML.TOML_Value := R.Properties.To_TOML; - begin + -- Alias/Provides + if UStrings.Length (R.Alias) > 0 then + Root.Set (TOML_Keys.Provides, +(+R.Alias)); + end if; - -- Alias/Provides - if UStrings.Length (R.Alias) > 0 then - General.Set (TOML_Keys.Provides, +(+R.Alias)); - end if; + -- Notes + if R.Notes'Length > 0 then + Root.Set (TOML_Keys.Notes, +R.Notes); + end if; - -- Notes - if R.Notes'Length > 0 then - General.Set (TOML_Keys.Notes, +R.Notes); + -- Ensure atoms are atoms and arrays are arrays + for Label in APL.Cardinality'Range loop + if Root.Has (APL.Key (Label)) then + case APL.Cardinality (Label) is + when Unique => + pragma Assert + (Root.Get + (APL.Key (Label)).Kind in TOML.Atom_Value_Kind); + when Multiple => + Root.Set + (APL.Key (Label), + TOML_Adapters.To_Array + (Root.Get (APL.Key (Label)))); + end case; end if; - - -- Ensure atoms are atoms and arrays are arrays - for Label in APL.Cardinality'Range loop - if General.Has (APL.Key (Label)) then - case APL.Cardinality (Label) is - when Unique => - pragma Assert - (General.Get - (APL.Key (Label)).Kind in TOML.Atom_Value_Kind); - when Multiple => - General.Set - (APL.Key (Label), - TOML_Adapters.To_Array - (General.Get (APL.Key (Label)))); - end case; - end if; - end loop; - - -- Final assignment, always have general section. - Root.Set (TOML_Keys.General, General); - end; + end loop; -- Origin - Relinfo := TOML.Merge (Relinfo, R.Origin.To_TOML); + Root := TOML.Merge (Root, R.Origin.To_TOML); - -- Dependencies + -- Dependencies, wrapped as an array if not R.Dependencies.Is_Empty then - Relinfo.Set (TOML_Keys.Depends_On, R.Dependencies.To_TOML); + declare + Dep_Array : constant TOML.TOML_Value := TOML.Create_Array; + begin + Dep_Array.Append (R.Dependencies.To_TOML); + Root.Set (TOML_Keys.Depends_On, Dep_Array); + end; end if; -- Forbidden if not R.Forbidden.Is_Empty then - Relinfo.Set (TOML_Keys.Forbidden, R.Forbidden.To_TOML); + Root.Set (TOML_Keys.Forbidden, R.Forbidden.To_TOML); end if; -- Available @@ -668,12 +712,9 @@ package body Alire.Releases is then null; -- Do nothing, do not pollute .toml file else - Relinfo.Set (TOML_Keys.Available, R.Available.To_TOML); + Root.Set (TOML_Keys.Available, R.Available.To_TOML); end if; - -- Version release - Root.Set (R.Version_Image, Relinfo); - return Root; end To_TOML; diff --git a/src/alire/alire-releases.ads b/src/alire/alire-releases.ads index c9ea8c96..284318fa 100644 --- a/src/alire/alire-releases.ads +++ b/src/alire/alire-releases.ads @@ -6,7 +6,6 @@ with Alire.Dependencies; with Alire.Interfaces; with Alire.Milestones; with Alire.Origins; -with Alire.Crates; with Alire.Properties.Actions; with Alire.Properties.Environment; with Alire.Properties.Labeled; @@ -23,18 +22,20 @@ with TOML; private with Alire.OS_Lib; private with Alire.Utils.TTY; -package Alire.Releases with Preelaborate is +package Alire.Releases is -- subtype Dependency_Vector is Dependencies.Vectors.Vector; type Release (<>) is new Interfaces.Tomifiable - and Interfaces.Detomifiable and Interfaces.Yamlable with private; function "<" (L, R : Release) return Boolean; + function Default_Properties return Conditional.Properties; + -- Returns the values in Defaults already wrapped as properties + function New_Release (Name : Crate_Name; Version : Semantic_Versioning.Version; Origin : Origins.Origin; @@ -44,19 +45,23 @@ package Alire.Releases with Preelaborate is Available : Alire.Requisites.Tree) return Release; + function New_Empty_Release (Name : Crate_Name) return Release; + -- Equivalent to calling New_Working_Release with default values BUT with + -- empty properties (i.e., defaults are not used). + function New_Working_Release (Name : Crate_Name; - Origin : Origins.Origin := Origins.New_Filesystem (".."); + Origin : Origins.Origin := Origins.New_Filesystem (".."); Dependencies : Conditional.Dependencies := Conditional.For_Dependencies.Empty; Properties : Conditional.Properties := - Conditional.For_Properties.Empty + Default_Properties ) - return Release; - -- For working releases that may have incomplete information + -- For working releases that may have incomplete information. Note that the + -- default properties are used by default. function Extending (Base : Release; @@ -68,9 +73,6 @@ package Alire.Releases with Preelaborate is function Renaming (Base : Release; Provides : Crate_Name) return Release; - - function Renaming (Base : Release; - Provides : Crates.Named'Class) return Release; -- Fills-in the "provides" field -- During resolution, a release that has a renaming will act as the -- "Provides" release, so both releases cannot be selected simultaneously. @@ -158,6 +160,12 @@ package Alire.Releases with Preelaborate is return Conditional.Dependencies; -- Retrieve only the dependencies that apply on platform P + function Property (R : Release; + Key : Alire.Properties.Labeled.Labels) + return String; + -- Return a property that must exist, be unique, platform-independent, and + -- and atomic label: description, version... Raise otherwise. + function Properties (R : Release) return Conditional.Properties; function Origin (R : Release) return Origins.Origin; @@ -264,13 +272,10 @@ package Alire.Releases with Preelaborate is -- Return the dependency that represents this very release (crate=version), -- wrapped as a dependency tree with a single value. - overriding - function From_TOML (This : in out Release; - From : TOML_Adapters.Key_Queue) - return Outcome; - -- Fill in the release-specific parts. This expects the common information - -- from [general] to be already present in the release, since From points - -- to the release proper. + function From_Manifest (File_Name : Any_Path) return Release; + + function From_TOML (From : TOML_Adapters.Key_Queue) return Release; + -- Load a release from a TOML table overriding function To_TOML (R : Release) return TOML.TOML_Value; @@ -295,7 +300,6 @@ private type Release (Prj_Len, Notes_Len : Natural) is new Interfaces.Tomifiable - and Interfaces.Detomifiable and Interfaces.Yamlable with record Name : Crate_Name (Prj_Len); @@ -309,6 +313,11 @@ private Available : Requisites.Tree; end record; + function From_TOML (This : in out Release; + From : TOML_Adapters.Key_Queue) + return Outcome; + -- Fill in an already existing release + use all type Conditional.Properties; function "<" (L, R : Release) return Boolean diff --git a/src/alire/alire-root.adb b/src/alire/alire-root.adb index 0bdc102f..28465029 100644 --- a/src/alire/alire-root.adb +++ b/src/alire/alire-root.adb @@ -1,7 +1,7 @@ with Alire.Directories; with Alire.Errors; with Alire.Paths; -with Alire.TOML_Index; +with Alire.Releases; package body Alire.Root is @@ -21,7 +21,7 @@ package body Alire.Root is Extension => Paths.Crate_File_Extension_With_Dot); begin return Roots.New_Root - (TOML_Index.Load_Release_From_File (File), + (Releases.From_Manifest (File), Path, Platform_Properties); exception diff --git a/src/alire/alire-roots.adb b/src/alire/alire-roots.adb index 7021919c..24c1efb6 100644 --- a/src/alire/alire-roots.adb +++ b/src/alire/alire-roots.adb @@ -7,7 +7,6 @@ with Alire.Lockfiles; with Alire.OS_Lib; with Alire.Paths; with Alire.Root; -with Alire.TOML_Index; with Alire.Workspace; with GNAT.OS_Lib; @@ -48,7 +47,7 @@ package body Alire.Roots is if Crate_File /= "" then declare Release : constant Releases.Release := - TOML_Index.Load_Release_From_File (Crate_File); + Releases.From_Manifest (Crate_File); begin -- Crate loaded properly, we can return a valid root here Trace.Debug ("Valid root found at " & Path); diff --git a/src/alire/alire-solutions.adb b/src/alire/alire-solutions.adb index b1add982..696af3f1 100644 --- a/src/alire/alire-solutions.adb +++ b/src/alire/alire-solutions.adb @@ -1,6 +1,6 @@ with Ada.Containers; -with Alire.Crates.With_Releases; +with Alire.Crates; with Alire.Dependencies.Containers; with Alire.Dependencies.Graphs; with Alire.Index; @@ -628,7 +628,7 @@ package body Alire.Solutions is Table.Append (TTY.Version (Dep.Versions.Image)); end if; - Index.Add_Externals (Dep.Crate, Root.Environment); + Index.Detect_Externals (Dep.Crate, Root.Environment); -- Detect externals for the crate, in case they add more versions declare diff --git a/src/alire/alire-solver.adb b/src/alire/alire-solver.adb index ec20f4c1..f679bcfa 100644 --- a/src/alire/alire-solver.adb +++ b/src/alire/alire-solver.adb @@ -397,7 +397,7 @@ package body Alire.Solver is -- below. if Options.Detecting = Detect then - Index.Add_Externals (Dep.Crate, Props); + Index.Detect_Externals (Dep.Crate, Props); end if; -- Check the releases now: diff --git a/src/alire/alire-toml_adapters.adb b/src/alire/alire-toml_adapters.adb index f2caf33b..2721709a 100644 --- a/src/alire/alire-toml_adapters.adb +++ b/src/alire/alire-toml_adapters.adb @@ -2,6 +2,18 @@ with Alire.Errors; package body Alire.TOML_Adapters is + ------------ + -- Assert -- + ------------ + + procedure Assert (Queue : Key_Queue; Condition : Boolean; Message : String) + is + begin + if not Condition then + Queue.Checked_Error (Message); + end if; + end Assert; + ---------------- -- Assert_Key -- ---------------- diff --git a/src/alire/alire-toml_adapters.ads b/src/alire/alire-toml_adapters.ads index 217210b2..44d11725 100644 --- a/src/alire/alire-toml_adapters.ads +++ b/src/alire/alire-toml_adapters.ads @@ -41,6 +41,9 @@ package Alire.TOML_Adapters with Preelaborate is Post => not Failure'Result.Success; -- Return a failed Outcome, using the Context & Message as information. + procedure Assert (Queue : Key_Queue; Condition : Boolean; Message : String); + -- If Condition is False, call Queue.Checked_Error (Message) + procedure Checked_Error (Queue : Key_Queue; Message : String) with No_Return; -- Raise a Checked error with Context & ": " & Message, using Alire.Errors. diff --git a/src/alire/alire-toml_expressions-cases.ads b/src/alire/alire-toml_expressions-cases.ads index 83be6f4a..dfa028a9 100644 --- a/src/alire/alire-toml_expressions-cases.ads +++ b/src/alire/alire-toml_expressions-cases.ads @@ -5,7 +5,7 @@ package Alire.TOML_Expressions.Cases with Preelaborate is function Load_Dependencies (From : TOML_Adapters.Key_Queue) return Conditional.Dependencies; - -- From is a "depends-on = ..." table. + -- From is the RHS of a "depends-on = { ... }" table. subtype Static_Loader is Conditional.Property_Loader; diff --git a/src/alire/alire-toml_expressions.ads b/src/alire/alire-toml_expressions.ads index 3f59ca0d..58f5af04 100644 --- a/src/alire/alire-toml_expressions.ads +++ b/src/alire/alire-toml_expressions.ads @@ -114,7 +114,7 @@ package Alire.TOML_Expressions with Preelaborate is -- Entry point into loading expression trees. Identifies case(xx) -- expressions, which are recursively loaded using the Loaders, or using -- Static_Loader for final values. Parent is the "key" being loaded. - -- From points to the RHS value or case expr May raise Checked_Error. + -- From points to the RHS value or case expr. May raise Checked_Error. end Enum_Trees; diff --git a/src/alire/alire-toml_index.adb b/src/alire/alire-toml_index.adb index 52cebce3..bcb3c62b 100644 --- a/src/alire/alire-toml_index.adb +++ b/src/alire/alire-toml_index.adb @@ -1,9 +1,6 @@ with Ada.Directories; -with Ada.Exceptions; -with Ada.Text_IO; with Alire.Directories; -with Alire.Errors; with Alire.GPR; with Alire.Hashes.SHA512_Impl; pragma Unreferenced (Alire.Hashes.SHA512_Impl); @@ -15,7 +12,9 @@ with Alire.Hashes.SHA512_Impl; pragma Unreferenced (Alire.Hashes.SHA512_Impl); with Alire.Index; with Alire.Origins.Deployers.Filesystem; with Alire.Origins.Tweaks; -with Alire.Utils; +with Alire.TOML_Keys; +with Alire.TOML_Load; +with Alire.Utils.TTY; with Alire.VCSs.Git; with GNATCOLL.VFS; @@ -24,13 +23,12 @@ with Semantic_Versioning; with TOML; use type TOML.Any_Value_Kind, TOML.TOML_Value; -with TOML.File_IO; package body Alire.TOML_Index is - package Dirs renames Ada.Directories; - package Exc renames Ada.Exceptions; - package TIO renames Ada.Text_IO; + package Dirs renames Ada.Directories; + package Semver renames Semantic_Versioning; + package TTY renames Utils.TTY; procedure Set_Error (Result : out Load_Result; @@ -39,12 +37,6 @@ package body Alire.TOML_Index is with Post => not Result.Success; -- Set Result to not successful and assign an error message to it - function Load_TOML_From_File - (Filename : String; Result : out Load_Result) return TOML.TOML_Value; - -- Load a TOML document from the content of the given Filename and return - -- it. In case of error, the result is not significant and Result.Success - -- is set to False. Otherwise, it is set to True. - procedure Check_Index (Index : Index_On_Disk.Index'Class; Root : Any_Path; Result : out Load_Result) @@ -52,27 +44,25 @@ package body Alire.TOML_Index is -- Check that Catalog_Dir contains a file called "index.toml" and that it -- describes a supported catalog. - procedure Load_Package_Directory - (Catalog_Dir, Package_Dir : String; - Result : out Load_Result) - with Pre => Result.Success; - -- Load packages from all *.toml files in Catalog_Dir/Package_Dir + procedure Load_Manifest (Item : Ada.Directories.Directory_Entry_Type; + Stop : in out Boolean); + -- Check if entry is a candidate to manifest file, and in that case load + -- its contents. May raise Checked_Error. procedure Load_From_Catalog_Internal - (Catalog_Dir, Package_Name : String; - Result : out Load_Result); - -- Like Load_From_Catalog, but do not check the index - - function Package_Directory (Package_Name : String) return String is - (Package_Name (Package_Name'First .. Package_Name'First + 1)); - -- Return the name of the directory that must contain the description of - -- the given package. - - Package_File_Suffix : constant String := ".toml"; + (File_Name : Absolute_Path; + Name : Crate_Name; + Version : String); + -- Do the actual loading of a file that pass tests based on name/location. + -- Name and version have been deduced from the file name and will be used + -- for double-checks. + + Package_File_Suffix : constant String := "toml"; -- Suffix for the name of package description files - subtype Package_Name_Character is Crate_Character - with Static_Predicate => Package_Name_Character /= Extension_Separator; + External_File_Marker : constant String := "external"; + -- External definition files, instead of crate-x.x.x.toml, are named + -- crate-external.toml. --------------- -- Set_Error -- @@ -93,59 +83,6 @@ package body Alire.TOML_Index is (Full_Context & ": " & Message)); end Set_Error; - ------------------------ - -- Valid_Package_Name -- - ------------------------ - - function Valid_Package_Name (Name : String) return Boolean is - begin - if Name'Length = 0 then - return False; - end if; - - for I in Name'Range loop - if I in Name'First | Name'Last and then Name (I) = '_' then - - -- Reject leading and trailing underscores - - return False; - - elsif I = Name'First and then Name (I) in '0' .. '9' then - - -- Reject leading digits - - return False; - - elsif Name (I) = '_' and then Name (I - 1) = '_' then - - -- Reject consecutive underscores - - return False; - end if; - end loop; - - return True; - end Valid_Package_Name; - - ------------------------- - -- Load_TOML_From_File -- - ------------------------- - - function Load_TOML_From_File - (Filename : String; Result : out Load_Result) return TOML.TOML_Value - is - TOML_Result : constant TOML.Read_Result := - TOML.File_IO.Load_File (Filename); - begin - if TOML_Result.Success then - Result := Outcome_Success; - return TOML_Result.Value; - else - Set_Error (Result, Filename, TOML.Format_Error (TOML_Result)); - return TOML.No_TOML_Value; - end if; - end Load_TOML_From_File; - ----------------- -- Check_Index -- ----------------- @@ -161,10 +98,7 @@ package body Alire.TOML_Index is begin -- Read "index.toml" - Value := Load_TOML_From_File (Filename, Result); - if not Result.Success then - return; - end if; + Value := TOML_Load.Load_File (Filename); -- Ensure metadata structure is as expected @@ -279,12 +213,6 @@ package body Alire.TOML_Index is end case; end Locate_Root; - Search : Dirs.Search_Type; - -- Look for all directories in Catalog_Dir. We will process only the - -- ones whose names contain exactly two characters in 'a' .. 'z' | '_'. - - Dir_Entry : Dirs.Directory_Entry_Type; - Root : constant Any_Path := Locate_Root (Result); -- Locate a dir containing a 'index.toml' metadata file inside the repo. -- This is the directory containing the actual crates. @@ -301,239 +229,213 @@ package body Alire.TOML_Index is return; end if; - -- Go through all directories allowed to contain packages + -- Go through all directories looking for release manifests begin - Dirs.Start_Search - (Search => Search, - Directory => Root, - Pattern => "", - Filter => (Dirs.Directory => True, others => False)); + Alire.Directories.Traverse_Tree + (Start => Root, + Doing => Load_Manifest'Access, + Recurse => True); exception - when E : TIO.Use_Error | TIO.Name_Error => - Set_Error (Result, Root, Exc.Exception_Name (E), - "looking for packages"); + when E : Checked_Error => + Result := Outcome_From_Exception (E); end; - - while Result.Success and then Dirs.More_Entries (Search) loop - Dirs.Get_Next_Entry (Search, Dir_Entry); - declare - Simple_Name : constant String := Dirs.Simple_Name (Dir_Entry); - First, Last : Character; - begin - if Simple_Name'Length = 2 then - First := Simple_Name (Simple_Name'First); - Last := Simple_Name (Simple_Name'Last); - if First in Package_Name_Character - and then First not in '_' - and then Last in Package_Name_Character - then - Load_Package_Directory - (Root, Simple_Name, Result); - end if; - end if; - end; - end loop; - - Dirs.End_Search (Search); end Load; - ---------------------------- - -- Load_Package_Directory -- - ---------------------------- + ------------------- + -- Load_Manifest -- + ------------------- - procedure Load_Package_Directory - (Catalog_Dir, Package_Dir : String; - Result : out Load_Result) + procedure Load_Manifest (Item : Ada.Directories.Directory_Entry_Type; + Stop : in out Boolean) is - Package_Dir_Full : constant String := - Dirs.Compose (Catalog_Dir, Package_Dir); - -- Full name for the directory under which we must look for package - -- descriptions. + pragma Unreferenced (Stop); + use Ada.Directories; + begin + if Kind (Item) /= Ordinary_File then + return; + end if; - Search : Dirs.Search_Type; - -- Look for all files in Package_Dir_Full whose name matches "*.toml" - -- and try to load them as package descriptions. + Trace.Debug ("Checking manifest candidate file: " & Full_Name (Item)); - Dir_Entry : Dirs.Directory_Entry_Type; - begin + -- We expect a /cr/crate_name/crate_name-version.toml structure + + declare + Path : constant Absolute_Path := Full_Name (Item); + File : constant Simple_File := Simple_Name (Item); + Parent : constant Absolute_Path := Containing_Directory (Path); + Shelf : constant Absolute_Path := Containing_Directory (Parent); + + subtype Shelf_Name is String with + Dynamic_Predicate => + Shelf_Name'Length = 2 and then + (for all Char of Shelf_Name => Char in Crate_Character) and then + Shelf_Name (Shelf_Name'First) /= '_'; begin - Dirs.Start_Search - (Search => Search, - Directory => Package_Dir_Full, - Pattern => "", - Filter => (Dirs.Ordinary_File => True, others => False)); - exception - when E : TIO.Use_Error | TIO.Name_Error => - Set_Error (Result, Package_Dir_Full, Exc.Exception_Name (E), - "looking for packages"); - end; - while Result.Success and then Dirs.More_Entries (Search) loop - Dirs.Get_Next_Entry (Search, Dir_Entry); + -- Skip the index metadata file + + if File = "index.toml" then + return; + end if; + + -- Basic checks + + if Extension (File) /= Package_File_Suffix then + Raise_Checked_Error ("Unexpected file in index: " & Path); + end if; + + if not Utils.Contains (File, "-") then + Raise_Checked_Error ("Malformed manifest file name: " & Path); + end if; + + if Simple_Name (Shelf) not in Shelf_Name then + Raise_Checked_Error ("Malformed shelf folder name: " & Shelf); + end if; + declare - Simple_Name : constant String := Dirs.Simple_Name (Dir_Entry); + -- Name/version deducted from file name, to double check + FS_Name : constant Crate_Name := +Utils.Head (File, '-'); + FS_Version : constant String := + Utils.Tail (Base_Name (File), '-'); begin - if Utils.Ends_With (Simple_Name, Package_File_Suffix) then - declare - Package_Name : String renames Simple_Name - (Simple_Name'First - .. Simple_Name'Last - Package_File_Suffix'Length); - begin - -- Reject invalid package names - - if not Valid_Package_Name (Package_Name) then - Set_Error (Result, Package_Dir_Full, - "invalid package name: " & Simple_Name, - "looking for packages"); - exit; - end if; - - -- Reject files not in the appropriate directory - - if Package_Directory (Package_Name) /= Package_Dir then - Set_Error (Result, Package_Dir_Full, - "bad location for " & Simple_Name, - "looking for packages"); - exit; - end if; - - Load_From_Catalog_Internal - (Catalog_Dir, Package_Name, Result); - if not Result.Success then - exit; - end if; - end; + + -- Preliminary checks based on file name + + if not Utils.Starts_With + (Full_String => +FS_Name, + Substring => Simple_Name (Shelf)) + then + Raise_Checked_Error ("Mismatch between manifest and shelf: " + & Path); end if; - end; - end loop; - Dirs.End_Search (Search); - end Load_Package_Directory; + if +FS_Name /= Simple_Name (Parent) then + Raise_Checked_Error ("Mismatch between manifest and parent: " + & Path); + end if; + + Load_From_Catalog_Internal (File_Name => Path, + Name => FS_Name, + Version => FS_Version); + end; + end; + end Load_Manifest; -------------------------------- -- Load_From_Catalog_Internal -- -------------------------------- procedure Load_From_Catalog_Internal - (Catalog_Dir, Package_Name : String; - Result : out Load_Result) + (File_Name : Absolute_Path; + Name : Crate_Name; + Version : String) is - Filename : constant String := - Dirs.Compose - (Dirs.Compose (Catalog_Dir, Package_Directory (Package_Name)), - Package_Name & ".toml"); + + ------------------- + -- Error_In_File -- + ------------------- + + function Error_In_File (Name, Error : String) return String + is ("Error loading " & Name & ": " & Error); Value : TOML.TOML_Value; begin - Trace.Debug ("Loading " & Package_Name & " from " & Catalog_Dir); + Trace.Debug ("Loading " + & TTY.Name (Name) & " " & TTY.Version (Version) + & " from " & File_Name); -- Load the TOML file - Value := Load_TOML_From_File (Filename, Result); - if not Result.Success then - return; - end if; + Value := TOML_Load.Load_File (File_Name); - -- Decode as Crate + -- Minimal name/version checks - declare - Crate : Crates.With_Releases.Crate := - Crates.With_Releases.New_Crate - (+Utils.To_Lower_Case (Package_Name)); - begin - Result := Crate.From_TOML (TOML_Adapters.From - (Value, - Context => "Loading crate " & Filename)); + Assert (Value.Kind = TOML.TOML_Table, + Error_In_File (File_Name, "Missing top-level table")); - if Result.Success then - Index_Crate (Filename, Crate); - end if; - end; - end Load_From_Catalog_Internal; + Assert (Value.Has (TOML_Keys.Name), + Error_In_File (File_Name, "Missing name field")); - ---------------------------- - -- Load_Release_From_File -- - ---------------------------- + Assert (Value.Get (TOML_Keys.Name).As_String = +Name, + Error_In_File (File_Name, "External/internal name mismatch: " + & "External is " & (+Name) & ", internal is " + & Value.Get (TOML_Keys.Name).As_String)); - function Load_Release_From_File (Filename : String) return Releases.Release - is - Name : constant String := - Dirs.Base_Name (Dirs.Simple_Name (Filename)); - -- This file is requested by Alire so we don't need to check that it's a - -- proper TOML name. - - -- Attempt to load the file - Result : Load_Result; - Value : constant TOML.TOML_Value := - Load_TOML_From_File (Filename, Result); - begin - if not Result.Success then - raise Checked_Error with Errors.Set (Message (Result)); + if Version = "external" then + Assert (not Value.Has (TOML_Keys.Version), + Error_In_File (File_Name, + "Expected external definitions but found version field")); + else + Assert (Value.Has (TOML_Keys.Version), + Error_In_File (File_Name, "Missing version field")); + declare + use type Semver.Version; + Internal : constant String := + Value.Get (TOML_Keys.Version).As_String; + begin + Assert (Semver.Parse (Version) = Semver.Parse (Internal), + Error_In_File (File_Name, + "Mismatched versions: file name says " & Version + & " but contents say " & Internal)); + end; end if; - -- Parse the TOML structure - declare - Crate : Crates.With_Releases.Crate := - Crates.With_Releases.New_Crate - (+Utils.To_Lower_Case (Name)); - Result : constant Load_Result := - Crate.From_TOML - (TOML_Adapters.From - (Value, - Context => "Loading crate " & Filename)); - begin - if Result.Success then - if Natural (Crate.Releases.Length) = 1 then - return Crate.Releases.First_Element; - else - raise Checked_Error with Errors.Set - ("File " & Filename & " should contain a single release but " - & "contains" & Crate.Releases.Length'Img & " release(s)"); - end if; - else - raise Checked_Error with Errors.Set (Message (Result)); - end if; - end; - end Load_Release_From_File; + -- Decode as release/externals - ----------------- - -- Index_Crate -- - ----------------- + if Version = External_File_Marker then + Index.Add + (Crates.From_Externals_Manifest + (TOML_Adapters.From + (Value, + Context => + "Loading externals from " & File_Name))); + else + Index_Release + (File_Name, Releases.From_TOML + (TOML_Adapters.From + (Value, + Context => "Loading release from " & File_Name))); + end if; + end Load_From_Catalog_Internal; - procedure Index_Crate (Path : Relative_Path; - Crate : in out Crates.With_Releases.Crate) + ------------------- + -- Index_Release -- + ------------------- + + procedure Index_Release (Path : Relative_Path; + Rel : Releases.Release) is use all type Origins.Kinds; use GNATCOLL; use all type VFS.Filesystem_String; + Fixed : Releases.Release := Rel; begin - for R of Crate.Releases loop - -- Adjust and check a valid path for a local origin. - -- This is delayed until this moment to keep many other - -- packages Preelaborable. - declare - use type Origins.Origin; - Origin : constant Origins.Origin := - Origins.Tweaks.Fixed_Origin (Path, R.Origin); - begin - if Origin.Kind = Filesystem then - if not Origins.Deployers.Filesystem.Is_Valid_Local_Crate - (VFS.Create (+Origin.Path)) - then - raise Checked_Error with - ("Local origin path is not a valid directory: " - & Origin.Path); - end if; - end if; + -- Adjust and check a valid path for a local origin. + -- This is delayed until this moment to keep many other + -- packages Preelaborable. - if Origin /= R.Origin then - Crate.Replace (Release => R.Replacing (Origin)); + declare + use type Origins.Origin; + Origin : constant Origins.Origin := + Origins.Tweaks.Fixed_Origin (Path, Fixed.Origin); + begin + if Origin.Kind = Filesystem then + if not Origins.Deployers.Filesystem.Is_Valid_Local_Crate + (VFS.Create (+Origin.Path)) + then + raise Checked_Error with + ("Local origin path is not a valid directory: " + & Origin.Path); end if; - end; - end loop; + end if; + + if Origin /= Fixed.Origin then + Fixed := Fixed.Replacing (Origin); + end if; + end; - Index.Add (Crate); - end Index_Crate; + Index.Add (Fixed); + end Index_Release; end Alire.TOML_Index; diff --git a/src/alire/alire-toml_index.ads b/src/alire/alire-toml_index.ads index 62acbffe..f56a00b7 100644 --- a/src/alire/alire-toml_index.ads +++ b/src/alire/alire-toml_index.ads @@ -1,16 +1,13 @@ private with TOML; with Alire.Index_On_Disk; -with Alire.Crates.With_Releases; +with Alire.Crates; with Alire.Releases; with Alire.Requisites; with Alire.TOML_Adapters; package Alire.TOML_Index is - function Valid_Package_Name (Name : String) return Boolean; - -- Return whether the given name is a valid package name - subtype Load_Result is Outcome; procedure Load @@ -18,18 +15,14 @@ package Alire.TOML_Index is Result : out Load_Result); -- Load the whole TOML catalog for the given index. - function Load_Release_From_File (Filename : String) return Releases.Release; - -- Load a file that must contain a single release. - -- May raise Checked_Error if Filename hasn't proper contents. - private - procedure Index_Crate (Path : Relative_Path; - Crate : in out Crates.With_Releases.Crate); - -- Add the crate and its releases to the internal index. - -- Path is where on disk the Crate was loaded from. This is necessary - -- to fix relative paths in local origins, which at load time are relative - -- to the Crate location, but at runtime the current dir may be any other. - -- May raise Checked_Error if a release has an invalid path as origin. + procedure Index_Release (Path : Relative_Path; + Rel : Releases.Release); + -- Add the release to the global catalog. Path is where on disk the Crate + -- was loaded from. This is necessary to fix relative paths in local + -- origins, which at load time are relative to the manifest location, but + -- at runtime the current dir may be any other. May raise Checked_Error if + -- a release has an invalid path as origin. end Alire.TOML_Index; diff --git a/src/alire/alire-toml_keys.ads b/src/alire/alire-toml_keys.ads index 1ee2d2af..c1e05514 100644 --- a/src/alire/alire-toml_keys.ads +++ b/src/alire/alire-toml_keys.ads @@ -27,6 +27,7 @@ package Alire.TOML_Keys with Preelaborate is Long_Descr : constant String := "long-description"; Maintainer : constant String := "maintainers"; Maint_Logins : constant String := "maintainers-logins"; + Name : constant String := "name"; Notes : constant String := "notes"; Origin : constant String := "origin"; Origin_Hashes : constant String := "origin-hashes"; @@ -39,6 +40,7 @@ package Alire.TOML_Keys with Preelaborate is Tag : constant String := "tags"; Target : constant String := "target"; Toolchain : constant String := "toolchain"; + Version : constant String := "version"; Version_Cmd : constant String := "version-command"; Version_Regexp : constant String := "version-regexp"; Website : constant String := "website"; diff --git a/src/alire/alire-toml_load.adb b/src/alire/alire-toml_load.adb index 835f42de..5a55eb88 100644 --- a/src/alire/alire-toml_load.adb +++ b/src/alire/alire-toml_load.adb @@ -1,60 +1,119 @@ -with Alire.Errors; with Alire.Properties.From_TOML; with Alire.TOML_Expressions.Cases; with Alire.TOML_Keys; -with TOML; +with TOML.File_IO; package body Alire.TOML_Load is + -- The following are entries in the manifest that are not loaded as + -- properties, but stored separately as complex types. + + type Tables is (Available, + Dependencies); + + Allowed_Tables : constant array (Crates.Sections, Tables) of Boolean := + (Crates.Release_Section => + (others => True), + Crates.External_Shared_Section => + (others => False), + Crates.External_Private_Section => + (Available => True, + Dependencies => False)); + ------------------------ -- Load_Crate_Section -- ------------------------ - function Load_Crate_Section (Section : Crates.Sections; - From : TOML_Adapters.Key_Queue; - Props : in out Conditional.Properties; - Deps : in out Conditional.Dependencies; - Avail : in out Requisites.Tree) - return Outcome + procedure Load_Crate_Section (Section : Crates.Sections; + From : TOML_Adapters.Key_Queue; + Props : in out Conditional.Properties; + Deps : in out Conditional.Dependencies; + Avail : in out Requisites.Tree) is + use TOML; use type Conditional.Dependencies; use type Conditional.Properties; use type Requisites.Tree; TOML_Avail : TOML.TOML_Value; TOML_Deps : TOML.TOML_Value; + begin + + -- Check mandatory fields existence + + for Ada_Key in Properties.From_TOML.Mandatory'Range (2) loop + declare + TOML_Key : constant String := TOML_Adapters.Tomify (Ada_Key'Img); + begin + if Properties.From_TOML.Mandatory (Section, Ada_Key) then + if not From.Unwrap.Has (TOML_Key) then + From.Checked_Error + ("mandatory property missing: " & TOML_Key); + end if; + end if; + end; + end loop; + -- Process Dependencies - if From.Pop (TOML_Keys.Depends_On, TOML_Deps) then - Deps := Deps and - TOML_Expressions.Cases.Load_Dependencies - (TOML_Adapters.From (TOML_Deps, - From.Message (TOML_Keys.Depends_On))); + + if Allowed_Tables (Section, Dependencies) then + if From.Pop (TOML_Keys.Depends_On, TOML_Deps) then + From.Assert (TOML_Deps.Kind = TOML_Array, + "dependencies must be specified as array of tables"); + + for I in 1 .. TOML_Deps.Length loop + Deps := Deps and + TOML_Expressions.Cases.Load_Dependencies + (TOML_Adapters.From + (TOML_Deps.Item (I), + From.Message (TOML_Keys.Depends_On) + & "(group" & I'Img & ")")); + end loop; + end if; + elsif From.Unwrap.Has (TOML_Keys.Depends_On) then + From.Checked_Error ("found field not allowed in manifest section: " + & TOML_Keys.Depends_On); end if; -- TODO: Process Forbidden -- Process Available - if From.Pop (TOML_Keys.Available, TOML_Avail) then - Avail := Avail and - TOML_Expressions.Cases.Load_Requisites - (TOML_Adapters.From (TOML_Avail, - From.Message (TOML_Keys.Available))); + + if Allowed_Tables (Section, Available) then + if From.Pop (TOML_Keys.Available, TOML_Avail) then + Avail := Avail and + TOML_Expressions.Cases.Load_Requisites + (TOML_Adapters.From (TOML_Avail, + From.Message (TOML_Keys.Available))); + end if; + elsif From.Unwrap.Has (TOML_Keys.Available) then + From.Checked_Error ("found field not allowed in manifest section: " + & TOML_Keys.Available); end if; -- Process remaining keys, which must be properties + Props := Props and Properties.From_TOML.Section_Loaders (Section) (From); - return Outcome_Success; - exception - when E : Checked_Error => - return Errors.Get (E); - when E : others => - Log_Exception (E); - return Outcome_Failure ("Unexpected condition: " - & From.Message (Errors.Get (E))); end Load_Crate_Section; + --------------- + -- Load_File -- + --------------- + + function Load_File (File_Name : Any_Path) return TOML.TOML_Value is + TOML_Result : constant TOML.Read_Result := + TOML.File_IO.Load_File (File_Name); + begin + if TOML_Result.Success then + return TOML_Result.Value; + else + Raise_Checked_Error ("Invalid TOML contents in " & File_Name + & ": " & TOML.Format_Error (TOML_Result)); + end if; + end Load_File; + end Alire.TOML_Load; diff --git a/src/alire/alire-toml_load.ads b/src/alire/alire-toml_load.ads index 3d0005de..b007c64b 100644 --- a/src/alire/alire-toml_load.ads +++ b/src/alire/alire-toml_load.ads @@ -3,18 +3,23 @@ with Alire.Crates; with Alire.Requisites; with Alire.TOML_Adapters; -package Alire.TOML_Load with Preelaborate is +with TOML; + +package Alire.TOML_Load is -- Separate package to avoid a circularity, since this is used by both -- Crates and Releases. - function Load_Crate_Section (Section : Crates.Sections; - From : TOML_Adapters.Key_Queue; - Props : in out Conditional.Properties; - Deps : in out Conditional.Dependencies; - Avail : in out Requisites.Tree) - return Outcome; - -- Loads (merging) the parts that can appear in both the [general] section - -- or in a release. + function Load_File (File_Name : Any_Path) return TOML.TOML_Value; + -- Will raise Checked_Error if file contents aren't valid TOML + + procedure Load_Crate_Section (Section : Crates.Sections; + From : TOML_Adapters.Key_Queue; + Props : in out Conditional.Properties; + Deps : in out Conditional.Dependencies; + Avail : in out Requisites.Tree); + -- Loads parts of a manifest, taking into account if we are loading + -- a indexed release, a local release, a external shared section or + -- a external private section. end Alire.TOML_Load; diff --git a/src/alire/alire-types.ads b/src/alire/alire-types.ads index c6569261..afa32c8d 100644 --- a/src/alire/alire-types.ads +++ b/src/alire/alire-types.ads @@ -5,7 +5,7 @@ with Alire.Releases; with Semantic_Versioning.Extended; -package Alire.Types with Preelaborate is +package Alire.Types is -- Recopilation of types for convenient use and documentation diff --git a/src/alire/alire.ads b/src/alire/alire.ads index b40a3516..9576312f 100644 --- a/src/alire/alire.ads +++ b/src/alire/alire.ads @@ -181,7 +181,7 @@ package Alire with Preelaborate is -- corresponding message set in Alire.Errors otherwise. procedure Assert (Condition : Boolean; Or_Else : String); - -- Class Raise_Checked_Error (Or_Else) when Condition is false + -- Calls Raise_Checked_Error (Or_Else) when Condition is false procedure Raise_Checked_Error (Msg : String) with No_Return; -- For errors where we do not return an Outcome_Failure, we log an error diff --git a/src/alr/alr-bootstrap.ads b/src/alr/alr-bootstrap.ads index c34881d3..a78a5cb6 100644 --- a/src/alr/alr-bootstrap.ads +++ b/src/alr/alr-bootstrap.ads @@ -1,4 +1,4 @@ -with Alire; +with Alire.Types; package Alr.Bootstrap is @@ -27,7 +27,7 @@ package Alr.Bootstrap is function Status_Line return String; -- One-liner reporting most interesting information - function No_Dependencies return Types.Platform_Dependencies - renames Types.No_Dependencies; + function No_Dependencies return Alire.Types.Platform_Dependencies + renames Alire.Types.No_Dependencies; end Alr.Bootstrap; diff --git a/src/alr/alr-commands-get.adb b/src/alr/alr-commands-get.adb index 7caa8fd0..feb77a12 100644 --- a/src/alr/alr-commands-get.adb +++ b/src/alr/alr-commands-get.adb @@ -230,7 +230,7 @@ package body Alr.Commands.Get is -- Attempt detection of any defined externals, so they can be used -- afterwards for crate retrieval. - Alire.Index.Add_Externals (Name, Platform.Properties); + Alire.Index.Detect_Externals (Name, Platform.Properties); -- If something was detected we are done diff --git a/src/alr/alr-commands-search.adb b/src/alr/alr-commands-search.adb index cacdf89a..e111fb36 100644 --- a/src/alr/alr-commands-search.adb +++ b/src/alr/alr-commands-search.adb @@ -2,7 +2,7 @@ with Alire.Containers; with Alire.Externals; with Alire.Index; with Alire.Origins.Deployers; -with Alire.Crates.With_Releases; +with Alire.Crates; with Alire.Releases; with Alire.Solutions; with Alire.Solver; @@ -137,7 +137,7 @@ package body Alr.Commands.Search is ------------------------ procedure List_All_Or_Latest - (Crate : Alire.Crates.With_Releases.Crate) is + (Crate : Alire.Crates.Crate) is begin if Cmd.Full then for Release of Crate.Releases loop @@ -154,7 +154,7 @@ package body Alr.Commands.Search is -- List_Externals -- -------------------- - procedure List_Externals (Crate : Alire.Crates.With_Releases.Crate) + procedure List_Externals (Crate : Alire.Crates.Crate) is begin if Cmd.External then @@ -174,10 +174,10 @@ package body Alr.Commands.Search is -- List_Crate -- ---------------- - procedure List_Crate (Crate : Alire.Crates.With_Releases.Crate) is + procedure List_Crate (Crate : Alire.Crates.Crate) is begin if Cmd.Detect then - Alire.Index.Add_Externals (Crate.Name, Platform.Properties); + Alire.Index.Detect_Externals (Crate.Name, Platform.Properties); end if; List_All_Or_Latest (Crate); diff --git a/src/alr/alr-commands-show.adb b/src/alr/alr-commands-show.adb index 7ee9a6c0..7ee11963 100644 --- a/src/alr/alr-commands-show.adb +++ b/src/alr/alr-commands-show.adb @@ -5,6 +5,7 @@ with Alire.Origins.Deployers; with Alire.Platform; with Alire.Platforms; with Alire.Properties; +with Alire.Releases; with Alire.Requisites.Booleans; with Alire.Roots; with Alire.Solutions; @@ -42,7 +43,7 @@ package body Alr.Commands.Show is declare -- Nested so a failure in Query.Find is caught below - Rel : constant Types.Release := + Rel : constant Alire.Releases.Release := (if Current then Root.Current.Release else Query.Find (Name, Versions, Query_Policy)); @@ -174,7 +175,7 @@ package body Alr.Commands.Show is is begin declare - Rel : constant Types.Release := + Rel : constant Alire.Releases.Release := (if Current then Root.Current.Release else Query.Find (Name, Versions, Query_Policy)); @@ -241,7 +242,7 @@ package body Alr.Commands.Show is end if; if Cmd.Detect then - Alire.Index.Add_Externals (Allowed.Crate, Platform.Properties); + Alire.Index.Detect_Externals (Allowed.Crate, Platform.Properties); end if; -- Execute diff --git a/src/alr/alr-commands-test.adb b/src/alr/alr-commands-test.adb index 2c1c6981..cb3100a5 100644 --- a/src/alr/alr-commands-test.adb +++ b/src/alr/alr-commands-test.adb @@ -3,13 +3,14 @@ with Ada.Directories; with Ada.Exceptions; with Alire.Containers; -with Alire.Crates.With_Releases; +with Alire.Crates; with Alire.Defaults; with Alire.Directories; with Alire.Index; with Alire.Milestones; with Alire.OS_Lib.Subprocess; with Alire.Properties.Actions.Executor; +with Alire.Releases; with Alire.Solutions; with Alire.Solver; with Alire.Utils; @@ -102,7 +103,7 @@ package body Alr.Commands.Test is -- Test_Release -- ------------------ - procedure Test_Release (R : Types.Release) is + procedure Test_Release (R : Alire.Releases.Release) is Output : Utils.String_Vector; Start : Time; @@ -409,7 +410,7 @@ package body Alr.Commands.Test is declare Allowed : constant Alire.Milestones.Allowed_Milestones := Alire.Milestones.Crate_Versions (Argument (J)); - Crate : constant Alire.Crates.With_Releases.Crate := + Crate : constant Alire.Crates.Crate := Alire.Index.Crate (Allowed.Crate); Releases : constant Alire.Containers.Release_Set := Crate.Releases; @@ -490,7 +491,7 @@ package body Alr.Commands.Test is elsif Cmd.Redo then Trace.Detail ("Redoing tests"); else - OS_Lib.Traverse_Folder + Alire.Directories.Traverse_Tree (Ada.Directories.Current_Directory, Not_Empty'Access); end if; diff --git a/src/alr/alr-os_lib.adb b/src/alr/alr-os_lib.adb index 1425fc9c..b02cd6d6 100644 --- a/src/alr/alr-os_lib.adb +++ b/src/alr/alr-os_lib.adb @@ -2,42 +2,6 @@ with Alire.OS_Lib.Subprocess; package body Alr.OS_Lib is - --------------------- - -- Traverse_Folder -- - --------------------- - - procedure Traverse_Folder (Folder : String; - Doing : access procedure - (Item : Ada.Directories.Directory_Entry_Type; - Stop : in out Boolean); - Recurse : Boolean := False) - is - use Ada.Directories; - - procedure Go_Down (Item : Directory_Entry_Type) is - Stop : Boolean := False; - begin - if Simple_Name (Item) /= "." and then Simple_Name (Item) /= ".." then - Doing (Item, Stop); - if Stop then - return; - end if; - - if Recurse and then Kind (Item) = Directory then - Traverse_Folder (Folder / Simple_Name (Item), Doing, Recurse); - end if; - end if; - end Go_Down; - - begin - Trace.Debug ("Traversing folder: " & Folder); - - Search (Folder, - "", - (Directory => True, Ordinary_File => True, others => False), - Go_Down'Access); - end Traverse_Folder; - ------------ -- Getenv -- ------------ diff --git a/src/alr/alr-os_lib.ads b/src/alr/alr-os_lib.ads index 27eb5d4d..aafde1a3 100644 --- a/src/alr/alr-os_lib.ads +++ b/src/alr/alr-os_lib.ads @@ -70,16 +70,6 @@ package Alr.OS_Lib is function Is_Folder (Path : Alire.Any_Path) return Boolean renames GNAT.OS_Lib.Is_Directory; - procedure Traverse_Folder (Folder : String; - Doing : access procedure - (Item : Ada.Directories.Directory_Entry_Type; - Stop : in out Boolean); - Recurse : Boolean := False); - -- Traverse all items in a folder, optionally recursively - -- If recursively, the directory entry is passed before entering it - -- "." and ".." are ignored - -- If Stop, stop - private Line_Separator : constant String := ASCII.LF & ""; diff --git a/src/alr/alr.ads b/src/alr/alr.ads index 30544820..3d7db4cf 100644 --- a/src/alr/alr.ads +++ b/src/alr/alr.ads @@ -1,5 +1,4 @@ with Alire; -with Alire.Types; with Simple_Logging; @@ -24,8 +23,6 @@ package Alr with Preelaborate is package Trace renames Simple_Logging; - package Types renames Alire.Types; - function "+" (S : Alire.UString) return String renames Alire.UStrings.To_String; diff --git a/testsuite/drivers/alr.py b/testsuite/drivers/alr.py index 14c29266..7aecffd8 100644 --- a/testsuite/drivers/alr.py +++ b/testsuite/drivers/alr.py @@ -146,7 +146,9 @@ def prepare_indexes(config_dir, working_dir, index_descriptions): if copy_crates_src: crates_dir = fixtures_path('crates') - copytree(crates_dir, os.path.join (working_dir, name, 'crates')) + copytree(crates_dir, os.path.join(working_dir, 'crates')) + # Crates are adjacent to the index but outside it (otherwise the + # index loader detects spurious files). # Finally create the index description in the config directory index_dir = os.path.join(indexes_dir, name) diff --git a/testsuite/fix-versions.sh b/testsuite/fix-versions.sh index 19c75eb6..85a067e1 100755 --- a/testsuite/fix-versions.sh +++ b/testsuite/fix-versions.sh @@ -1,6 +1,6 @@ #!/bin/bash -oldversion=0.2 -newversion=0.3 +oldversion=0.4 +newversion=0.1 find . -type f -name index.toml -exec sed -i "s/$oldversion/$newversion/" {} \; diff --git a/testsuite/fixtures/basic_index/he/hello.toml b/testsuite/fixtures/basic_index/he/hello.toml deleted file mode 100644 index ca0faf93..00000000 --- a/testsuite/fixtures/basic_index/he/hello.toml +++ /dev/null @@ -1,25 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = ["GPL 3.0", "MIT"] -website = "example.com" -maintainers = ["alejandro@mosteo.com", "bob@example.com"] -maintainers-logins = ["mylogin"] -authors = ["Bob", "Alice"] -tags = ["tag1", "other-tag"] -long-description = """ -This is an example of long description in a multi-line string. - -Markdown formating `can` be used to have "nice" display on the website. -""" - -['1.0.1'] -origin = "file://../../crates/hello_1.0.1" - - ['1.0.1'.depends-on] - libhello = "^1.0" - -['1.0.0'] -origin = "file://../../crates/hello_1.0.0" - - ['1.0.0'.depends-on] - libhello = "^1.0" diff --git a/testsuite/fixtures/basic_index/he/hello/hello-1.0.0.toml b/testsuite/fixtures/basic_index/he/hello/hello-1.0.0.toml new file mode 100644 index 00000000..d7120582 --- /dev/null +++ b/testsuite/fixtures/basic_index/he/hello/hello-1.0.0.toml @@ -0,0 +1,14 @@ +description = "\"Hello, world!\" demonstration project" +long-description = "This is an example of long description in a multi-line string.\n\nMarkdown formating `can` be used to have \"nice\" display on the website.\n" +website = "example.com" +name = "hello" +version = "1.0.0" +origin = "file://../../../crates/hello_1.0.0" +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] +maintainers = ["alejandro@mosteo.com", "bob@example.com"] +maintainers-logins = ["mylogin"] +tags = ["tag1", "other-tag"] + +[[depends-on]] +libhello = "^1.0" diff --git a/testsuite/fixtures/basic_index/he/hello/hello-1.0.1.toml b/testsuite/fixtures/basic_index/he/hello/hello-1.0.1.toml new file mode 100644 index 00000000..25a0f448 --- /dev/null +++ b/testsuite/fixtures/basic_index/he/hello/hello-1.0.1.toml @@ -0,0 +1,14 @@ +description = "\"Hello, world!\" demonstration project" +long-description = "This is an example of long description in a multi-line string.\n\nMarkdown formating `can` be used to have \"nice\" display on the website.\n" +website = "example.com" +name = "hello" +version = "1.0.1" +origin = "file://../../../crates/hello_1.0.1" +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] +maintainers = ["alejandro@mosteo.com", "bob@example.com"] +maintainers-logins = ["mylogin"] +tags = ["tag1", "other-tag"] + +[[depends-on]] +libhello = "^1.0" diff --git a/testsuite/fixtures/basic_index/index.toml b/testsuite/fixtures/basic_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/fixtures/basic_index/index.toml +++ b/testsuite/fixtures/basic_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/fixtures/basic_index/li/libhello.toml b/testsuite/fixtures/basic_index/li/libhello.toml deleted file mode 100644 index 46804af7..00000000 --- a/testsuite/fixtures/basic_index/li/libhello.toml +++ /dev/null @@ -1,14 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project support library""" -licenses = [] -maintainers = ["alejandro@mosteo.com"] -maintainers-logins = ["mylogin"] - -[general.gpr-externals] -TEST_GPR_EXTERNAL = ["gpr_ext_A", "gpr_ext_B", "gpr_ext_C"] - -[general.gpr-set-externals] -TEST_GPR_EXTERNAL = "gpr_ext_B" - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" diff --git a/testsuite/fixtures/basic_index/li/libhello/libhello-1.0.0.toml b/testsuite/fixtures/basic_index/li/libhello/libhello-1.0.0.toml new file mode 100644 index 00000000..c7430101 --- /dev/null +++ b/testsuite/fixtures/basic_index/li/libhello/libhello-1.0.0.toml @@ -0,0 +1,13 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] + +[gpr-externals] +TEST_GPR_EXTERNAL = ["gpr_ext_A", "gpr_ext_B", "gpr_ext_C"] + +[gpr-set-externals] +TEST_GPR_EXTERNAL = "gpr_ext_B" diff --git a/testsuite/fixtures/native_index/ma/make.toml b/testsuite/fixtures/basic_index/ma/make/make-external.toml similarity index 68% rename from testsuite/fixtures/native_index/ma/make.toml rename to testsuite/fixtures/basic_index/ma/make/make-external.toml index 2c7469eb..d4d3ff23 100644 --- a/testsuite/fixtures/native_index/ma/make.toml +++ b/testsuite/fixtures/basic_index/ma/make/make-external.toml @@ -1,9 +1,9 @@ -[general] description = "Utility for directing compilation" +name = "make" +licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] -licenses = [] [[external]] kind = "system" -origin = [] # Unavailable in all platforms +origin = [] # Empty on purpose to ensure unavailable in tests diff --git a/testsuite/fixtures/cases_index/he/hello.toml b/testsuite/fixtures/cases_index/he/hello.toml deleted file mode 100644 index 8f1f1422..00000000 --- a/testsuite/fixtures/cases_index/he/hello.toml +++ /dev/null @@ -1,54 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["alejandro@mosteo.com"] -maintainers-logins = ["mylogin"] - - [general.executables.'case(word-size)' ] - bits-64 = "hello" - bits-32 = "hello32" - '...' = "bye" - - [general.gpr-set-externals] - BUILD = "debug" - - [general.gpr-set-externals.'case(os)'] - linux = { OS = "linux" } - macos = { OS = "macos" } - windows = { OS = "windows" } - '...' = { OS = "other" } - - [[ general.actions.'case(os)'.linux ]] - type = "post-fetch" - command = ["make"] - - [[ general.actions.'case(os)'.linux ]] - type = "post-compile" - command = ["hello"] - - [[ general.actions.'case(os)'.'...' ]] - - -['1.0.1'] -origin = "file://../../crates/hello_1.0.1" - - ['1.0.1'.depends-on] - libbye = "^1.0" - - ['1.0.1'.depends-on.'case(os)'.linux] - libhello = "^1.0" - - ['1.0.1'.depends-on.'case(os)'.'...'] - libhello = "^1.1" - - ['1.0.1'.project-files.'case(word-size)' ] - bits-64 = ["hello.gpr"] - bits-32 = ["hello.gpr", "hello32.gpr"] - '...' = ["bye.gpr"] - - ['1.0.1'.available.'case(os)'] - linux = true - '...' = false - ['1.0.1'.available.'case(os)'.windows.'case(word_size)'] - bits_64 = true - '...' = false diff --git a/testsuite/fixtures/cases_index/he/hello/hello-1.0.1.toml b/testsuite/fixtures/cases_index/he/hello/hello-1.0.1.toml new file mode 100644 index 00000000..b5cb480f --- /dev/null +++ b/testsuite/fixtures/cases_index/he/hello/hello-1.0.1.toml @@ -0,0 +1,55 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello" +version = "1.0.1" +origin = "file://../../../crates/hello_1.0.1" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] + +[[depends-on]] +libbye = "^1.0" +[depends-on."case(os)"."..."] +libhello = "^1.1" + +[depends-on."case(os)".linux] +libhello = "^1.0" +[[actions."case(os)"."..."]] + +[[actions."case(os)".linux]] +type = "post-fetch" +command = ["make"] + +[[actions."case(os)".linux]] +type = "post-compile" +command = ["hello"] +[executables."case(word-size)"] +"..." = "bye" +bits-32 = "hello32" +bits-64 = "hello" + +[gpr-set-externals] +BUILD = "debug" +[gpr-set-externals."case(os)"."..."] +OS = "other" + +[gpr-set-externals."case(os)".linux] +OS = "linux" + +[gpr-set-externals."case(os)".macos] +OS = "macos" + +[gpr-set-externals."case(os)".windows] +OS = "windows" + +[available."case(os)"] +"..." = false +linux = true + +[available."case(os)".windows."case(word_size)"] +"..." = false +bits_64 = true + +[project-files."case(word-size)"] +"..." = ["bye.gpr"] +bits-32 = ["hello.gpr", "hello32.gpr"] +bits-64 = ["hello.gpr"] diff --git a/testsuite/fixtures/cases_index/index.toml b/testsuite/fixtures/cases_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/fixtures/cases_index/index.toml +++ b/testsuite/fixtures/cases_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/fixtures/cases_index/li/libhello.toml b/testsuite/fixtures/cases_index/li/libhello.toml deleted file mode 100644 index 3cde818d..00000000 --- a/testsuite/fixtures/cases_index/li/libhello.toml +++ /dev/null @@ -1,34 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project support library""" -licenses = [] -maintainers = ["alejandro@mosteo.com"] -maintainers-logins = ["mylogin"] - -['1.0-linuxonly'] -origin = "file://../../crates/libhello_1.0.0" - ['1.0-linuxonly'.available.'case(os)'] - linux = true - '...' = false - ['1.0-linuxonly'.available.'case(os)'.windows.'case(word_size)'] - bits_64 = true - '...' = false - -['1.0-unavail'] -origin = "file://../../crates/libhello_1.0.0" -available = false - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" - -[[external]] -kind = "system" - [external.origin.'case(distribution)'] - ubuntu = ["libhello"] - debian = ["libhello~1"] - -[[external]] -kind = "hint" - [external.available.'case(toolchain)'] - system = false - user = false - # Test toolchain env var diff --git a/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-linuxonly.toml b/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-linuxonly.toml new file mode 100644 index 00000000..a555aed1 --- /dev/null +++ b/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-linuxonly.toml @@ -0,0 +1,13 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0-linuxonly" +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] +[available."case(os)"] +"..." = false +linux = true +[available."case(os)".windows."case(word_size)"] +"..." = false +bits_64 = true diff --git a/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-unavail.toml b/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-unavail.toml new file mode 100644 index 00000000..770bbc20 --- /dev/null +++ b/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0-unavail.toml @@ -0,0 +1,8 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0-unavail" +available = false +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0.toml b/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0.toml new file mode 100644 index 00000000..f8c16939 --- /dev/null +++ b/testsuite/fixtures/cases_index/li/libhello/libhello-1.0.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/fixtures/cases_index/li/libhello/libhello-external.toml b/testsuite/fixtures/cases_index/li/libhello/libhello-external.toml new file mode 100644 index 00000000..7d3cb683 --- /dev/null +++ b/testsuite/fixtures/cases_index/li/libhello/libhello-external.toml @@ -0,0 +1,18 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] + +[[external]] +kind = "system" +[external.origin."case(distribution)"] +debian = ["libhello~1"] +ubuntu = ["libhello"] + +[[external]] +kind = "hint" +[external.available."case(toolchain)"] +system = false +user = false +# Test toolchain case expressions diff --git a/testsuite/fixtures/checked_index/index.toml b/testsuite/fixtures/checked_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/fixtures/checked_index/index.toml +++ b/testsuite/fixtures/checked_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/fixtures/checked_index/li/libhello.toml b/testsuite/fixtures/checked_index/li/libhello.toml deleted file mode 100644 index bdf983fb..00000000 --- a/testsuite/fixtures/checked_index/li/libhello.toml +++ /dev/null @@ -1,17 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project support library""" -licenses = [] -maintainers = ["alejandro@mosteo.com"] -maintainers-logins = ["mylogin"] - -['1.0-git'] -origin = "git+file://../../crates/libhello_git@ce78e7706c9d3f97605df48d8befca5407f8d328" -origin-hashes = ["sha512:f9d5a85fec4db46d5a2859057658c01ee4fe1ab412dab80bcbb426102b5dcb147ab7e0744e781d045e5d2b50ec3cb4f0990c8ce66e52cda37c88833d0f814500"] - -['1.0-gitbad'] -origin = "git+file://../../crates/libhello_git@ce78e7706c9d3f97605df48d8befca5407f8d328" -origin-hashes = ["sha512:deadbeef"] # Bad hash in purpose - -['1.0-tarball'] -origin = "file://../../crates/libhello_1.0.0.tgz" -origin-hashes = ["sha512:99fa3a55540d0655c87605b54af732f76a8a363015f183b06e98aa91e54c0e69397872718c5c16f436dd6de0fba506dc50c66d34a0e5c61fb63cb01fa22f35ac"] diff --git a/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-git.toml b/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-git.toml new file mode 100644 index 00000000..fc48ea62 --- /dev/null +++ b/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-git.toml @@ -0,0 +1,8 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0-git" +origin = "git+file://../../../crates/libhello_git@ce78e7706c9d3f97605df48d8befca5407f8d328" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] +origin-hashes = ["sha512:f9d5a85fec4db46d5a2859057658c01ee4fe1ab412dab80bcbb426102b5dcb147ab7e0744e781d045e5d2b50ec3cb4f0990c8ce66e52cda37c88833d0f814500"] diff --git a/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-gitbad.toml b/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-gitbad.toml new file mode 100644 index 00000000..cfa56869 --- /dev/null +++ b/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-gitbad.toml @@ -0,0 +1,8 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0-gitbad" +origin = "git+file://../../../crates/libhello_git@ce78e7706c9d3f97605df48d8befca5407f8d328" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] +origin-hashes = ["sha512:deadbeef"] # Bad hash on purpose diff --git a/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-tarball.toml b/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-tarball.toml new file mode 100644 index 00000000..a90c3172 --- /dev/null +++ b/testsuite/fixtures/checked_index/li/libhello/libhello-1.0.0-tarball.toml @@ -0,0 +1,8 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0-tarball" +origin = "file://../../../crates/libhello_1.0.0.tgz" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] +origin-hashes = ["sha512:99fa3a55540d0655c87605b54af732f76a8a363015f183b06e98aa91e54c0e69397872718c5c16f436dd6de0fba506dc50c66d34a0e5c61fb63cb01fa22f35ac"] diff --git a/testsuite/fixtures/git_index/index.toml b/testsuite/fixtures/git_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/fixtures/git_index/index.toml +++ b/testsuite/fixtures/git_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/fixtures/git_index/li/libfoo.toml b/testsuite/fixtures/git_index/li/libfoo/libfoo-1.0.0-git.toml similarity index 56% rename from testsuite/fixtures/git_index/li/libfoo.toml rename to testsuite/fixtures/git_index/li/libfoo/libfoo-1.0.0-git.toml index e119af2f..473d3865 100644 --- a/testsuite/fixtures/git_index/li/libfoo.toml +++ b/testsuite/fixtures/git_index/li/libfoo/libfoo-1.0.0-git.toml @@ -1,8 +1,7 @@ -[general] description = "Custom repo to check proper retrieval of local git crates" +name = "libfoo" +version = "1.0.0-git" +origin = "git+file://../../../crates/libfoo_git@9ddda32bbbf117dcf2314cb8c23f127c735e5863" licenses = ["Public Domain"] maintainers = ["some@one.com"] maintainers-logins = ["mylogin"] - -['1.0-git'] -origin = "git+file://../../crates/libfoo_git@9ddda32bbbf117dcf2314cb8c23f127c735e5863" diff --git a/testsuite/fixtures/native_index/index.toml b/testsuite/fixtures/native_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/fixtures/native_index/index.toml +++ b/testsuite/fixtures/native_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/fixtures/native_index/li/libhello.toml b/testsuite/fixtures/native_index/li/libhello.toml deleted file mode 100644 index 3b730e2a..00000000 --- a/testsuite/fixtures/native_index/li/libhello.toml +++ /dev/null @@ -1,12 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project support library""" -licenses = [] -maintainers = ["alejandro@mosteo.com"] -maintainers-logins = ["mylogin"] - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" - -['0.9-test-unav-native'] -origin = "file://../../crates/libhello_1.0.0" -depends-on = { make = "*" } diff --git a/testsuite/fixtures/native_index/li/libhello/libhello-0.9.0-test-unav-native.toml b/testsuite/fixtures/native_index/li/libhello/libhello-0.9.0-test-unav-native.toml new file mode 100644 index 00000000..a6d03706 --- /dev/null +++ b/testsuite/fixtures/native_index/li/libhello/libhello-0.9.0-test-unav-native.toml @@ -0,0 +1,10 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "0.9.0-test-unav-native" +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] + +[[depends-on]] +make = "*" diff --git a/testsuite/fixtures/native_index/li/libhello/libhello-1.0.0.toml b/testsuite/fixtures/native_index/li/libhello/libhello-1.0.0.toml new file mode 100644 index 00000000..f8c16939 --- /dev/null +++ b/testsuite/fixtures/native_index/li/libhello/libhello-1.0.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/fixtures/basic_index/ma/make.toml b/testsuite/fixtures/native_index/ma/make/make-external.toml similarity index 94% rename from testsuite/fixtures/basic_index/ma/make.toml rename to testsuite/fixtures/native_index/ma/make/make-external.toml index 5b2629c4..bca44cce 100644 --- a/testsuite/fixtures/basic_index/ma/make.toml +++ b/testsuite/fixtures/native_index/ma/make/make-external.toml @@ -1,8 +1,8 @@ -[general] description = "Utility for directing compilation" +name = "make" +licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] -licenses = [] [[external]] kind = "system" diff --git a/testsuite/fixtures/run_index/index.toml b/testsuite/fixtures/run_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/fixtures/run_index/index.toml +++ b/testsuite/fixtures/run_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/fixtures/run_index/no/noop.toml b/testsuite/fixtures/run_index/no/noop.toml deleted file mode 100644 index 4bbda7f5..00000000 --- a/testsuite/fixtures/run_index/no/noop.toml +++ /dev/null @@ -1,19 +0,0 @@ -[general] -description = "Do nothing" -licenses = [] -maintainers = ["mr@lazy.com"] -maintainers-logins = ["mrlazy"] - -['1.0-default'] -origin = "file://../../crates/noop_1.0-default.tgz" -origin-hashes = ["sha512:de676fbda9f16ba98fe1adc80e20dbd9b98a86352267825b55f1d719570adc0f92f1be2e96fd3df06aac4f6b5fee8686695e315be370cabe482edefc5a0570c5"] - -['1.0-nondef'] -executables = ["noop2"] -origin = "file://../../crates/noop_1.0-nondef.tgz" -origin-hashes = ["sha512:a5807a3f7ea5bb9bc99f37e0ff23e13526fc6c928c7d90a75c0aa6f3ba9cc964978beedd4d5f890b8c82d969ec159315b4bb66dba18e1c559b2fa0bd71c66f2b"] - -['1.0-multi'] -executables = ["noop", "noop2"] -origin = "file://../../crates/noop_1.0-multi.tgz" -origin-hashes = ["sha512:ce2fc754c166ead10e1fcc7bbd483cff0f95bf527ee78b443510f692b5f1cb95b21b48d65ee1dc6555dcc6bfd04e607e3a7cf510ac056cc209308aa4ec0be7cc"] diff --git a/testsuite/fixtures/run_index/no/noop/noop-1.0.0-default.toml b/testsuite/fixtures/run_index/no/noop/noop-1.0.0-default.toml new file mode 100644 index 00000000..37c569b4 --- /dev/null +++ b/testsuite/fixtures/run_index/no/noop/noop-1.0.0-default.toml @@ -0,0 +1,8 @@ +description = "Do nothing" +name = "noop" +version = "1.0.0-default" +origin = "file://../../../crates/noop_1.0-default.tgz" +licenses = [] +maintainers = ["mr@lazy.com"] +maintainers-logins = ["mrlazy"] +origin-hashes = ["sha512:de676fbda9f16ba98fe1adc80e20dbd9b98a86352267825b55f1d719570adc0f92f1be2e96fd3df06aac4f6b5fee8686695e315be370cabe482edefc5a0570c5"] diff --git a/testsuite/fixtures/run_index/no/noop/noop-1.0.0-multi.toml b/testsuite/fixtures/run_index/no/noop/noop-1.0.0-multi.toml new file mode 100644 index 00000000..6dc591cf --- /dev/null +++ b/testsuite/fixtures/run_index/no/noop/noop-1.0.0-multi.toml @@ -0,0 +1,9 @@ +description = "Do nothing" +name = "noop" +version = "1.0.0-multi" +origin = "file://../../../crates/noop_1.0-multi.tgz" +licenses = [] +maintainers = ["mr@lazy.com"] +maintainers-logins = ["mrlazy"] +executables = ["noop", "noop2"] +origin-hashes = ["sha512:ce2fc754c166ead10e1fcc7bbd483cff0f95bf527ee78b443510f692b5f1cb95b21b48d65ee1dc6555dcc6bfd04e607e3a7cf510ac056cc209308aa4ec0be7cc"] diff --git a/testsuite/fixtures/run_index/no/noop/noop-1.0.0-nondef.toml b/testsuite/fixtures/run_index/no/noop/noop-1.0.0-nondef.toml new file mode 100644 index 00000000..f83d6986 --- /dev/null +++ b/testsuite/fixtures/run_index/no/noop/noop-1.0.0-nondef.toml @@ -0,0 +1,9 @@ +description = "Do nothing" +name = "noop" +version = "1.0.0-nondef" +origin = "file://../../../crates/noop_1.0-nondef.tgz" +licenses = [] +maintainers = ["mr@lazy.com"] +maintainers-logins = ["mrlazy"] +executables = ["noop2"] +origin-hashes = ["sha512:a5807a3f7ea5bb9bc99f37e0ff23e13526fc6c928c7d90a75c0aa6f3ba9cc964978beedd4d5f890b8c82d969ec159315b4bb66dba18e1c559b2fa0bd71c66f2b"] diff --git a/testsuite/fixtures/solver_index/he/hello.toml b/testsuite/fixtures/solver_index/he/hello.toml deleted file mode 100644 index aac32a5e..00000000 --- a/testsuite/fixtures/solver_index/he/hello.toml +++ /dev/null @@ -1,40 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = ["GPL 3.0", "MIT"] -website = "example.com" -maintainers = ["bob@example.com"] -maintainers-logins = ["mylogin"] -authors = ["Bob", "Alice"] - - -['4.0'] # with missing dependencies + missing external -origin = "file://." - - ['4.0'.depends-on] - libhello = "^4.0" - make = "*" - -['3.0'] # with missing dependencies -origin = "file://." - - ['3.0'.depends-on] - libhello = "^3.0" - -['2.0'] # with regular and unavailable external (hint) -origin = "file://." - - ['2.0'.depends-on] - libhello = "^2.0" - make = "*" - -['1.0.1'] # with plain dependencies -origin = "file://." - - ['1.0.1'.depends-on] - libhello = "^1.0" - -['1.0.0'] -origin = "file://." - - ['1.0.0'.depends-on] - libhello = "^1.0" diff --git a/testsuite/fixtures/solver_index/he/hello/hello-1.0.0.toml b/testsuite/fixtures/solver_index/he/hello/hello-1.0.0.toml new file mode 100644 index 00000000..0be56e94 --- /dev/null +++ b/testsuite/fixtures/solver_index/he/hello/hello-1.0.0.toml @@ -0,0 +1,12 @@ +description = "\"Hello, world!\" demonstration project" +website = "example.com" +name = "hello" +version = "1.0.0" +origin = "file://." +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] +maintainers = ["bob@example.com"] +maintainers-logins = ["mylogin"] + +[[depends-on]] +libhello = "^1.0" diff --git a/testsuite/fixtures/solver_index/he/hello/hello-1.0.1.toml b/testsuite/fixtures/solver_index/he/hello/hello-1.0.1.toml new file mode 100644 index 00000000..2979abbb --- /dev/null +++ b/testsuite/fixtures/solver_index/he/hello/hello-1.0.1.toml @@ -0,0 +1,13 @@ +description = "\"Hello, world!\" demonstration project" +website = "example.com" +name = "hello" +version = "1.0.1" +origin = "file://." +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] +maintainers = ["bob@example.com"] +maintainers-logins = ["mylogin"] + +# With plain dependencies +[[depends-on]] +libhello = "^1.0" diff --git a/testsuite/fixtures/solver_index/he/hello/hello-2.0.0.toml b/testsuite/fixtures/solver_index/he/hello/hello-2.0.0.toml new file mode 100644 index 00000000..d576a7c8 --- /dev/null +++ b/testsuite/fixtures/solver_index/he/hello/hello-2.0.0.toml @@ -0,0 +1,14 @@ +description = "\"Hello, world!\" demonstration project" +website = "example.com" +name = "hello" +version = "2.0.0" +origin = "file://." +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] +maintainers = ["bob@example.com"] +maintainers-logins = ["mylogin"] + +# With regular and unavailable external (hint) +[[depends-on]] +libhello = "^2.0" +make = "*" diff --git a/testsuite/fixtures/solver_index/he/hello/hello-3.0.0.toml b/testsuite/fixtures/solver_index/he/hello/hello-3.0.0.toml new file mode 100644 index 00000000..0aa29431 --- /dev/null +++ b/testsuite/fixtures/solver_index/he/hello/hello-3.0.0.toml @@ -0,0 +1,13 @@ +description = "\"Hello, world!\" demonstration project" +website = "example.com" +name = "hello" +version = "3.0.0" +origin = "file://." +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] +maintainers = ["bob@example.com"] +maintainers-logins = ["mylogin"] + +# With missing dependencies +[[depends-on]] +libhello = "^3.0" diff --git a/testsuite/fixtures/solver_index/he/hello/hello-4.0.0.toml b/testsuite/fixtures/solver_index/he/hello/hello-4.0.0.toml new file mode 100644 index 00000000..0b4b77e5 --- /dev/null +++ b/testsuite/fixtures/solver_index/he/hello/hello-4.0.0.toml @@ -0,0 +1,14 @@ +description = "\"Hello, world!\" demonstration project" +website = "example.com" +name = "hello" +version = "4.0.0" +origin = "file://." +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] +maintainers = ["bob@example.com"] +maintainers-logins = ["mylogin"] + +# With missing dependencies + missing external +[[depends-on]] +libhello = "^4.0" +make = "*" diff --git a/testsuite/fixtures/solver_index/index.toml b/testsuite/fixtures/solver_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/fixtures/solver_index/index.toml +++ b/testsuite/fixtures/solver_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/fixtures/solver_index/li/libhello.toml b/testsuite/fixtures/solver_index/li/libhello.toml deleted file mode 100644 index c41322f9..00000000 --- a/testsuite/fixtures/solver_index/li/libhello.toml +++ /dev/null @@ -1,17 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project support library""" -licenses = [] -maintainers = ["john@doe.com"] -maintainers-logins = ["mylogin"] - -['2.0'] -origin = "file://." - -['1.1'] -origin = "file://." - -['1.0.1'] -origin = "file://." - -['1.0'] -origin = "file://." diff --git a/testsuite/fixtures/solver_index/li/libhello/libhello-1.0.0.toml b/testsuite/fixtures/solver_index/li/libhello/libhello-1.0.0.toml new file mode 100644 index 00000000..d7a2c23e --- /dev/null +++ b/testsuite/fixtures/solver_index/li/libhello/libhello-1.0.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.0" +origin = "file://." +licenses = [] +maintainers = ["john@doe.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/fixtures/solver_index/li/libhello/libhello-1.0.1.toml b/testsuite/fixtures/solver_index/li/libhello/libhello-1.0.1.toml new file mode 100644 index 00000000..ecc5b315 --- /dev/null +++ b/testsuite/fixtures/solver_index/li/libhello/libhello-1.0.1.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.0.1" +origin = "file://." +licenses = [] +maintainers = ["john@doe.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/fixtures/solver_index/li/libhello/libhello-1.1.0.toml b/testsuite/fixtures/solver_index/li/libhello/libhello-1.1.0.toml new file mode 100644 index 00000000..cc447a17 --- /dev/null +++ b/testsuite/fixtures/solver_index/li/libhello/libhello-1.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "1.1.0" +origin = "file://." +licenses = [] +maintainers = ["john@doe.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/fixtures/solver_index/li/libhello/libhello-2.0.0.toml b/testsuite/fixtures/solver_index/li/libhello/libhello-2.0.0.toml new file mode 100644 index 00000000..addc0a5b --- /dev/null +++ b/testsuite/fixtures/solver_index/li/libhello/libhello-2.0.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project support library" +name = "libhello" +version = "2.0.0" +origin = "file://." +licenses = [] +maintainers = ["john@doe.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/fixtures/solver_index/ma/make.toml b/testsuite/fixtures/solver_index/ma/make/make-external.toml similarity index 94% rename from testsuite/fixtures/solver_index/ma/make.toml rename to testsuite/fixtures/solver_index/ma/make/make-external.toml index 5b2629c4..bca44cce 100644 --- a/testsuite/fixtures/solver_index/ma/make.toml +++ b/testsuite/fixtures/solver_index/ma/make/make-external.toml @@ -1,8 +1,8 @@ -[general] description = "Utility for directing compilation" +name = "make" +licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] -licenses = [] [[external]] kind = "system" diff --git a/testsuite/fixtures/solver_index/su/superhello.toml b/testsuite/fixtures/solver_index/su/superhello/superhello-1.0.0.toml similarity index 73% rename from testsuite/fixtures/solver_index/su/superhello.toml rename to testsuite/fixtures/solver_index/su/superhello/superhello-1.0.0.toml index 549249c1..96b0dc44 100644 --- a/testsuite/fixtures/solver_index/su/superhello.toml +++ b/testsuite/fixtures/solver_index/su/superhello/superhello-1.0.0.toml @@ -1,14 +1,12 @@ -[general] description = "A better hello" -licenses = ["GPL 3.0", "MIT"] website = "example.com" +name = "superhello" +version = "1.0.0" +origin = "file://." +authors = ["Bob", "Alice"] +licenses = ["GPL 3.0", "MIT"] maintainers = ["bob@example.com"] maintainers-logins = ["mylogin"] -authors = ["Bob", "Alice"] - - -['1.0.0'] -origin = "file://." - ['1.0.0'.depends-on] - libhello = "~1.0" +[[depends-on]] +libhello = "~1.0" diff --git a/testsuite/skels/local-index/my_index/index/cr/crate.toml b/testsuite/skels/local-index/my_index/index/cr/crate/crate-1.0.0.toml similarity index 58% rename from testsuite/skels/local-index/my_index/index/cr/crate.toml rename to testsuite/skels/local-index/my_index/index/cr/crate/crate-1.0.0.toml index 8f1ca779..51d9e942 100644 --- a/testsuite/skels/local-index/my_index/index/cr/crate.toml +++ b/testsuite/skels/local-index/my_index/index/cr/crate/crate-1.0.0.toml @@ -1,8 +1,7 @@ -[general] description = "Sample crate" +name = "crate" +version = "1.0.0" +origin = "file://../../../crates/crate" licenses = [] maintainers = ["any@bo.dy"] maintainers-logins = ["someone"] - -['1.0'] -origin = "file://../../crates/crate" diff --git a/testsuite/skels/local-index/my_index/index/index.toml b/testsuite/skels/local-index/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/skels/local-index/my_index/index/index.toml +++ b/testsuite/skels/local-index/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/auto-gpr-with/basic/my_index/index/index.toml b/testsuite/tests/auto-gpr-with/basic/my_index/index/index.toml deleted file mode 100644 index 319b3b37..00000000 --- a/testsuite/tests/auto-gpr-with/basic/my_index/index/index.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.3" diff --git a/testsuite/tests/auto-gpr-with/basic/my_index/index/li/libhello_nogprwith.toml b/testsuite/tests/auto-gpr-with/basic/my_index/index/li/libhello_nogprwith.toml deleted file mode 100644 index cf9ccbfe..00000000 --- a/testsuite/tests/auto-gpr-with/basic/my_index/index/li/libhello_nogprwith.toml +++ /dev/null @@ -1,11 +0,0 @@ -[general] -description = "auto-gpr-with=false" -licenses = [] -maintainers = ["alejandro@mosteo.com"] -maintainers-logins = ["mylogin"] - -project-files=["will_fail_if_withed.gpr"] - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" -auto-gpr-with=false diff --git a/testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/gp/gpr_in_subdir.toml b/testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/gp/gpr_in_subdir.toml deleted file mode 100644 index 37ac1635..00000000 --- a/testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/gp/gpr_in_subdir.toml +++ /dev/null @@ -1,12 +0,0 @@ -[general] -description = "gpr file in subdirs" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -# The dirX folder do not exist. This is not a problem since we won't try to -# compile this code. -project-files=["dir1/dir2/dir3/gpr_in_subdir.gpr"] - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" diff --git a/testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/index.toml b/testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/index.toml deleted file mode 100644 index 319b3b37..00000000 --- a/testsuite/tests/auto-gpr-with/gpr_in_subdir/my_index/index/index.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.3" diff --git a/testsuite/tests/get/build/my_index/index/ba/bad.toml b/testsuite/tests/get/build/my_index/index/ba/bad/bad-1.0.0.toml similarity index 59% rename from testsuite/tests/get/build/my_index/index/ba/bad.toml rename to testsuite/tests/get/build/my_index/index/ba/bad/bad-1.0.0.toml index 0ca283d3..03666375 100644 --- a/testsuite/tests/get/build/my_index/index/ba/bad.toml +++ b/testsuite/tests/get/build/my_index/index/ba/bad/bad-1.0.0.toml @@ -1,8 +1,7 @@ -[general] description = "Bad crate" +name = "bad" +version = "1.0.0" +origin = "file://./../../../crates/bad" +licenses = [] maintainers = ["jane@doe.com"] maintainers-logins = ["mylogin"] -licenses = [] - -['1.0'] -origin = "file://./../../crates/bad" diff --git a/testsuite/tests/get/build/my_index/index/go/good.toml b/testsuite/tests/get/build/my_index/index/go/good/good-1.0.0.toml similarity index 58% rename from testsuite/tests/get/build/my_index/index/go/good.toml rename to testsuite/tests/get/build/my_index/index/go/good/good-1.0.0.toml index b7e9a455..0d6418f3 100644 --- a/testsuite/tests/get/build/my_index/index/go/good.toml +++ b/testsuite/tests/get/build/my_index/index/go/good/good-1.0.0.toml @@ -1,8 +1,7 @@ -[general] description = "Good crate" +name = "good" +version = "1.0.0" +origin = "file://./../../../crates/good" +licenses = [] maintainers = ["john@doe.com"] maintainers-logins = ["mylogin"] -licenses = [] - -['1.0'] -origin = "file://./../../crates/good" diff --git a/testsuite/tests/get/build/my_index/index/index.toml b/testsuite/tests/get/build/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/get/build/my_index/index/index.toml +++ b/testsuite/tests/get/build/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/get/external-tool-dependency/my_index/index.toml b/testsuite/tests/get/external-tool-dependency/my_index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/get/external-tool-dependency/my_index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/get/external-tool-dependency/my_index/index/index.toml b/testsuite/tests/get/external-tool-dependency/my_index/index/index.toml deleted file mode 100644 index 319b3b37..00000000 --- a/testsuite/tests/get/external-tool-dependency/my_index/index/index.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.3" diff --git a/testsuite/tests/get/external-tool-dependency/my_index/index/ma/main.toml b/testsuite/tests/get/external-tool-dependency/my_index/ma/main/main-1.0.0.toml similarity index 70% rename from testsuite/tests/get/external-tool-dependency/my_index/index/ma/main.toml rename to testsuite/tests/get/external-tool-dependency/my_index/ma/main/main-1.0.0.toml index 59c51c16..24919e03 100644 --- a/testsuite/tests/get/external-tool-dependency/my_index/index/ma/main.toml +++ b/testsuite/tests/get/external-tool-dependency/my_index/ma/main/main-1.0.0.toml @@ -1,12 +1,11 @@ -[general] description = "Main program" +name = "main" +version = "1.0.0" +origin = "file://./../../../crates/noop_1.0-default.tgz" +licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] -licenses = [] - -['1.0'] -origin = "file://./../../crates/noop_1.0-default.tgz" origin-hashes = ["sha512:de676fbda9f16ba98fe1adc80e20dbd9b98a86352267825b55f1d719570adc0f92f1be2e96fd3df06aac4f6b5fee8686695e315be370cabe482edefc5a0570c5"] - - ['1.0'.depends-on] - make = "*" + +[[depends-on]] +make = "*" diff --git a/testsuite/tests/get/external-tool-dependency/my_index/index/ma/make.toml b/testsuite/tests/get/external-tool-dependency/my_index/ma/make/make-external.toml similarity index 79% rename from testsuite/tests/get/external-tool-dependency/my_index/index/ma/make.toml rename to testsuite/tests/get/external-tool-dependency/my_index/ma/make/make-external.toml index b1d86a51..61f9d6e7 100644 --- a/testsuite/tests/get/external-tool-dependency/my_index/index/ma/make.toml +++ b/testsuite/tests/get/external-tool-dependency/my_index/ma/make/make-external.toml @@ -1,10 +1,10 @@ -[general] description = "Utility for directing compilation" +name = "make" +licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] -licenses = [] [[external]] kind = "version-output" -version-command = [ "make", "--version" ] version-regexp = ".*Make ([\\d\\.]+).*" +version-command = ["make", "--version"] diff --git a/testsuite/tests/get/indirect-link/my_index/index/index.toml b/testsuite/tests/get/indirect-link/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/get/indirect-link/my_index/index/index.toml +++ b/testsuite/tests/get/indirect-link/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/get/indirect-link/my_index/index/ti/tier1.toml b/testsuite/tests/get/indirect-link/my_index/index/ti/tier1/tier1-1.0.0.toml similarity index 68% rename from testsuite/tests/get/indirect-link/my_index/index/ti/tier1.toml rename to testsuite/tests/get/indirect-link/my_index/index/ti/tier1/tier1-1.0.0.toml index aa550a58..6d22199a 100644 --- a/testsuite/tests/get/indirect-link/my_index/index/ti/tier1.toml +++ b/testsuite/tests/get/indirect-link/my_index/index/ti/tier1/tier1-1.0.0.toml @@ -1,10 +1,10 @@ -[general] description = "top-level crate" +name = "tier1" +version = "1.0.0" +origin = "file://." +licenses = [] maintainers = ["john@doe.com"] maintainers-logins = ["mylogin"] -licenses = [] -depends-on.tier2 = "*" - -['1.0'] -origin = "file://." +[[depends-on]] +tier2 = "*" diff --git a/testsuite/tests/get/indirect-link/my_index/index/ti/tier2.toml b/testsuite/tests/get/indirect-link/my_index/index/ti/tier2/tier2-1.0.0.toml similarity index 68% rename from testsuite/tests/get/indirect-link/my_index/index/ti/tier2.toml rename to testsuite/tests/get/indirect-link/my_index/index/ti/tier2/tier2-1.0.0.toml index cc943018..f43b582a 100644 --- a/testsuite/tests/get/indirect-link/my_index/index/ti/tier2.toml +++ b/testsuite/tests/get/indirect-link/my_index/index/ti/tier2/tier2-1.0.0.toml @@ -1,10 +1,10 @@ -[general] description = "2nd-level crate" +name = "tier2" +version = "1.0.0" +origin = "file://." +licenses = [] maintainers = ["john@doe.com"] maintainers-logins = ["mylogin"] -licenses = [] -depends-on.tier3 = "*" - -['1.0'] -origin = "file://." +[[depends-on]] +tier3 = "*" diff --git a/testsuite/tests/get/indirect-link/my_index/index/ti/tier3.toml b/testsuite/tests/get/indirect-link/my_index/index/ti/tier3/tier3-1.0.0.toml similarity index 68% rename from testsuite/tests/get/indirect-link/my_index/index/ti/tier3.toml rename to testsuite/tests/get/indirect-link/my_index/index/ti/tier3/tier3-1.0.0.toml index cc943018..b839b8e6 100644 --- a/testsuite/tests/get/indirect-link/my_index/index/ti/tier3.toml +++ b/testsuite/tests/get/indirect-link/my_index/index/ti/tier3/tier3-1.0.0.toml @@ -1,10 +1,10 @@ -[general] description = "2nd-level crate" +name = "tier3" +version = "1.0.0" +origin = "file://." +licenses = [] maintainers = ["john@doe.com"] maintainers-logins = ["mylogin"] -licenses = [] -depends-on.tier3 = "*" - -['1.0'] -origin = "file://." +[[depends-on]] +tier3 = "*" diff --git a/testsuite/tests/index/bad-action-command/my_index/index/he/hello_world.toml b/testsuite/tests/index/bad-action-command/my_index/index/he/hello_world.toml deleted file mode 100644 index 142ae5fe..00000000 --- a/testsuite/tests/index/bad-action-command/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,12 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -['0.1'] -origin = "http://blah.com/pkg.zip" - -[[general.actions.'case(os)'.linux]] -type = "post-fetch" -command = "should be an array of strings" diff --git a/testsuite/tests/index/bad-action-command/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/bad-action-command/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..97632ece --- /dev/null +++ b/testsuite/tests/index/bad-action-command/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,10 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +[[actions."case(os)".linux]] +command = "should be an array of strings" +type = "post-fetch" diff --git a/testsuite/tests/index/bad-action-command/my_index/index/index.toml b/testsuite/tests/index/bad-action-command/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/bad-action-command/my_index/index/index.toml +++ b/testsuite/tests/index/bad-action-command/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/bad-action-command/test.py b/testsuite/tests/index/bad-action-command/test.py index 38353484..c1a42421 100644 --- a/testsuite/tests/index/bad-action-command/test.py +++ b/testsuite/tests/index/bad-action-command/test.py @@ -8,7 +8,7 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) -assert_match('ERROR: Loading crate .* actions command must' +assert_match('ERROR: Loading .* actions command must' ' be an array of string\(s\)\n', p.out) diff --git a/testsuite/tests/index/bad-index-metadata/my_index/index/index.toml b/testsuite/tests/index/bad-index-metadata/my_index/index/index.toml index a2a34c2b..e524a208 100644 --- a/testsuite/tests/index/bad-index-metadata/my_index/index/index.toml +++ b/testsuite/tests/index/bad-index-metadata/my_index/index/index.toml @@ -1,2 +1,2 @@ -version = "0.3" +version = "0.1" badkey = "sneaking around" diff --git a/testsuite/tests/index/bad-license/my_index/index/he/hello_world.toml b/testsuite/tests/index/bad-license/my_index/index/he/hello_world.toml deleted file mode 100644 index 1c77d1a4..00000000 --- a/testsuite/tests/index/bad-license/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,8 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = ["Invalid license ID"] # Not in the list of allowed license IDs -maintainers = ["Mr. User "] -maintainers-logins = ["user"] - -['0.1'] -origin = "http://blah.com/pkg.zip" diff --git a/testsuite/tests/index/bad-license/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/bad-license/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..e8495989 --- /dev/null +++ b/testsuite/tests/index/bad-license/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." +licenses = ["Invalid license ID"] +maintainers = ["Mr. User "] +maintainers-logins = ["user"] diff --git a/testsuite/tests/index/bad-license/my_index/index/index.toml b/testsuite/tests/index/bad-license/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/bad-license/my_index/index/index.toml +++ b/testsuite/tests/index/bad-license/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/bad-license/test.py b/testsuite/tests/index/bad-license/test.py index 7dfb66ed..7d1e4bb5 100644 --- a/testsuite/tests/index/bad-license/test.py +++ b/testsuite/tests/index/bad-license/test.py @@ -8,7 +8,7 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) -assert_match('ERROR: Loading crate .*hello_world.toml: general: ' +assert_match('ERROR: Loading .*hello_world-0.1.0.toml: ' 'licenses: unknown license: \'Invalid license ID\'\n', p.out) diff --git a/testsuite/tests/index/bad-tag/my_index/index/he/hello_world.toml b/testsuite/tests/index/bad-tag/my_index/index/he/hello_world.toml deleted file mode 100644 index 854169f7..00000000 --- a/testsuite/tests/index/bad-tag/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,9 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] -tags = ["invalid_tag"] - -['0.1'] -origin = "http://blah.com/pkg.zip" diff --git a/testsuite/tests/index/bad-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/bad-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..9b0d1836 --- /dev/null +++ b/testsuite/tests/index/bad-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,8 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +tags = ["invalid_tag"] diff --git a/testsuite/tests/index/bad-tag/my_index/index/index.toml b/testsuite/tests/index/bad-tag/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/bad-tag/my_index/index/index.toml +++ b/testsuite/tests/index/bad-tag/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/bad-tag/test.py b/testsuite/tests/index/bad-tag/test.py index 326f88a6..856506ad 100644 --- a/testsuite/tests/index/bad-tag/test.py +++ b/testsuite/tests/index/bad-tag/test.py @@ -9,9 +9,8 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) assert_match( - 'ERROR: Loading crate .*hello_world.toml: general: tags: ' - 'Tag string is not valid\n' - 'ERROR: Cannot read valid property from tags\n', + 'ERROR: Loading .*hello_world-0.1.0.toml: tags: ' + 'Tag string is not valid\n', p.out) print('SUCCESS') diff --git a/testsuite/tests/index/empty-tag/my_index/index/he/hello_world.toml b/testsuite/tests/index/empty-tag/my_index/index/he/hello_world.toml deleted file mode 100644 index 51533b93..00000000 --- a/testsuite/tests/index/empty-tag/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,9 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] -tags = [""] - -['0.1'] -origin = "http://blah.com/pkg.zip" diff --git a/testsuite/tests/index/empty-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/empty-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..82b106d4 --- /dev/null +++ b/testsuite/tests/index/empty-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,8 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +tags = [""] diff --git a/testsuite/tests/index/empty-tag/my_index/index/index.toml b/testsuite/tests/index/empty-tag/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/empty-tag/my_index/index/index.toml +++ b/testsuite/tests/index/empty-tag/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/empty-tag/test.py b/testsuite/tests/index/empty-tag/test.py index c4ae1f2b..b73230df 100644 --- a/testsuite/tests/index/empty-tag/test.py +++ b/testsuite/tests/index/empty-tag/test.py @@ -9,9 +9,8 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) assert_match( - 'ERROR: Loading crate .*hello_world.toml: general: tags: ' - 'Tag string is empty\n' - 'ERROR: Cannot read valid property from tags\n', + 'ERROR: Loading .*hello_world-0.1.0.toml: tags: ' + 'Tag string is empty\n', p.out) print('SUCCESS') diff --git a/testsuite/tests/index/environment/my_index/index/he/hello.toml b/testsuite/tests/index/environment/my_index/index/he/hello.toml deleted file mode 100644 index 498bd570..00000000 --- a/testsuite/tests/index/environment/my_index/index/he/hello.toml +++ /dev/null @@ -1,22 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -[general.environment] -VAR1.append = "abc" -VAR2.prepend = "xyz" -VAR3.set = "pqr" -VAR4.set = "${_ALIRE_TEST_}" -VAR5.set = "${_ALIRE_TEST_" -VAR6.set = "\\${_ALIRE_TEST_}" -VAR7.set = "abc${_ALIRE_TEST_}abc" -VAR8.set = "abc\\${_ALIRE_TEST_}abc" -VAR9.set = "${_ALIRE_TEST_}${_ALIRE_TEST_}${_ALIRE_TEST_}" - -[general.environment.'case(os)'.'...'] -CONDVAR.set = "uvw" - -[1] -origin = "file://." diff --git a/testsuite/tests/index/environment/my_index/index/he/hello/hello-1.0.0.toml b/testsuite/tests/index/environment/my_index/index/he/hello/hello-1.0.0.toml new file mode 100644 index 00000000..aa1a2bb3 --- /dev/null +++ b/testsuite/tests/index/environment/my_index/index/he/hello/hello-1.0.0.toml @@ -0,0 +1,35 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello" +version = "1.0.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +[environment.VAR1] +append = "abc" + +[environment.VAR2] +prepend = "xyz" + +[environment.VAR3] +set = "pqr" + +[environment.VAR4] +set = "${_ALIRE_TEST_}" + +[environment.VAR5] +set = "${_ALIRE_TEST_" + +[environment.VAR6] +set = "\\${_ALIRE_TEST_}" + +[environment.VAR7] +set = "abc${_ALIRE_TEST_}abc" + +[environment.VAR8] +set = "abc\\${_ALIRE_TEST_}abc" + +[environment.VAR9] +set = "${_ALIRE_TEST_}${_ALIRE_TEST_}${_ALIRE_TEST_}" +[environment."case(os)"."...".CONDVAR] +set = "uvw" diff --git a/testsuite/tests/index/environment/my_index/index/index.toml b/testsuite/tests/index/environment/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/environment/my_index/index/index.toml +++ b/testsuite/tests/index/environment/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/external-available/my_index/cr/crate.toml b/testsuite/tests/index/external-available/my_index/cr/crate/crate-external.toml similarity index 50% rename from testsuite/tests/index/external-available/my_index/cr/crate.toml rename to testsuite/tests/index/external-available/my_index/cr/crate/crate-external.toml index 1d42eb69..2e9b2844 100644 --- a/testsuite/tests/index/external-available/my_index/cr/crate.toml +++ b/testsuite/tests/index/external-available/my_index/cr/crate/crate-external.toml @@ -1,13 +1,12 @@ -[general] description = "A crate" +name = "crate" licenses = [] maintainers = ["somebody@somewhere.com"] maintainers-logins = ["mylogin"] [[external]] kind = "version-output" -version-command = [ "make", "--version" ] version-regexp = ".*Make ([\\d\\.]+).*" -available.'case(toolchain)'.'...' = false -# Won't be ever attempted to be detected. -# Still, we can use the expression for testing. +version-command = ["make", "--version"] +[external.available."case(toolchain)"] +"..." = false diff --git a/testsuite/tests/index/external-available/my_index/index.toml b/testsuite/tests/index/external-available/my_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/external-available/my_index/index.toml +++ b/testsuite/tests/index/external-available/my_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/external-from-output/my_index/index/index.toml b/testsuite/tests/index/external-from-output/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/external-from-output/my_index/index/index.toml +++ b/testsuite/tests/index/external-from-output/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/external-from-output/my_index/index/ma/make.toml b/testsuite/tests/index/external-from-output/my_index/index/ma/make/make-external.toml similarity index 79% rename from testsuite/tests/index/external-from-output/my_index/index/ma/make.toml rename to testsuite/tests/index/external-from-output/my_index/index/ma/make/make-external.toml index 6a9a3ba3..e8201463 100644 --- a/testsuite/tests/index/external-from-output/my_index/index/ma/make.toml +++ b/testsuite/tests/index/external-from-output/my_index/index/ma/make/make-external.toml @@ -1,11 +1,10 @@ -[general] description = "Utility for directing compilation" - +name = "make" licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] [[external]] kind = "version-output" -version-command = [ "make", "--version" ] version-regexp = ".*Make ([\\d\\.]+).*" +version-command = ["make", "--version"] diff --git a/testsuite/tests/index/external-hint/my_index/cr/crate.toml b/testsuite/tests/index/external-hint/my_index/cr/crate/crate-external.toml similarity index 54% rename from testsuite/tests/index/external-hint/my_index/cr/crate.toml rename to testsuite/tests/index/external-hint/my_index/cr/crate/crate-external.toml index 576c417c..caa2ad64 100644 --- a/testsuite/tests/index/external-hint/my_index/cr/crate.toml +++ b/testsuite/tests/index/external-hint/my_index/cr/crate/crate-external.toml @@ -1,11 +1,11 @@ -[general] description = "A crate" +name = "crate" licenses = [] maintainers = ["somebody@somewhere.com"] maintainers-logins = ["mylogin"] [[external]] kind = "hint" - [external.hint.'case(toolchain)'] - system = "This is a custom hint" - user = "This is a custom hint" +[external.hint."case(toolchain)"] +system = "This is a custom hint" +user = "This is a custom hint" diff --git a/testsuite/tests/index/external-hint/my_index/cr/crate_master.toml b/testsuite/tests/index/external-hint/my_index/cr/crate_master.toml deleted file mode 100644 index b6a324c4..00000000 --- a/testsuite/tests/index/external-hint/my_index/cr/crate_master.toml +++ /dev/null @@ -1,15 +0,0 @@ -[general] -description = "A crate with a dependency" -licenses = [] -maintainers = ["somebody@somewhere.com"] -maintainers-logins = ["mylogin"] - -['1.0'] -origin = "file://../crates/noop_1.0-default.tgz" -origin-hashes = ["""\ -sha512:de676fbda9f16ba98fe1adc80e20dbd9b98a86352267825b55f1d719570adc0f92f1be2\ -e96fd3df06aac4f6b5fee8686695e315be370cabe482edefc5a0570c5\ -"""] - - ['1.0'.depends-on] - crate = "any" diff --git a/testsuite/tests/index/external-hint/my_index/cr/crate_master/crate_master-1.0.0.toml b/testsuite/tests/index/external-hint/my_index/cr/crate_master/crate_master-1.0.0.toml new file mode 100644 index 00000000..43c530ba --- /dev/null +++ b/testsuite/tests/index/external-hint/my_index/cr/crate_master/crate_master-1.0.0.toml @@ -0,0 +1,11 @@ +description = "A crate with a dependency" +name = "crate_master" +version = "1.0.0" +origin = "file://../../../crates/noop_1.0-default.tgz" +licenses = [] +maintainers = ["somebody@somewhere.com"] +maintainers-logins = ["mylogin"] +origin-hashes = ["sha512:de676fbda9f16ba98fe1adc80e20dbd9b98a86352267825b55f1d719570adc0f92f1be2e96fd3df06aac4f6b5fee8686695e315be370cabe482edefc5a0570c5"] + +[[depends-on]] +crate = "any" diff --git a/testsuite/tests/index/external-hint/my_index/index.toml b/testsuite/tests/index/external-hint/my_index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/external-hint/my_index/index.toml +++ b/testsuite/tests/index/external-hint/my_index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/external-msys2/my_index/index/di/dialog.toml b/testsuite/tests/index/external-msys2/my_index/di/dialog/dialog-external.toml similarity index 65% rename from testsuite/tests/index/external-msys2/my_index/index/di/dialog.toml rename to testsuite/tests/index/external-msys2/my_index/di/dialog/dialog-external.toml index 3a7fdf97..a3ea4f2f 100644 --- a/testsuite/tests/index/external-msys2/my_index/index/di/dialog.toml +++ b/testsuite/tests/index/external-msys2/my_index/di/dialog/dialog-external.toml @@ -1,10 +1,10 @@ -[general] description = "Just for the test" +name = "dialog" +licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mosteo"] -licenses = [] [[external]] kind = "system" - [external.origin.'case(distribution)'] - 'msys2' = ["dialog"] +[external.origin."case(distribution)"] +msys2 = ["dialog"] diff --git a/testsuite/tests/index/external-msys2/my_index/index.toml b/testsuite/tests/index/external-msys2/my_index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/index/external-msys2/my_index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/index/external-msys2/my_index/index/index.toml b/testsuite/tests/index/external-msys2/my_index/index/index.toml deleted file mode 100644 index 319b3b37..00000000 --- a/testsuite/tests/index/external-msys2/my_index/index/index.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.3" diff --git a/testsuite/tests/index/external-msys2/my_index/index/ma/main.toml b/testsuite/tests/index/external-msys2/my_index/ma/main/main-1.0.0.toml similarity index 68% rename from testsuite/tests/index/external-msys2/my_index/index/ma/main.toml rename to testsuite/tests/index/external-msys2/my_index/ma/main/main-1.0.0.toml index e3e4fdf7..833211a3 100644 --- a/testsuite/tests/index/external-msys2/my_index/index/ma/main.toml +++ b/testsuite/tests/index/external-msys2/my_index/ma/main/main-1.0.0.toml @@ -1,17 +1,14 @@ -[general] description = "Main program" +name = "main" +version = "1.0.0" +origin = "file://./../../../crates/noop_1.0-default.tgz" +licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] -licenses = [] +origin-hashes = ["sha512:de676fbda9f16ba98fe1adc80e20dbd9b98a86352267825b55f1d719570adc0f92f1be2e96fd3df06aac4f6b5fee8686695e315be370cabe482edefc5a0570c5"] -[[general.actions.'case(os)'.windows]] +[[depends-on]] +dialog = "*" +[[actions."case(os)".windows]] type = "post-fetch" command = ["bash", "-c", "uname && dialog --help"] - -['1.0'] -origin = "file://./../../crates/noop_1.0-default.tgz" -origin-hashes = ["sha512:de676fbda9f16ba98fe1adc80e20dbd9b98a86352267825b55f1d719570adc0f92f1be2e96fd3df06aac4f6b5fee8686695e315be370cabe482edefc5a0570c5"] - - ['1.0'.depends-on] - dialog = "*" - diff --git a/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world.toml b/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world.toml deleted file mode 100644 index 215d01cc..00000000 --- a/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,17 +0,0 @@ -[general] -description = "This is the regular short description" -long-description = """ -This is the long crate description. - -This can be a multiline string, and TOML parsers are free to use the platform end-of-line character during loading. -""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -['0.1'] -origin = "http://blah.com/pkg.zip" -origin-hashes = ["sha512:deadbeef"] - -[[external]] -kind = "hint" # Exists, but not available in Alire diff --git a/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..bae0251d --- /dev/null +++ b/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,9 @@ +description = "This is the regular short description" +long-description = "This is the long crate description.\n\nThis can be a multiline string, and TOML parsers are free to use the platform end-of-line character during loading.\n" +name = "hello_world" +version = "0.1.0" +origin = "http://blah.com/pkg.zip" +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +origin-hashes = ["sha512:deadbeef"] diff --git a/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-external.toml b/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-external.toml new file mode 100644 index 00000000..2b22c43b --- /dev/null +++ b/testsuite/tests/index/external-unindexed/my_index/index/he/hello_world/hello_world-external.toml @@ -0,0 +1,9 @@ +description = "This is the regular short description" +long-description = "This is the long crate description.\n\nThis can be a multiline string, and TOML parsers are free to use the platform end-of-line character during loading.\n" +name = "hello_world" +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] + +[[external]] +kind = "hint" diff --git a/testsuite/tests/index/external-unindexed/my_index/index/index.toml b/testsuite/tests/index/external-unindexed/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/external-unindexed/my_index/index/index.toml +++ b/testsuite/tests/index/external-unindexed/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/long-description/my_index/index/he/hello_world.toml b/testsuite/tests/index/long-description/my_index/index/he/hello_world.toml deleted file mode 100644 index b29b3fb9..00000000 --- a/testsuite/tests/index/long-description/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,14 +0,0 @@ -[general] -description = "This is the regular short description" -long-description = """ -This is the long crate description. - -This can be a multiline string, and TOML parsers are free to use the platform end-of-line character during loading. -""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -['0.1'] -origin = "http://blah.com/pkg.zip" -origin-hashes = ["sha512:deadbeef"] diff --git a/testsuite/tests/index/long-description/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/long-description/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..bae0251d --- /dev/null +++ b/testsuite/tests/index/long-description/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,9 @@ +description = "This is the regular short description" +long-description = "This is the long crate description.\n\nThis can be a multiline string, and TOML parsers are free to use the platform end-of-line character during loading.\n" +name = "hello_world" +version = "0.1.0" +origin = "http://blah.com/pkg.zip" +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +origin-hashes = ["sha512:deadbeef"] diff --git a/testsuite/tests/index/long-description/my_index/index/index.toml b/testsuite/tests/index/long-description/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/long-description/my_index/index/index.toml +++ b/testsuite/tests/index/long-description/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/long-tag/my_index/index/he/hello_world.toml b/testsuite/tests/index/long-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml similarity index 50% rename from testsuite/tests/index/long-tag/my_index/index/he/hello_world.toml rename to testsuite/tests/index/long-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml index 3e07ab28..ebf6402f 100644 --- a/testsuite/tests/index/long-tag/my_index/index/he/hello_world.toml +++ b/testsuite/tests/index/long-tag/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -1,9 +1,8 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] tags = ["very-very-long-tag"] - -['0.1'] -origin = "http://blah.com/pkg.zip" diff --git a/testsuite/tests/index/long-tag/my_index/index/index.toml b/testsuite/tests/index/long-tag/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/long-tag/my_index/index/index.toml +++ b/testsuite/tests/index/long-tag/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/long-tag/test.py b/testsuite/tests/index/long-tag/test.py index d7a7f9af..1466971b 100644 --- a/testsuite/tests/index/long-tag/test.py +++ b/testsuite/tests/index/long-tag/test.py @@ -8,10 +8,9 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) -assert_match('ERROR: Loading crate .*hello_world.toml:' - ' general: tags: Tag string is too long ' - '\(must be no more than [0-9]+\)\n' - 'ERROR: Cannot read valid property from tags\n', +assert_match('ERROR: Loading .*hello_world-0.1.0.toml:' + ' tags: Tag string is too long ' + '\(must be no more than [0-9]+\)\n', p.out) print('SUCCESS') diff --git a/testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world.toml b/testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world.toml deleted file mode 100644 index 74da9710..00000000 --- a/testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,8 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["Mr. User"] -maintainers-logins = ["mylogin"] - -['0.1'] -origin = "http://blah.com/pkg.zip" diff --git a/testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..33a9ad60 --- /dev/null +++ b/testsuite/tests/index/maint-bad-email/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["Mr. User"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/index/maint-bad-email/my_index/index/index.toml b/testsuite/tests/index/maint-bad-email/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/maint-bad-email/my_index/index/index.toml +++ b/testsuite/tests/index/maint-bad-email/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/maint-bad-email/test.py b/testsuite/tests/index/maint-bad-email/test.py index d2a44a72..d3af0ad8 100644 --- a/testsuite/tests/index/maint-bad-email/test.py +++ b/testsuite/tests/index/maint-bad-email/test.py @@ -9,9 +9,8 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) assert_match( - 'ERROR: Loading crate .*hello_world.toml: general: maintainers: ' - 'Maintainers must have a valid email, but got: Mr. User\n' - 'ERROR: Cannot read valid property from maintainers\n', + 'ERROR: Loading .*hello_world-0.1.0.toml: maintainers: ' + 'Maintainers must have a valid email, but got: Mr. User\n', p.out) print('SUCCESS') diff --git a/testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world.toml b/testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world.toml deleted file mode 100644 index 348479fc..00000000 --- a/testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world.toml +++ /dev/null @@ -1,8 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["Mr. User "] -maintainers-logins = ["mr.user"] # Dot is forbidden - -['0.1'] -origin = "http://blah.com/pkg.zip" diff --git a/testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world/hello_world-0.1.0.toml b/testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world/hello_world-0.1.0.toml new file mode 100644 index 00000000..275a2992 --- /dev/null +++ b/testsuite/tests/index/maint-bad-login/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["Mr. User "] +maintainers-logins = ["mr.user"] diff --git a/testsuite/tests/index/maint-bad-login/my_index/index/index.toml b/testsuite/tests/index/maint-bad-login/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/maint-bad-login/my_index/index/index.toml +++ b/testsuite/tests/index/maint-bad-login/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/maint-bad-login/test.py b/testsuite/tests/index/maint-bad-login/test.py index f6165b6a..229bc09b 100644 --- a/testsuite/tests/index/maint-bad-login/test.py +++ b/testsuite/tests/index/maint-bad-login/test.py @@ -9,9 +9,8 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) assert_match( - 'ERROR: Loading crate .*hello_world.toml: general: maintainers-logins: ' - 'maintainers-logins must be a valid GitHub login, but got: mr.user\n' - 'ERROR: Cannot read valid property from maintainers-logins\n', + 'ERROR: Loading .*hello_world-0.1.0.toml: maintainers-logins: ' + 'maintainers-logins must be a valid GitHub login, but got: mr.user\n', p.out) print('SUCCESS') diff --git a/testsuite/tests/index/mismatched-crate/my_index/index/cr/crate/misplaced_crate-1.0.0.toml b/testsuite/tests/index/mismatched-crate/my_index/index/cr/crate/misplaced_crate-1.0.0.toml new file mode 100644 index 00000000..51d9e942 --- /dev/null +++ b/testsuite/tests/index/mismatched-crate/my_index/index/cr/crate/misplaced_crate-1.0.0.toml @@ -0,0 +1,7 @@ +description = "Sample crate" +name = "crate" +version = "1.0.0" +origin = "file://../../../crates/crate" +licenses = [] +maintainers = ["any@bo.dy"] +maintainers-logins = ["someone"] diff --git a/testsuite/tests/index/mismatched-crate/my_index/index/index.toml b/testsuite/tests/index/mismatched-crate/my_index/index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/index/mismatched-crate/my_index/index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/index/mismatched-crate/test.py b/testsuite/tests/index/mismatched-crate/test.py new file mode 100644 index 00000000..ddae0720 --- /dev/null +++ b/testsuite/tests/index/mismatched-crate/test.py @@ -0,0 +1,14 @@ +""" +Check detection of manifest in wrong shelf +""" + +import re + +from drivers.alr import run_alr +from drivers.asserts import assert_match + +p = run_alr("list", complain_on_error=False) +assert_match('.*ERROR: Mismatch between manifest and shelf:.*', + p.out, flags=re.S) + +print('SUCCESS') diff --git a/testsuite/tests/index/mismatched-crate/test.yaml b/testsuite/tests/index/mismatched-crate/test.yaml new file mode 100644 index 00000000..0a859639 --- /dev/null +++ b/testsuite/tests/index/mismatched-crate/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +indexes: + my_index: + in_fixtures: false diff --git a/testsuite/tests/index/mismatched-parent/my_index/index/cr/bad_parent/crate-1.0.0.toml b/testsuite/tests/index/mismatched-parent/my_index/index/cr/bad_parent/crate-1.0.0.toml new file mode 100644 index 00000000..51d9e942 --- /dev/null +++ b/testsuite/tests/index/mismatched-parent/my_index/index/cr/bad_parent/crate-1.0.0.toml @@ -0,0 +1,7 @@ +description = "Sample crate" +name = "crate" +version = "1.0.0" +origin = "file://../../../crates/crate" +licenses = [] +maintainers = ["any@bo.dy"] +maintainers-logins = ["someone"] diff --git a/testsuite/tests/index/mismatched-parent/my_index/index/index.toml b/testsuite/tests/index/mismatched-parent/my_index/index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/index/mismatched-parent/my_index/index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/index/mismatched-parent/test.py b/testsuite/tests/index/mismatched-parent/test.py new file mode 100644 index 00000000..99a5c97b --- /dev/null +++ b/testsuite/tests/index/mismatched-parent/test.py @@ -0,0 +1,14 @@ +""" +Check detection of manifest in wrong parent +""" + +import re + +from drivers.alr import run_alr +from drivers.asserts import assert_match + +p = run_alr("list", complain_on_error=False) +assert_match('.*ERROR: Mismatch between manifest and parent:.*', + p.out, flags=re.S) + +print('SUCCESS') diff --git a/testsuite/tests/index/mismatched-parent/test.yaml b/testsuite/tests/index/mismatched-parent/test.yaml new file mode 100644 index 00000000..0a859639 --- /dev/null +++ b/testsuite/tests/index/mismatched-parent/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +indexes: + my_index: + in_fixtures: false diff --git a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/he/hello.toml b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/he/hello/hello-1.0.0.toml similarity index 54% rename from testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/he/hello.toml rename to testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/he/hello/hello-1.0.0.toml index 223a544c..3f035bdf 100644 --- a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/he/hello.toml +++ b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/he/hello/hello-1.0.0.toml @@ -1,8 +1,7 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "\"Hello, world!\" demonstration project" +name = "hello" +version = "1.0.0" +origin = "file://" licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] - -['1.0.0'] -origin = "file://" diff --git a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/index.toml b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/index.toml +++ b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_1/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/he/hello.toml b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/he/hello/hello-1.0.0.toml similarity index 57% rename from testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/he/hello.toml rename to testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/he/hello/hello-1.0.0.toml index b65993b2..295d5fdd 100644 --- a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/he/hello.toml +++ b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/he/hello/hello-1.0.0.toml @@ -1,8 +1,7 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "\"Hello, world!\" demonstration project" +name = "hello" +version = "1.0.0" +origin = "file://non-existing-path" licenses = [] maintainers = ["alejandro@mosteo.com"] maintainers-logins = ["mylogin"] - -['1.0.0'] -origin = "file://non-existing-path" diff --git a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/index.toml b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/index.toml +++ b/testsuite/tests/index/origin-filesystem-bad-path/bad_index_2/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/origin-no-archive-name/my_index/index/he/hello_world.toml b/testsuite/tests/index/origin-no-archive-name/my_index/index/he/hello_world/hello_world-0.1.0.toml similarity index 60% rename from testsuite/tests/index/origin-no-archive-name/my_index/index/he/hello_world.toml rename to testsuite/tests/index/origin-no-archive-name/my_index/index/he/hello_world/hello_world-0.1.0.toml index ae6848ca..a12fc9ad 100644 --- a/testsuite/tests/index/origin-no-archive-name/my_index/index/he/hello_world.toml +++ b/testsuite/tests/index/origin-no-archive-name/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -1,9 +1,8 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +archive-hash = "sha512:deadbeef" +origin = "http://example.com/" licenses = [] maintainers = ["user@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "http://example.com/" -archive-hash = "sha512:deadbeef" diff --git a/testsuite/tests/index/origin-no-archive-name/my_index/index/index.toml b/testsuite/tests/index/origin-no-archive-name/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/origin-no-archive-name/my_index/index/index.toml +++ b/testsuite/tests/index/origin-no-archive-name/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/origin-unknown-kind/my_index/index/he/hello_world.toml b/testsuite/tests/index/origin-unknown-kind/my_index/index/he/hello_world/hello_world-0.1.0.toml similarity index 56% rename from testsuite/tests/index/origin-unknown-kind/my_index/index/he/hello_world.toml rename to testsuite/tests/index/origin-unknown-kind/my_index/index/he/hello_world/hello_world-0.1.0.toml index ac14bf79..e85123e1 100644 --- a/testsuite/tests/index/origin-unknown-kind/my_index/index/he/hello_world.toml +++ b/testsuite/tests/index/origin-unknown-kind/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -1,8 +1,7 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "foo+http://blah.com/pkg.html" licenses = [] maintainers = ["user@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "foo+http://blah.com/pkg.html" diff --git a/testsuite/tests/index/origin-unknown-kind/my_index/index/index.toml b/testsuite/tests/index/origin-unknown-kind/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/origin-unknown-kind/my_index/index/index.toml +++ b/testsuite/tests/index/origin-unknown-kind/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/too-long-short-description/my_index/index/he/hello_world.toml b/testsuite/tests/index/too-long-short-description/my_index/index/he/hello_world/hello_world-0.1.0.toml similarity index 75% rename from testsuite/tests/index/too-long-short-description/my_index/index/he/hello_world.toml rename to testsuite/tests/index/too-long-short-description/my_index/index/he/hello_world/hello_world-0.1.0.toml index ffabe335..488fbcf5 100644 --- a/testsuite/tests/index/too-long-short-description/my_index/index/he/hello_world.toml +++ b/testsuite/tests/index/too-long-short-description/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -1,8 +1,7 @@ -[general] description = "This is a very very very very very very very very very very long description" +name = "hello_world" +version = "0.1.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "http://blah.com/pkg.zip" diff --git a/testsuite/tests/index/too-long-short-description/my_index/index/index.toml b/testsuite/tests/index/too-long-short-description/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/index/too-long-short-description/my_index/index/index.toml +++ b/testsuite/tests/index/too-long-short-description/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/index/too-long-short-description/test.py b/testsuite/tests/index/too-long-short-description/test.py index 031a86aa..2953e40a 100644 --- a/testsuite/tests/index/too-long-short-description/test.py +++ b/testsuite/tests/index/too-long-short-description/test.py @@ -8,10 +8,9 @@ from drivers.asserts import assert_match p = run_alr('show', 'hello_world', complain_on_error=False, debug=False, quiet=True) -assert_match('ERROR: Loading crate .*hello_world.toml:' - ' general: description: Description string is too long' - ' \(must be no more than [0-9]+\)\n' - 'ERROR: Cannot read valid property from description\n', +assert_match('ERROR: Loading .*hello_world-0.1.0.toml:' + ' description: Description string is too long' + ' \(must be no more than [0-9]+\)\n', p.out) print('SUCCESS') diff --git a/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent.toml b/testsuite/tests/index/unexpected-contents/my_index/index/cr/crate/crate-1.0.0.toml similarity index 73% rename from testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent.toml rename to testsuite/tests/index/unexpected-contents/my_index/index/cr/crate/crate-1.0.0.toml index 09e7cd83..0e5524ce 100644 --- a/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent.toml +++ b/testsuite/tests/index/unexpected-contents/my_index/index/cr/crate/crate-1.0.0.toml @@ -1,9 +1,7 @@ -[general] description = "Sample crate" +name = "crate" +version = "1.0.0" +origin = "file://." licenses = [] maintainers = ["any@bo.dy"] maintainers-logins = ["someone"] - -['1.0'] -origin = "file://." -depends-on.checkenv = "*" diff --git a/testsuite/tests/index/unexpected-contents/my_index/index/index.toml b/testsuite/tests/index/unexpected-contents/my_index/index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/index/unexpected-contents/my_index/index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/index/unexpected-contents/my_index/index/shouldnt_be_here b/testsuite/tests/index/unexpected-contents/my_index/index/shouldnt_be_here new file mode 100644 index 00000000..e69de29b diff --git a/testsuite/tests/index/unexpected-contents/test.py b/testsuite/tests/index/unexpected-contents/test.py new file mode 100644 index 00000000..c137d711 --- /dev/null +++ b/testsuite/tests/index/unexpected-contents/test.py @@ -0,0 +1,14 @@ +""" +Check detection of bad file in index +""" + +import re + +from drivers.alr import run_alr +from drivers.asserts import assert_match + +p = run_alr("list", complain_on_error=False) +assert_match('.*ERROR: Unexpected file in index:.*shouldnt_be_here.+', + p.out, flags=re.S) + +print('SUCCESS') diff --git a/testsuite/tests/index/unexpected-contents/test.yaml b/testsuite/tests/index/unexpected-contents/test.yaml new file mode 100644 index 00000000..0a859639 --- /dev/null +++ b/testsuite/tests/index/unexpected-contents/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +indexes: + my_index: + in_fixtures: false diff --git a/testsuite/tests/misc/bad-lockfile/test.yaml b/testsuite/tests/misc/bad-lockfile/test.yaml index 32c747b3..872fc127 100644 --- a/testsuite/tests/misc/bad-lockfile/test.yaml +++ b/testsuite/tests/misc/bad-lockfile/test.yaml @@ -1 +1,3 @@ driver: python-script +indexes: + basic_index: {} diff --git a/testsuite/tests/misc/sync-manual-edit/test.py b/testsuite/tests/misc/sync-manual-edit/test.py index e6706af4..5200cb12 100644 --- a/testsuite/tests/misc/sync-manual-edit/test.py +++ b/testsuite/tests/misc/sync-manual-edit/test.py @@ -22,7 +22,7 @@ for cmd in ['build', 'pin', 'run', 'show', 'with', 'setenv']: # "Manually" add a dependency with open("alire/xxx.toml", "a") as file: - file.write('depends-on.libhello="1"') + file.write('[[depends-on]]\nlibhello="1"') # Make the lockfile "older" (otherwise timestamp is identical) os.utime('alire/xxx.lock', (0, 0)) diff --git a/testsuite/tests/pin/all/my_index/index/he/hello1.toml b/testsuite/tests/pin/all/my_index/index/he/hello1/hello1-0.1.0.toml similarity index 53% rename from testsuite/tests/pin/all/my_index/index/he/hello1.toml rename to testsuite/tests/pin/all/my_index/index/he/hello1/hello1-0.1.0.toml index a537eb3a..7662ddf5 100644 --- a/testsuite/tests/pin/all/my_index/index/he/hello1.toml +++ b/testsuite/tests/pin/all/my_index/index/he/hello1/hello1-0.1.0.toml @@ -1,8 +1,7 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "\"Hello, world!\" demonstration project" +name = "hello1" +version = "0.1.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." diff --git a/testsuite/tests/pin/all/my_index/index/he/hello2/hello2-0.1.0.toml b/testsuite/tests/pin/all/my_index/index/he/hello2/hello2-0.1.0.toml new file mode 100644 index 00000000..6fbae9b6 --- /dev/null +++ b/testsuite/tests/pin/all/my_index/index/he/hello2/hello2-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello2" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/pin/all/my_index/index/index.toml b/testsuite/tests/pin/all/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/pin/all/my_index/index/index.toml +++ b/testsuite/tests/pin/all/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/libhello.gpr b/testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/libhello.gpr deleted file mode 100644 index 3fe673f3..00000000 --- a/testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/libhello.gpr +++ /dev/null @@ -1,24 +0,0 @@ -project Libhello is - - for Library_Name use "Libhello"; - for Library_Version use "0.0.0"; - - for Source_Dirs use ("src"); - for Object_Dir use "obj"; - for Library_Dir use "lib"; - - package Builder is - for Switches ("ada") use ("-j0", "-g"); - end Builder; - - package Compiler is - for Switches ("ada") use - ("-gnatVa", "-gnatwa", "-g", "-O2", - "-gnata", "-gnato", "-fstack-check"); - end Compiler; - - package Binder is - for Switches ("ada") use ("-Es"); - end Binder; - -end Libhello; diff --git a/testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/src/libhello.ads b/testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/src/libhello.ads deleted file mode 100644 index d4879364..00000000 --- a/testsuite/tests/pin/change-type/my_index/crates/libhello_1.0.0/src/libhello.ads +++ /dev/null @@ -1,3 +0,0 @@ -package Libhello is - -end Libhello; diff --git a/testsuite/tests/pin/change-type/my_index/index.toml b/testsuite/tests/pin/change-type/my_index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/pin/change-type/my_index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/pin/change-type/my_index/index/index.toml b/testsuite/tests/pin/change-type/my_index/index/index.toml deleted file mode 100644 index 319b3b37..00000000 --- a/testsuite/tests/pin/change-type/my_index/index/index.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.3" diff --git a/testsuite/tests/pin/change-type/my_index/index/li/libhello.toml b/testsuite/tests/pin/change-type/my_index/li/libhello/libhello-1.0.0.toml similarity index 54% rename from testsuite/tests/pin/change-type/my_index/index/li/libhello.toml rename to testsuite/tests/pin/change-type/my_index/li/libhello/libhello-1.0.0.toml index 460334ba..463c1f32 100644 --- a/testsuite/tests/pin/change-type/my_index/index/li/libhello.toml +++ b/testsuite/tests/pin/change-type/my_index/li/libhello/libhello-1.0.0.toml @@ -1,8 +1,7 @@ -[general] description = "libhello" +name = "libhello" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" licenses = [] maintainers = ["some@one.com"] maintainers-logins = ["mylogin"] - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" diff --git a/testsuite/tests/pin/change-type/test.py b/testsuite/tests/pin/change-type/test.py index 8e4e6a38..6e7a7662 100644 --- a/testsuite/tests/pin/change-type/test.py +++ b/testsuite/tests/pin/change-type/test.py @@ -29,14 +29,14 @@ p = run_alr('pin', 'libhello=1.0') check_version_pin() # Repin to a folder -run_alr('pin', 'libhello', '--use', '../my_index/crates/libhello_1.0.0') +run_alr('pin', 'libhello', '--use', '../crates/libhello_1.0.0') # Check that it shows as such in the solution p = run_alr('show', '--solve') s = re.escape(dir_separator()) # platform-dependent assert_match('.*Dependencies \(external\):.*' 'libhello\* \(direct,linked' - ',pin=.*' + s + 'my_index' + s + + ',pin=.*' + s + 'pin__change-type' + s + 'crates' + s + 'libhello_1.0.0\).*', p.out, flags=re.S) diff --git a/testsuite/tests/pin/change-type/test.yaml b/testsuite/tests/pin/change-type/test.yaml index 0a859639..b7da6fe7 100644 --- a/testsuite/tests/pin/change-type/test.yaml +++ b/testsuite/tests/pin/change-type/test.yaml @@ -2,3 +2,4 @@ driver: python-script indexes: my_index: in_fixtures: false + copy_crates_src: true diff --git a/testsuite/tests/pin/downgrade/my_index/index/index.toml b/testsuite/tests/pin/downgrade/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/pin/downgrade/my_index/index/index.toml +++ b/testsuite/tests/pin/downgrade/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild.toml b/testsuite/tests/pin/downgrade/my_index/index/li/libchild/libchild-0.1.0.toml similarity index 72% rename from testsuite/tests/pin/unneeded-held/my_index/index/li/libchild.toml rename to testsuite/tests/pin/downgrade/my_index/index/li/libchild/libchild-0.1.0.toml index 3861e1da..571098ce 100644 --- a/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild.toml +++ b/testsuite/tests/pin/downgrade/my_index/index/li/libchild/libchild-0.1.0.toml @@ -1,11 +1,7 @@ -[general] description = "Child" +name = "libchild" +version = "0.1.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." - -['0.2'] -origin = "file://." diff --git a/testsuite/tests/pin/downgrade/my_index/index/li/libchild.toml b/testsuite/tests/pin/downgrade/my_index/index/li/libchild/libchild-0.2.0.toml similarity index 72% rename from testsuite/tests/pin/downgrade/my_index/index/li/libchild.toml rename to testsuite/tests/pin/downgrade/my_index/index/li/libchild/libchild-0.2.0.toml index 3861e1da..ab6a40a3 100644 --- a/testsuite/tests/pin/downgrade/my_index/index/li/libchild.toml +++ b/testsuite/tests/pin/downgrade/my_index/index/li/libchild/libchild-0.2.0.toml @@ -1,11 +1,7 @@ -[general] description = "Child" +name = "libchild" +version = "0.2.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." - -['0.2'] -origin = "file://." diff --git a/testsuite/tests/pin/post-update/my_index/index/li/libparent.toml b/testsuite/tests/pin/downgrade/my_index/index/li/libparent/libparent-1.0.0.toml similarity index 73% rename from testsuite/tests/pin/post-update/my_index/index/li/libparent.toml rename to testsuite/tests/pin/downgrade/my_index/index/li/libparent/libparent-1.0.0.toml index dafebf1c..47123d92 100644 --- a/testsuite/tests/pin/post-update/my_index/index/li/libparent.toml +++ b/testsuite/tests/pin/downgrade/my_index/index/li/libparent/libparent-1.0.0.toml @@ -1,11 +1,10 @@ -[general] description = "Parent" +name = "libparent" +version = "1.0.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] -[general.depends-on] +[[depends-on]] libchild = "*" - -['1.0'] -origin = "file://." diff --git a/testsuite/tests/pin/downgrade/test.py b/testsuite/tests/pin/downgrade/test.py index c48c6aca..2ce5ff3f 100644 --- a/testsuite/tests/pin/downgrade/test.py +++ b/testsuite/tests/pin/downgrade/test.py @@ -21,8 +21,8 @@ def check_child(version, output, pinned): output, flags=re.S) # Verify lockfile - check_line_in('alire/xxx.lock', - '[solution.state.release.libchild."' + version + '"]') + check_line_in('alire/xxx.lock', 'name = "libchild"') + check_line_in('alire/xxx.lock', f'version = "{version}"') # Verify dependency folders assert os.path.exists('alire/cache/dependencies/libchild_' + version + diff --git a/testsuite/tests/pin/pin-dir-with-regular/my_index/index.toml b/testsuite/tests/pin/pin-dir-with-regular/my_index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/pin/pin-dir-with-regular/my_index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/pin/pin-dir-with-regular/my_index/index/index.toml b/testsuite/tests/pin/pin-dir-with-regular/my_index/index/index.toml deleted file mode 100644 index 319b3b37..00000000 --- a/testsuite/tests/pin/pin-dir-with-regular/my_index/index/index.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.3" diff --git a/testsuite/tests/pin/pin-dir-with-regular/my_index/index/li/libhello.toml b/testsuite/tests/pin/pin-dir-with-regular/my_index/li/libhello/libhello-1.0.0.toml similarity index 54% rename from testsuite/tests/pin/pin-dir-with-regular/my_index/index/li/libhello.toml rename to testsuite/tests/pin/pin-dir-with-regular/my_index/li/libhello/libhello-1.0.0.toml index 460334ba..463c1f32 100644 --- a/testsuite/tests/pin/pin-dir-with-regular/my_index/index/li/libhello.toml +++ b/testsuite/tests/pin/pin-dir-with-regular/my_index/li/libhello/libhello-1.0.0.toml @@ -1,8 +1,7 @@ -[general] description = "libhello" +name = "libhello" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" licenses = [] maintainers = ["some@one.com"] maintainers-logins = ["mylogin"] - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" diff --git a/testsuite/tests/pin/pin-dir/my_index/index.toml b/testsuite/tests/pin/pin-dir/my_index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/pin/pin-dir/my_index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/pin/pin-dir/my_index/index/index.toml b/testsuite/tests/pin/pin-dir/my_index/index/index.toml deleted file mode 100644 index 319b3b37..00000000 --- a/testsuite/tests/pin/pin-dir/my_index/index/index.toml +++ /dev/null @@ -1 +0,0 @@ -version = "0.3" diff --git a/testsuite/tests/pin/pin-dir/my_index/index/li/libhello.toml b/testsuite/tests/pin/pin-dir/my_index/li/libhello/libhello-1.0.0.toml similarity index 54% rename from testsuite/tests/pin/pin-dir/my_index/index/li/libhello.toml rename to testsuite/tests/pin/pin-dir/my_index/li/libhello/libhello-1.0.0.toml index 460334ba..463c1f32 100644 --- a/testsuite/tests/pin/pin-dir/my_index/index/li/libhello.toml +++ b/testsuite/tests/pin/pin-dir/my_index/li/libhello/libhello-1.0.0.toml @@ -1,8 +1,7 @@ -[general] description = "libhello" +name = "libhello" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" licenses = [] maintainers = ["some@one.com"] maintainers-logins = ["mylogin"] - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" diff --git a/testsuite/tests/pin/pin-dir/test.py b/testsuite/tests/pin/pin-dir/test.py index f70246ac..4d304785 100644 --- a/testsuite/tests/pin/pin-dir/test.py +++ b/testsuite/tests/pin/pin-dir/test.py @@ -22,7 +22,7 @@ assert p.status != 0, "Build should fail" # Add normally and then pin, check that it builds run_alr('with', 'libhello') -run_alr('pin', 'libhello', '--use', '../my_index/crates/libhello_1.0.0') +run_alr('pin', 'libhello', '--use', '../crates/libhello_1.0.0') run_alr('build') # Check the pin shows in the solution @@ -32,7 +32,7 @@ p = run_alr('with', '--solve') s = re.escape(dir_separator()) # platform-dependent assert_match('.*Dependencies \(external\):.*' 'libhello\* \(direct,linked' - ',pin=.*' + s + 'my_index' + s + + ',pin=.*' + s + 'pin__pin-dir' + s + 'crates' + s + 'libhello_1.0.0\).*', p.out, flags=re.S) diff --git a/testsuite/tests/pin/post-update/my_index/index/index.toml b/testsuite/tests/pin/post-update/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/pin/post-update/my_index/index/index.toml +++ b/testsuite/tests/pin/post-update/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/pin/post-update/my_index/index/li/libchild.toml b/testsuite/tests/pin/post-update/my_index/index/li/libchild/libchild-0.1.0.toml similarity index 72% rename from testsuite/tests/pin/post-update/my_index/index/li/libchild.toml rename to testsuite/tests/pin/post-update/my_index/index/li/libchild/libchild-0.1.0.toml index 3861e1da..571098ce 100644 --- a/testsuite/tests/pin/post-update/my_index/index/li/libchild.toml +++ b/testsuite/tests/pin/post-update/my_index/index/li/libchild/libchild-0.1.0.toml @@ -1,11 +1,7 @@ -[general] description = "Child" +name = "libchild" +version = "0.1.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." - -['0.2'] -origin = "file://." diff --git a/testsuite/tests/pin/all/my_index/index/he/hello2.toml b/testsuite/tests/pin/post-update/my_index/index/li/libchild/libchild-0.2.0.toml similarity index 57% rename from testsuite/tests/pin/all/my_index/index/he/hello2.toml rename to testsuite/tests/pin/post-update/my_index/index/li/libchild/libchild-0.2.0.toml index a537eb3a..ab6a40a3 100644 --- a/testsuite/tests/pin/all/my_index/index/he/hello2.toml +++ b/testsuite/tests/pin/post-update/my_index/index/li/libchild/libchild-0.2.0.toml @@ -1,8 +1,7 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "Child" +name = "libchild" +version = "0.2.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." diff --git a/testsuite/tests/pin/downgrade/my_index/index/li/libparent.toml b/testsuite/tests/pin/post-update/my_index/index/li/libparent/libparent-1.0.0.toml similarity index 73% rename from testsuite/tests/pin/downgrade/my_index/index/li/libparent.toml rename to testsuite/tests/pin/post-update/my_index/index/li/libparent/libparent-1.0.0.toml index dafebf1c..47123d92 100644 --- a/testsuite/tests/pin/downgrade/my_index/index/li/libparent.toml +++ b/testsuite/tests/pin/post-update/my_index/index/li/libparent/libparent-1.0.0.toml @@ -1,11 +1,10 @@ -[general] description = "Parent" +name = "libparent" +version = "1.0.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] -[general.depends-on] +[[depends-on]] libchild = "*" - -['1.0'] -origin = "file://." diff --git a/testsuite/tests/pin/post-update/test.py b/testsuite/tests/pin/post-update/test.py index c9e0d82c..926892fa 100644 --- a/testsuite/tests/pin/post-update/test.py +++ b/testsuite/tests/pin/post-update/test.py @@ -22,8 +22,8 @@ def check_child(version, output, pinned): output, flags=re.S) # Verify lockfile - check_line_in('alire/xxx.lock', - '[solution.state.release.libchild."' + version + '"]') + check_line_in('alire/xxx.lock', 'name = "libchild"') + check_line_in('alire/xxx.lock', f'version = "{version}"') # Create a new "xxx" program project diff --git a/testsuite/tests/pin/unneeded-held/my_index/index/index.toml b/testsuite/tests/pin/unneeded-held/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/pin/unneeded-held/my_index/index/index.toml +++ b/testsuite/tests/pin/unneeded-held/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.1.0.toml b/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.1.0.toml new file mode 100644 index 00000000..571098ce --- /dev/null +++ b/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.1.0.toml @@ -0,0 +1,7 @@ +description = "Child" +name = "libchild" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.2.0.toml b/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.2.0.toml new file mode 100644 index 00000000..ab6a40a3 --- /dev/null +++ b/testsuite/tests/pin/unneeded-held/my_index/index/li/libchild/libchild-0.2.0.toml @@ -0,0 +1,7 @@ +description = "Child" +name = "libchild" +version = "0.2.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/pin/unneeded-held/my_index/index/li/libparent.toml b/testsuite/tests/pin/unneeded-held/my_index/index/li/libparent/libparent-1.0.0.toml similarity index 73% rename from testsuite/tests/pin/unneeded-held/my_index/index/li/libparent.toml rename to testsuite/tests/pin/unneeded-held/my_index/index/li/libparent/libparent-1.0.0.toml index dafebf1c..47123d92 100644 --- a/testsuite/tests/pin/unneeded-held/my_index/index/li/libparent.toml +++ b/testsuite/tests/pin/unneeded-held/my_index/index/li/libparent/libparent-1.0.0.toml @@ -1,11 +1,10 @@ -[general] description = "Parent" +name = "libparent" +version = "1.0.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] -[general.depends-on] +[[depends-on]] libchild = "*" - -['1.0'] -origin = "file://." diff --git a/testsuite/tests/pin/unpin/test.yaml b/testsuite/tests/pin/unpin/test.yaml index 872fc127..8929d590 100644 --- a/testsuite/tests/pin/unpin/test.yaml +++ b/testsuite/tests/pin/unpin/test.yaml @@ -1,3 +1,4 @@ driver: python-script indexes: - basic_index: {} + basic_index: + in_fixtures: true diff --git a/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv.toml b/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv.toml deleted file mode 100644 index cd1e0476..00000000 --- a/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv.toml +++ /dev/null @@ -1,18 +0,0 @@ -[general] -description = "Sample crate" -licenses = [] -maintainers = ["any@bo.dy"] -maintainers-logins = ["someone"] - -environment.CHECKENV_TEST_VAR.set = "defined" - -[[general.actions]] -type = "post-fetch" -command = ["gprbuild", "-p"] - -[[general.actions]] -type = "post-fetch" -command = ["./checkenv"] # self-run to verify the env var exists - -['1.0'] -origin = "file://../../crates/checkenv" diff --git a/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv/checkenv-1.0.0.toml b/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv/checkenv-1.0.0.toml new file mode 100644 index 00000000..05e603ba --- /dev/null +++ b/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv/checkenv-1.0.0.toml @@ -0,0 +1,17 @@ +description = "Sample crate" +name = "checkenv" +version = "1.0.0" +origin = "file://../../../crates/checkenv" +licenses = [] +maintainers = ["any@bo.dy"] +maintainers-logins = ["someone"] + +[[actions]] +type = "post-fetch" +command = ["gprbuild", "-p"] + +[[actions]] +type = "post-fetch" +command = ["./checkenv"] +[environment.CHECKENV_TEST_VAR] +set = "defined" diff --git a/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent/checkparent-1.0.0.toml b/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent/checkparent-1.0.0.toml new file mode 100644 index 00000000..7a5b6046 --- /dev/null +++ b/testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent/checkparent-1.0.0.toml @@ -0,0 +1,10 @@ +description = "Sample crate" +name = "checkparent" +version = "1.0.0" +origin = "file://." +licenses = [] +maintainers = ["any@bo.dy"] +maintainers-logins = ["someone"] + +[[depends-on]] +checkenv = "*" diff --git a/testsuite/tests/setenv/env-during-fetch/my_index/index/index.toml b/testsuite/tests/setenv/env-during-fetch/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/setenv/env-during-fetch/my_index/index/index.toml +++ b/testsuite/tests/setenv/env-during-fetch/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.lock b/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.lock index 45d9fa8a..0f075c0d 100644 --- a/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.lock +++ b/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.lock @@ -1,4 +1,2 @@ -[context] -advisory = "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT MANUALLY" +[solution] solved = true - diff --git a/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.toml b/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.toml index ef1567f9..339d9f12 100644 --- a/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.toml +++ b/testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.toml @@ -1,12 +1,7 @@ -["0.0.0"] +name = "crate_1234" +version = "0.0.0" origin = "file://.." -[general] description = "Shiny new project" -maintainers = [ -"your@email.here", -] -maintainers-logins = [ -"github-username", -] - +maintainers = ["your@email.here"] +maintainers-logins = ["github-username"] project-files = ["nested/project.gpr"] diff --git a/testsuite/tests/setenv/linked-paths/my_index/index/index.toml b/testsuite/tests/setenv/linked-paths/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/setenv/linked-paths/my_index/index/index.toml +++ b/testsuite/tests/setenv/linked-paths/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/test/action-test/my_index/index/he/hello.toml b/testsuite/tests/test/action-test/my_index/index/he/hello/hello-1.0.0.toml similarity index 65% rename from testsuite/tests/test/action-test/my_index/index/he/hello.toml rename to testsuite/tests/test/action-test/my_index/index/he/hello/hello-1.0.0.toml index 8dc05d97..49084643 100644 --- a/testsuite/tests/test/action-test/my_index/index/he/hello.toml +++ b/testsuite/tests/test/action-test/my_index/index/he/hello/hello-1.0.0.toml @@ -1,16 +1,15 @@ -[general] description = "action test" +name = "hello" +version = "1.0.0" +origin = "file://../../../crates/hello_1.0.0" licenses = [] maintainers = ["some@one.com"] maintainers-logins = ["mylogin"] -[[general.actions]] +[[actions]] type = "test" command = ["echo", "ABRACADABRA"] -[[general.actions]] +[[actions]] type = "test" command = ["gprbuild", "-p"] - -[1] -origin = "file://../../crates/hello_1.0.0" diff --git a/testsuite/tests/test/action-test/my_index/index/index.toml b/testsuite/tests/test/action-test/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/test/action-test/my_index/index/index.toml +++ b/testsuite/tests/test/action-test/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/update/selective/my_index/index/he/hello1.toml b/testsuite/tests/update/selective/my_index/index/he/hello1.toml deleted file mode 100644 index a537eb3a..00000000 --- a/testsuite/tests/update/selective/my_index/index/he/hello1.toml +++ /dev/null @@ -1,8 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." diff --git a/testsuite/tests/update/selective/my_index/index/he/hello1/hello1-0.1.0.toml b/testsuite/tests/update/selective/my_index/index/he/hello1/hello1-0.1.0.toml new file mode 100644 index 00000000..7662ddf5 --- /dev/null +++ b/testsuite/tests/update/selective/my_index/index/he/hello1/hello1-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello1" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/update/selective/my_index/index/he/hello2.toml b/testsuite/tests/update/selective/my_index/index/he/hello2.toml deleted file mode 100644 index a537eb3a..00000000 --- a/testsuite/tests/update/selective/my_index/index/he/hello2.toml +++ /dev/null @@ -1,8 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." diff --git a/testsuite/tests/update/selective/my_index/index/he/hello2/hello2-0.1.0.toml b/testsuite/tests/update/selective/my_index/index/he/hello2/hello2-0.1.0.toml new file mode 100644 index 00000000..6fbae9b6 --- /dev/null +++ b/testsuite/tests/update/selective/my_index/index/he/hello2/hello2-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello2" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/update/selective/my_index/index/index.toml b/testsuite/tests/update/selective/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/update/selective/my_index/index/index.toml +++ b/testsuite/tests/update/selective/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/update/selective/my_index/updated/index/he/hello1.toml b/testsuite/tests/update/selective/my_index/updated/index/he/hello1.toml deleted file mode 100644 index b084e4c9..00000000 --- a/testsuite/tests/update/selective/my_index/updated/index/he/hello1.toml +++ /dev/null @@ -1,11 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -['0.2'] -origin = "file://." - -['0.1'] -origin = "file://." diff --git a/testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.1.0.toml b/testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.1.0.toml new file mode 100644 index 00000000..7662ddf5 --- /dev/null +++ b/testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello1" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.2.0.toml b/testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.2.0.toml new file mode 100644 index 00000000..a3d58cef --- /dev/null +++ b/testsuite/tests/update/selective/my_index/updated/index/he/hello1/hello1-0.2.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello1" +version = "0.2.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/update/selective/my_index/updated/index/he/hello2.toml b/testsuite/tests/update/selective/my_index/updated/index/he/hello2.toml deleted file mode 100644 index b084e4c9..00000000 --- a/testsuite/tests/update/selective/my_index/updated/index/he/hello2.toml +++ /dev/null @@ -1,11 +0,0 @@ -[general] -description = """"Hello, world!" demonstration project""" -licenses = [] -maintainers = ["example@example.com"] -maintainers-logins = ["mylogin"] - -['0.2'] -origin = "file://." - -['0.1'] -origin = "file://." diff --git a/testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.1.0.toml b/testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.1.0.toml new file mode 100644 index 00000000..6fbae9b6 --- /dev/null +++ b/testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.1.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello2" +version = "0.1.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.2.0.toml b/testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.2.0.toml new file mode 100644 index 00000000..790e6fb5 --- /dev/null +++ b/testsuite/tests/update/selective/my_index/updated/index/he/hello2/hello2-0.2.0.toml @@ -0,0 +1,7 @@ +description = "\"Hello, world!\" demonstration project" +name = "hello2" +version = "0.2.0" +origin = "file://." +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] diff --git a/testsuite/tests/update/selective/my_index/updated/index/index.toml b/testsuite/tests/update/selective/my_index/updated/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/update/selective/my_index/updated/index/index.toml +++ b/testsuite/tests/update/selective/my_index/updated/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/auto-gpr-with/basic/my_index/index/ex/extern.toml b/testsuite/tests/with/auto-gpr-with/basic/my_index/ex/extern/extern-external.toml similarity index 69% rename from testsuite/tests/auto-gpr-with/basic/my_index/index/ex/extern.toml rename to testsuite/tests/with/auto-gpr-with/basic/my_index/ex/extern/extern-external.toml index e4ffa134..fc4069e6 100644 --- a/testsuite/tests/auto-gpr-with/basic/my_index/index/ex/extern.toml +++ b/testsuite/tests/with/auto-gpr-with/basic/my_index/ex/extern/extern-external.toml @@ -1,11 +1,10 @@ -[general] description = "Some external crate for testing" +name = "extern" +licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["example"] -licenses = [] [[external]] kind = "system" - - [external.origin.'case(distribution)'] - '...' = ["make"] +[external.origin."case(distribution)"] +"..." = ["make"] diff --git a/testsuite/tests/with/auto-gpr-with/basic/my_index/index.toml b/testsuite/tests/with/auto-gpr-with/basic/my_index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/with/auto-gpr-with/basic/my_index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/with/auto-gpr-with/basic/my_index/li/libhello_nogprwith/libhello_nogprwith-1.0.0.toml b/testsuite/tests/with/auto-gpr-with/basic/my_index/li/libhello_nogprwith/libhello_nogprwith-1.0.0.toml new file mode 100644 index 00000000..f3aeb73e --- /dev/null +++ b/testsuite/tests/with/auto-gpr-with/basic/my_index/li/libhello_nogprwith/libhello_nogprwith-1.0.0.toml @@ -0,0 +1,9 @@ +description = "auto-gpr-with=false" +name = "libhello_nogprwith" +version = "1.0.0" +auto-gpr-with = false +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mylogin"] +project-files = ["will_fail_if_withed.gpr"] diff --git a/testsuite/tests/auto-gpr-with/basic/test.py b/testsuite/tests/with/auto-gpr-with/basic/test.py similarity index 100% rename from testsuite/tests/auto-gpr-with/basic/test.py rename to testsuite/tests/with/auto-gpr-with/basic/test.py diff --git a/testsuite/tests/auto-gpr-with/basic/test.yaml b/testsuite/tests/with/auto-gpr-with/basic/test.yaml similarity index 100% rename from testsuite/tests/auto-gpr-with/basic/test.yaml rename to testsuite/tests/with/auto-gpr-with/basic/test.yaml diff --git a/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/gp/gpr_in_subdir/gpr_in_subdir-1.0.0.toml b/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/gp/gpr_in_subdir/gpr_in_subdir-1.0.0.toml new file mode 100644 index 00000000..a2eb874e --- /dev/null +++ b/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/gp/gpr_in_subdir/gpr_in_subdir-1.0.0.toml @@ -0,0 +1,8 @@ +description = "gpr file in subdirs" +name = "gpr_in_subdir" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" +licenses = [] +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +project-files = ["dir1/dir2/dir3/gpr_in_subdir.gpr"] diff --git a/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/index.toml b/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/index.toml new file mode 100644 index 00000000..5f154108 --- /dev/null +++ b/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/my_index/index.toml @@ -0,0 +1 @@ +version = "0.1" diff --git a/testsuite/tests/auto-gpr-with/gpr_in_subdir/test.py b/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/test.py similarity index 100% rename from testsuite/tests/auto-gpr-with/gpr_in_subdir/test.py rename to testsuite/tests/with/auto-gpr-with/gpr_in_subdir/test.py diff --git a/testsuite/tests/auto-gpr-with/gpr_in_subdir/test.yaml b/testsuite/tests/with/auto-gpr-with/gpr_in_subdir/test.yaml similarity index 100% rename from testsuite/tests/auto-gpr-with/gpr_in_subdir/test.yaml rename to testsuite/tests/with/auto-gpr-with/gpr_in_subdir/test.yaml diff --git a/testsuite/tests/with/pin-dir/my_index/index/index.toml b/testsuite/tests/with/pin-dir/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/with/pin-dir/my_index/index/index.toml +++ b/testsuite/tests/with/pin-dir/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" diff --git a/testsuite/tests/with/pin-dir/my_index/index/li/libhello.toml b/testsuite/tests/with/pin-dir/my_index/index/li/libhello/libhello-1.0.0.toml similarity index 54% rename from testsuite/tests/with/pin-dir/my_index/index/li/libhello.toml rename to testsuite/tests/with/pin-dir/my_index/index/li/libhello/libhello-1.0.0.toml index 460334ba..463c1f32 100644 --- a/testsuite/tests/with/pin-dir/my_index/index/li/libhello.toml +++ b/testsuite/tests/with/pin-dir/my_index/index/li/libhello/libhello-1.0.0.toml @@ -1,8 +1,7 @@ -[general] description = "libhello" +name = "libhello" +version = "1.0.0" +origin = "file://../../../crates/libhello_1.0.0" licenses = [] maintainers = ["some@one.com"] maintainers-logins = ["mylogin"] - -['1.0'] -origin = "file://../../crates/libhello_1.0.0" diff --git a/testsuite/tests/workflows/action-command/my_index/index/he/hello_world.toml b/testsuite/tests/workflows/action-command/my_index/index/he/hello_world/hello_world-0.1.0.toml similarity index 60% rename from testsuite/tests/workflows/action-command/my_index/index/he/hello_world.toml rename to testsuite/tests/workflows/action-command/my_index/index/he/hello_world/hello_world-0.1.0.toml index 51febcc9..735de942 100644 --- a/testsuite/tests/workflows/action-command/my_index/index/he/hello_world.toml +++ b/testsuite/tests/workflows/action-command/my_index/index/he/hello_world/hello_world-0.1.0.toml @@ -1,20 +1,18 @@ -[general] -description = """"Hello, world!" demonstration project""" +description = "\"Hello, world!\" demonstration project" +name = "hello_world" +version = "0.1.0" +origin = "file://." licenses = [] maintainers = ["example@example.com"] maintainers-logins = ["mylogin"] - -['0.1'] -origin = "file://." - -[[general.actions.'case(os)'.linux]] +[[actions."case(os)".linux]] type = "post-fetch" command = ["touch", "test_post_fetch"] -[[general.actions.'case(os)'.macos]] +[[actions."case(os)".macos]] type = "post-fetch" command = ["touch", "test_post_fetch"] -[[general.actions.'case(os)'.windows]] +[[actions."case(os)".windows]] type = "post-fetch" command = ["cmd", "/C", "copy NUL test_post_fetch"] diff --git a/testsuite/tests/workflows/action-command/my_index/index/index.toml b/testsuite/tests/workflows/action-command/my_index/index/index.toml index 319b3b37..5f154108 100644 --- a/testsuite/tests/workflows/action-command/my_index/index/index.toml +++ b/testsuite/tests/workflows/action-command/my_index/index/index.toml @@ -1 +1 @@ -version = "0.3" +version = "0.1" -- 2.39.5