Skip to content

Commit 1a53049

Browse files
committed
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.
1 parent 662f68b commit 1a53049

File tree

33 files changed

+11
-26
lines changed

33 files changed

+11
-26
lines changed

source/dub/packagemanager.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ package struct Location {
13351335

13361336
// Managed structure: $ROOT/$NAME/$VERSION/$NAME
13371337
// This is the most common code path
1338-
else if (mgr.isManagedPath(path)) {
1338+
else {
13391339
// Iterate over versions of a package
13401340
foreach (versdir; iterateDirectory(pack_path)) {
13411341
if (!versdir.isDirectory) continue;

test/issue1024-selective-upgrade.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
. $(dirname "${BASH_SOURCE[0]}")/common.sh
44
cd ${CURR_DIR}/issue1024-selective-upgrade
5-
echo "{\"fileVersion\": 1,\"versions\": {\"a\": \"1.0.0\", \"b\": \"1.0.0\"}}" > main/dub.selections.json
6-
$DUB upgrade --bare --root=main a
5+
echo "{\"fileVersion\": 1,\"versions\": {\"a\": \"1.0.0\", \"b\": \"1.0.0\"}}" > main/~master/main/dub.selections.json
6+
$DUB upgrade --bare --root=main/~master/main/ a
77

8-
if ! grep -c -e "\"a\": \"1.0.1\"" main/dub.selections.json; then
8+
if ! grep -c -e "\"a\": \"1.0.1\"" main/~master/main/dub.selections.json; then
99
die $LINENO "Specified dependency was not upgraded."
1010
fi
1111

12-
if grep -c -e "\"b\": \"1.0.1\"" main/dub.selections.json; then
12+
if grep -c -e "\"b\": \"1.0.1\"" main/~master/main/dub.selections.json; then
1313
die $LINENO "Non-specified dependency got upgraded."
1414
fi

test/issue564-invalid-upgrade-dependency.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@
22

33
. $(dirname "${BASH_SOURCE[0]}")/common.sh
44
cd ${CURR_DIR}/issue564-invalid-upgrade-dependency
5-
rm -rf a-1.0.0/.dub
6-
rm -rf a-1.1.0/.dub
7-
rm -rf main/.dub
8-
${DUB} build --bare --compiler=${DC} main
5+
${DUB} build -f --bare --compiler=${DC} main

test/issue564-invalid-upgrade-dependency/main/dub.selections.json

-6
This file was deleted.

test/issue813-pure-sub-dependency.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22

33
. $(dirname "${BASH_SOURCE[0]}")/common.sh
44
cd ${CURR_DIR}/issue813-pure-sub-dependency
5-
rm -rf main/.dub
6-
rm -rf sub/.dub
7-
rm -rf sub/sub/.dub
8-
rm -f main/dub.selections.json
9-
${DUB} build --bare --compiler=${DC} main
5+
rm -f main/~master/main/dub.selections.json
6+
${DUB} build -f --bare --compiler=${DC} main

test/issue923-subpackage-deps.sh

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
. $(dirname "${BASH_SOURCE[0]}")/common.sh
44
cd ${CURR_DIR}/issue923-subpackage-deps
5-
rm -rf main/.dub
6-
rm -rf a/.dub
7-
rm -rf b/.dub
8-
rm -f main/dub.selections.json
9-
${DUB} build --bare --compiler=${DC} main
5+
rm -f main/~master/main/dub.selections.json
6+
${DUB} build -f --bare --compiler=${DC} main
107

118

12-
if ! grep -c -e \"b\" main/dub.selections.json; then
9+
if ! grep -c -e \"b\" main/~master/main/dub.selections.json; then
1310
die $LINENO 'Dependency b not resolved.'
1411
fi

0 commit comments

Comments
 (0)