dlang / dub

Package and build management system for D
MIT License
673 stars 230 forks source link

`dub add-local` should affect `dub run` #2706

Closed VPanteleev-S7 closed 8 months ago

VPanteleev-S7 commented 11 months ago

Consider the situation:

So, if the script runs dub run some-package@1.2.3, we should be able to use dub add-local path/to/our/version/of/package 1.2.3 first to make the former command use the version specified in the latter command.

Alternatively, a hypothetical dub install --version=1.2.3 could install the package from the current directory into Dub's cache, so that dub run would then use it.

WebFreak001 commented 11 months ago
dub fetch package@1.2.3
dub run package@1.2.3

and add-local beforehand and using dub run package@1.2.3 should also work, did it not?

VPanteleev-S7 commented 11 months ago

dub fetch package@1.2.3

How to do this step without Internet access, if we have a copy of the package?

WebFreak001 commented 11 months ago

no need to run it at all, just only do the add-local one and it should work.

VPanteleev-S7 commented 11 months ago

Sorry, I don't understand what you mean. It doesn't work.

$ mkdir some-temp-directory && cd some-temp-directory
$ wget https://code.dlang.org/packages/dpp/0.5.5.zip
...
$ unzip 0.5.5.zip
...
$ HOME=$PWD dub add-local dpp-0.5.5 0.5.5
             Registered package: dpp (version: 0.5.5)
$ HOME=$PWD bwrap --dev-bind / / --unshare-net dub run dpp@0.5.5
     Warning Package dpp not found for registry at https://code.dlang.org/ (fallbacks registry at https://codemirror.dlang.org/, registry at https://dub.bytecraft.nl/, registry at https://code-mirror.dlang.io/): Failed to download https://code.dlang.org/api/packages/infos?packages=%5B%22dpp%22%5D&include_dependencies=true&minimize=true
Error No package dpp was found matching the dependency 0.5.5

(HOME=$PWD makes Dub use a fresh ~/.dub, bwrap --dev-bind / / --unshare-net effectively disables Internet access)

Geod24 commented 8 months ago

@VPanteleev-S7 : Thanks for the test case. Fix is here: https://github.com/dlang/dub/pull/2787

VPanteleev-S7 commented 8 months ago

Awesome, thank you!