From c724cbbc0de3e0ecf8df25521d58cb359016e4ee Mon Sep 17 00:00:00 2001 From: Tobias Pankrath Date: Wed, 11 Mar 2020 14:27:06 +0100 Subject: [PATCH] fix #1556: dub --cache=local fetch + build Building a package that was locally cached failed, because the dependencies whould be fetched at the wrong destination. For example if one tries to build the package 'optional': $ dub --cache=local fetch optional -> optional is now at ./.dub/package/optional $ dub --cache=local build optional -> fails because the dependency bolts was fetched to ./.dub/package/optional/.dub/package/bolts. This is fixed by not overwriting the root path if dub builds a package from the cache. --- source/dub/commandline.d | 1 - test/issue1556.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100755 test/issue1556.sh diff --git a/source/dub/commandline.d b/source/dub/commandline.d index 077b9f6997..101d641786 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -714,7 +714,6 @@ abstract class PackageBuildCommand : Command { auto pack = dub.packageManager.getFirstPackage(package_name); enforce(pack, "Failed to find a package named '"~package_name~"' locally."); logInfo("Building package %s in %s", pack.name, pack.path.toNativeString()); - dub.rootPath = pack.path; dub.loadPackage(pack); return true; } diff --git a/test/issue1556.sh b/test/issue1556.sh new file mode 100755 index 0000000000..4c0e414601 --- /dev/null +++ b/test/issue1556.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +. $(dirname "${BASH_SOURCE[0]}")/common.sh + +${DUB} --cache=local remove optional || true +${DUB} --cache=local remove bolts || true +${DUB} --cache=local fetch optional +${DUB} --cache=local build optional --compiler=${DC} +