Skip to content

Commit

Permalink
Fix dlang#2691: Use same structure for managed and unmanaged path
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Geod24 committed Jan 10, 2024
1 parent 662f68b commit 482f5e3
Show file tree
Hide file tree
Showing 33 changed files with 11 additions and 26 deletions.
2 changes: 1 addition & 1 deletion source/dub/packagemanager.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions test/issue1024-selective-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions test/issue564-invalid-upgrade-dependency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

This file was deleted.

7 changes: 2 additions & 5 deletions test/issue813-pure-sub-dependency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 3 additions & 6 deletions test/issue923-subpackage-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 482f5e3

Please sign in to comment.