From 482f5e3a1c78a770586890532dc6a4050ae16526 Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Mon, 8 Jan 2024 23:41:28 +0100 Subject: [PATCH] Fix #2691: Use same structure for managed and unmanaged path Currently, we issue a warning asking people to migrate, but the migrated path is not actually recognized. It was suggested in the issue to ignore this warning for add-path. However, as add-path is a rather low-level use, I think it is better to impose the same condition for managed and unmanaged path, in order to be able to provide the same guarantees. For example, once we move to reading version from the path, we can provide the same speedups for add-path users. We can also make sure that add-path users don't have surprises when dealing with packages that expect a certain structure outside their directory, such as arsd and ae. Some tests were updated with the new path, however, as many will likely be rewritten with the new test framework, and a lot of tests are affected, not all of them were updated, providing coverage for the old and new code alike. --- source/dub/packagemanager.d | 2 +- .../a/{ => 1.0.0/a}/dub.sdl | 0 .../b/{ => 1.0.0/b}/dub.sdl | 0 .../b/{ => 1.0.0/b}/source/b.d | 0 .../c/{ => 1.0.0/c}/dub.sdl | 0 .../main/{ => ~master/main}/dub.sdl | 0 .../main/{ => ~master/main}/source/app.d | 0 test/issue1024-selective-upgrade.sh | 8 ++++---- .../{a-1.0.0 => a/1.0.0/a}/dub.sdl | 0 .../{a-1.0.1 => a/1.0.1/a}/dub.sdl | 0 .../{b-1.0.0 => b/1.0.0/b}/dub.sdl | 0 .../{b-1.0.1 => b/1.0.1/b}/dub.sdl | 0 .../main/{ => ~master/main}/dub.sdl | 0 test/issue564-invalid-upgrade-dependency.sh | 5 +---- .../{a-1.0.0 => a/1.0.0/a}/dub.json | 0 .../{a-1.0.0 => a/1.0.0/a}/source/a.d | 0 .../{a-1.1.0 => a/1.1.0/a}/dub.json | 0 .../{a-1.1.0 => a/1.1.0/a}/source/a.d | 0 .../main/dub.selections.json | 6 ------ .../main/{ => ~master/main}/dub.json | 0 .../main/{ => ~master/main}/source/app.d | 0 test/issue813-pure-sub-dependency.sh | 7 ++----- .../main/{ => ~master/main}/dub.sdl | 0 .../main/{ => ~master/main}/src/app.d | 0 .../sub/{ => ~master/sub}/dub.sdl | 0 .../sub/{ => ~master/sub}/sub/dub.sdl | 0 .../sub/{ => ~master/sub}/sub/src/sub/test.d | 0 test/issue923-subpackage-deps.sh | 9 +++------ test/issue923-subpackage-deps/a/{ => 1.0.0/a}/dub.sdl | 0 test/issue923-subpackage-deps/b/{ => 1.0.0/b}/dub.sdl | 0 test/issue923-subpackage-deps/b/{ => 1.0.0/b}/source/b.d | 0 .../main/{ => ~master/main}/dub.sdl | 0 .../main/{ => ~master/main}/source/app.d | 0 33 files changed, 11 insertions(+), 26 deletions(-) rename test/issue1005-configuration-resolution/a/{ => 1.0.0/a}/dub.sdl (100%) rename test/issue1005-configuration-resolution/b/{ => 1.0.0/b}/dub.sdl (100%) rename test/issue1005-configuration-resolution/b/{ => 1.0.0/b}/source/b.d (100%) rename test/issue1005-configuration-resolution/c/{ => 1.0.0/c}/dub.sdl (100%) rename test/issue1005-configuration-resolution/main/{ => ~master/main}/dub.sdl (100%) rename test/issue1005-configuration-resolution/main/{ => ~master/main}/source/app.d (100%) rename test/issue1024-selective-upgrade/{a-1.0.0 => a/1.0.0/a}/dub.sdl (100%) rename test/issue1024-selective-upgrade/{a-1.0.1 => a/1.0.1/a}/dub.sdl (100%) rename test/issue1024-selective-upgrade/{b-1.0.0 => b/1.0.0/b}/dub.sdl (100%) rename test/issue1024-selective-upgrade/{b-1.0.1 => b/1.0.1/b}/dub.sdl (100%) rename test/issue1024-selective-upgrade/main/{ => ~master/main}/dub.sdl (100%) rename test/issue564-invalid-upgrade-dependency/{a-1.0.0 => a/1.0.0/a}/dub.json (100%) rename test/issue564-invalid-upgrade-dependency/{a-1.0.0 => a/1.0.0/a}/source/a.d (100%) rename test/issue564-invalid-upgrade-dependency/{a-1.1.0 => a/1.1.0/a}/dub.json (100%) rename test/issue564-invalid-upgrade-dependency/{a-1.1.0 => a/1.1.0/a}/source/a.d (100%) delete mode 100644 test/issue564-invalid-upgrade-dependency/main/dub.selections.json rename test/issue564-invalid-upgrade-dependency/main/{ => ~master/main}/dub.json (100%) rename test/issue564-invalid-upgrade-dependency/main/{ => ~master/main}/source/app.d (100%) rename test/issue813-pure-sub-dependency/main/{ => ~master/main}/dub.sdl (100%) rename test/issue813-pure-sub-dependency/main/{ => ~master/main}/src/app.d (100%) rename test/issue813-pure-sub-dependency/sub/{ => ~master/sub}/dub.sdl (100%) rename test/issue813-pure-sub-dependency/sub/{ => ~master/sub}/sub/dub.sdl (100%) rename test/issue813-pure-sub-dependency/sub/{ => ~master/sub}/sub/src/sub/test.d (100%) rename test/issue923-subpackage-deps/a/{ => 1.0.0/a}/dub.sdl (100%) rename test/issue923-subpackage-deps/b/{ => 1.0.0/b}/dub.sdl (100%) rename test/issue923-subpackage-deps/b/{ => 1.0.0/b}/source/b.d (100%) rename test/issue923-subpackage-deps/main/{ => ~master/main}/dub.sdl (100%) rename test/issue923-subpackage-deps/main/{ => ~master/main}/source/app.d (100%) diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 75298690e..d7bff6216 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -1335,7 +1335,7 @@ package struct Location { // Managed structure: $ROOT/$NAME/$VERSION/$NAME // This is the most common code path - else if (mgr.isManagedPath(path)) { + else { // Iterate over versions of a package foreach (versdir; iterateDirectory(pack_path)) { if (!versdir.isDirectory) continue; diff --git a/test/issue1005-configuration-resolution/a/dub.sdl b/test/issue1005-configuration-resolution/a/1.0.0/a/dub.sdl similarity index 100% rename from test/issue1005-configuration-resolution/a/dub.sdl rename to test/issue1005-configuration-resolution/a/1.0.0/a/dub.sdl diff --git a/test/issue1005-configuration-resolution/b/dub.sdl b/test/issue1005-configuration-resolution/b/1.0.0/b/dub.sdl similarity index 100% rename from test/issue1005-configuration-resolution/b/dub.sdl rename to test/issue1005-configuration-resolution/b/1.0.0/b/dub.sdl diff --git a/test/issue1005-configuration-resolution/b/source/b.d b/test/issue1005-configuration-resolution/b/1.0.0/b/source/b.d similarity index 100% rename from test/issue1005-configuration-resolution/b/source/b.d rename to test/issue1005-configuration-resolution/b/1.0.0/b/source/b.d diff --git a/test/issue1005-configuration-resolution/c/dub.sdl b/test/issue1005-configuration-resolution/c/1.0.0/c/dub.sdl similarity index 100% rename from test/issue1005-configuration-resolution/c/dub.sdl rename to test/issue1005-configuration-resolution/c/1.0.0/c/dub.sdl diff --git a/test/issue1005-configuration-resolution/main/dub.sdl b/test/issue1005-configuration-resolution/main/~master/main/dub.sdl similarity index 100% rename from test/issue1005-configuration-resolution/main/dub.sdl rename to test/issue1005-configuration-resolution/main/~master/main/dub.sdl diff --git a/test/issue1005-configuration-resolution/main/source/app.d b/test/issue1005-configuration-resolution/main/~master/main/source/app.d similarity index 100% rename from test/issue1005-configuration-resolution/main/source/app.d rename to test/issue1005-configuration-resolution/main/~master/main/source/app.d diff --git a/test/issue1024-selective-upgrade.sh b/test/issue1024-selective-upgrade.sh index dc7c00971..ef6033348 100755 --- a/test/issue1024-selective-upgrade.sh +++ b/test/issue1024-selective-upgrade.sh @@ -2,13 +2,13 @@ . $(dirname "${BASH_SOURCE[0]}")/common.sh cd ${CURR_DIR}/issue1024-selective-upgrade -echo "{\"fileVersion\": 1,\"versions\": {\"a\": \"1.0.0\", \"b\": \"1.0.0\"}}" > main/dub.selections.json -$DUB upgrade --bare --root=main a +echo "{\"fileVersion\": 1,\"versions\": {\"a\": \"1.0.0\", \"b\": \"1.0.0\"}}" > main/~master/main/dub.selections.json +$DUB upgrade --bare --root=main/~master/main/ a -if ! grep -c -e "\"a\": \"1.0.1\"" main/dub.selections.json; then +if ! grep -c -e "\"a\": \"1.0.1\"" main/~master/main/dub.selections.json; then die $LINENO "Specified dependency was not upgraded." fi -if grep -c -e "\"b\": \"1.0.1\"" main/dub.selections.json; then +if grep -c -e "\"b\": \"1.0.1\"" main/~master/main/dub.selections.json; then die $LINENO "Non-specified dependency got upgraded." fi diff --git a/test/issue1024-selective-upgrade/a-1.0.0/dub.sdl b/test/issue1024-selective-upgrade/a/1.0.0/a/dub.sdl similarity index 100% rename from test/issue1024-selective-upgrade/a-1.0.0/dub.sdl rename to test/issue1024-selective-upgrade/a/1.0.0/a/dub.sdl diff --git a/test/issue1024-selective-upgrade/a-1.0.1/dub.sdl b/test/issue1024-selective-upgrade/a/1.0.1/a/dub.sdl similarity index 100% rename from test/issue1024-selective-upgrade/a-1.0.1/dub.sdl rename to test/issue1024-selective-upgrade/a/1.0.1/a/dub.sdl diff --git a/test/issue1024-selective-upgrade/b-1.0.0/dub.sdl b/test/issue1024-selective-upgrade/b/1.0.0/b/dub.sdl similarity index 100% rename from test/issue1024-selective-upgrade/b-1.0.0/dub.sdl rename to test/issue1024-selective-upgrade/b/1.0.0/b/dub.sdl diff --git a/test/issue1024-selective-upgrade/b-1.0.1/dub.sdl b/test/issue1024-selective-upgrade/b/1.0.1/b/dub.sdl similarity index 100% rename from test/issue1024-selective-upgrade/b-1.0.1/dub.sdl rename to test/issue1024-selective-upgrade/b/1.0.1/b/dub.sdl diff --git a/test/issue1024-selective-upgrade/main/dub.sdl b/test/issue1024-selective-upgrade/main/~master/main/dub.sdl similarity index 100% rename from test/issue1024-selective-upgrade/main/dub.sdl rename to test/issue1024-selective-upgrade/main/~master/main/dub.sdl diff --git a/test/issue564-invalid-upgrade-dependency.sh b/test/issue564-invalid-upgrade-dependency.sh index 19258cec2..fe1b6a38c 100755 --- a/test/issue564-invalid-upgrade-dependency.sh +++ b/test/issue564-invalid-upgrade-dependency.sh @@ -2,7 +2,4 @@ . $(dirname "${BASH_SOURCE[0]}")/common.sh cd ${CURR_DIR}/issue564-invalid-upgrade-dependency -rm -rf a-1.0.0/.dub -rm -rf a-1.1.0/.dub -rm -rf main/.dub -${DUB} build --bare --compiler=${DC} main +${DUB} build -f --bare --compiler=${DC} main diff --git a/test/issue564-invalid-upgrade-dependency/a-1.0.0/dub.json b/test/issue564-invalid-upgrade-dependency/a/1.0.0/a/dub.json similarity index 100% rename from test/issue564-invalid-upgrade-dependency/a-1.0.0/dub.json rename to test/issue564-invalid-upgrade-dependency/a/1.0.0/a/dub.json diff --git a/test/issue564-invalid-upgrade-dependency/a-1.0.0/source/a.d b/test/issue564-invalid-upgrade-dependency/a/1.0.0/a/source/a.d similarity index 100% rename from test/issue564-invalid-upgrade-dependency/a-1.0.0/source/a.d rename to test/issue564-invalid-upgrade-dependency/a/1.0.0/a/source/a.d diff --git a/test/issue564-invalid-upgrade-dependency/a-1.1.0/dub.json b/test/issue564-invalid-upgrade-dependency/a/1.1.0/a/dub.json similarity index 100% rename from test/issue564-invalid-upgrade-dependency/a-1.1.0/dub.json rename to test/issue564-invalid-upgrade-dependency/a/1.1.0/a/dub.json diff --git a/test/issue564-invalid-upgrade-dependency/a-1.1.0/source/a.d b/test/issue564-invalid-upgrade-dependency/a/1.1.0/a/source/a.d similarity index 100% rename from test/issue564-invalid-upgrade-dependency/a-1.1.0/source/a.d rename to test/issue564-invalid-upgrade-dependency/a/1.1.0/a/source/a.d diff --git a/test/issue564-invalid-upgrade-dependency/main/dub.selections.json b/test/issue564-invalid-upgrade-dependency/main/dub.selections.json deleted file mode 100644 index e24adfe02..000000000 --- a/test/issue564-invalid-upgrade-dependency/main/dub.selections.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "fileVersion": 1, - "versions": { - "a": "1.0.0" - } -} diff --git a/test/issue564-invalid-upgrade-dependency/main/dub.json b/test/issue564-invalid-upgrade-dependency/main/~master/main/dub.json similarity index 100% rename from test/issue564-invalid-upgrade-dependency/main/dub.json rename to test/issue564-invalid-upgrade-dependency/main/~master/main/dub.json diff --git a/test/issue564-invalid-upgrade-dependency/main/source/app.d b/test/issue564-invalid-upgrade-dependency/main/~master/main/source/app.d similarity index 100% rename from test/issue564-invalid-upgrade-dependency/main/source/app.d rename to test/issue564-invalid-upgrade-dependency/main/~master/main/source/app.d diff --git a/test/issue813-pure-sub-dependency.sh b/test/issue813-pure-sub-dependency.sh index ec2291ebe..a76dee836 100755 --- a/test/issue813-pure-sub-dependency.sh +++ b/test/issue813-pure-sub-dependency.sh @@ -2,8 +2,5 @@ . $(dirname "${BASH_SOURCE[0]}")/common.sh cd ${CURR_DIR}/issue813-pure-sub-dependency -rm -rf main/.dub -rm -rf sub/.dub -rm -rf sub/sub/.dub -rm -f main/dub.selections.json -${DUB} build --bare --compiler=${DC} main +rm -f main/~master/main/dub.selections.json +${DUB} build -f --bare --compiler=${DC} main diff --git a/test/issue813-pure-sub-dependency/main/dub.sdl b/test/issue813-pure-sub-dependency/main/~master/main/dub.sdl similarity index 100% rename from test/issue813-pure-sub-dependency/main/dub.sdl rename to test/issue813-pure-sub-dependency/main/~master/main/dub.sdl diff --git a/test/issue813-pure-sub-dependency/main/src/app.d b/test/issue813-pure-sub-dependency/main/~master/main/src/app.d similarity index 100% rename from test/issue813-pure-sub-dependency/main/src/app.d rename to test/issue813-pure-sub-dependency/main/~master/main/src/app.d diff --git a/test/issue813-pure-sub-dependency/sub/dub.sdl b/test/issue813-pure-sub-dependency/sub/~master/sub/dub.sdl similarity index 100% rename from test/issue813-pure-sub-dependency/sub/dub.sdl rename to test/issue813-pure-sub-dependency/sub/~master/sub/dub.sdl diff --git a/test/issue813-pure-sub-dependency/sub/sub/dub.sdl b/test/issue813-pure-sub-dependency/sub/~master/sub/sub/dub.sdl similarity index 100% rename from test/issue813-pure-sub-dependency/sub/sub/dub.sdl rename to test/issue813-pure-sub-dependency/sub/~master/sub/sub/dub.sdl diff --git a/test/issue813-pure-sub-dependency/sub/sub/src/sub/test.d b/test/issue813-pure-sub-dependency/sub/~master/sub/sub/src/sub/test.d similarity index 100% rename from test/issue813-pure-sub-dependency/sub/sub/src/sub/test.d rename to test/issue813-pure-sub-dependency/sub/~master/sub/sub/src/sub/test.d diff --git a/test/issue923-subpackage-deps.sh b/test/issue923-subpackage-deps.sh index f3be79c4f..67e137bb4 100755 --- a/test/issue923-subpackage-deps.sh +++ b/test/issue923-subpackage-deps.sh @@ -2,13 +2,10 @@ . $(dirname "${BASH_SOURCE[0]}")/common.sh cd ${CURR_DIR}/issue923-subpackage-deps -rm -rf main/.dub -rm -rf a/.dub -rm -rf b/.dub -rm -f main/dub.selections.json -${DUB} build --bare --compiler=${DC} main +rm -f main/~master/main/dub.selections.json +${DUB} build -f --bare --compiler=${DC} main -if ! grep -c -e \"b\" main/dub.selections.json; then +if ! grep -c -e \"b\" main/~master/main/dub.selections.json; then die $LINENO 'Dependency b not resolved.' fi diff --git a/test/issue923-subpackage-deps/a/dub.sdl b/test/issue923-subpackage-deps/a/1.0.0/a/dub.sdl similarity index 100% rename from test/issue923-subpackage-deps/a/dub.sdl rename to test/issue923-subpackage-deps/a/1.0.0/a/dub.sdl diff --git a/test/issue923-subpackage-deps/b/dub.sdl b/test/issue923-subpackage-deps/b/1.0.0/b/dub.sdl similarity index 100% rename from test/issue923-subpackage-deps/b/dub.sdl rename to test/issue923-subpackage-deps/b/1.0.0/b/dub.sdl diff --git a/test/issue923-subpackage-deps/b/source/b.d b/test/issue923-subpackage-deps/b/1.0.0/b/source/b.d similarity index 100% rename from test/issue923-subpackage-deps/b/source/b.d rename to test/issue923-subpackage-deps/b/1.0.0/b/source/b.d diff --git a/test/issue923-subpackage-deps/main/dub.sdl b/test/issue923-subpackage-deps/main/~master/main/dub.sdl similarity index 100% rename from test/issue923-subpackage-deps/main/dub.sdl rename to test/issue923-subpackage-deps/main/~master/main/dub.sdl diff --git a/test/issue923-subpackage-deps/main/source/app.d b/test/issue923-subpackage-deps/main/~master/main/source/app.d similarity index 100% rename from test/issue923-subpackage-deps/main/source/app.d rename to test/issue923-subpackage-deps/main/~master/main/source/app.d