Thread overview
dub / use git branch
Feb 16, 2020
Robert M. Münch
Feb 17, 2020
Basile B.
February 16, 2020
I want to use a specific branch version if a package. I specified the branch version in a dub.selections.json file.

But it seems that dub requires a ZIP file that can be downloaded from code.dlang.org, which of course fails because the branch is only available on github.

Fetching rtree ~fix-#3 (getting selected version)...
Downloading https://code.dlang.org/packages/rtree/~fix-#3.zip failed with 404 (Not Found).

How am I supposed to switch to a branch version of a package to try a bug-fix version for example?

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

February 17, 2020
On Sunday, 16 February 2020 at 14:01:13 UTC, Robert M. Münch wrote:
> I want to use a specific branch version if a package. I specified the branch version in a dub.selections.json file.
>
> But it seems that dub requires a ZIP file that can be downloaded from code.dlang.org, which of course fails because the branch is only available on github.
>
> Fetching rtree ~fix-#3 (getting selected version)...
> Downloading https://code.dlang.org/packages/rtree/~fix-#3.zip failed with 404 (Not Found).
>
> How am I supposed to switch to a branch version of a package to try a bug-fix version for example?

We fail to get the most basic support for git since a full year now:

https://github.com/dlang/dub/pull/1802
https://github.com/dlang/dub/pull/1798
https://github.com/dlang/dub/pull/1403

So for now you have two options:

1/ in your project recipe, you can add the dependency as a path to the git submodule representing the DUB package and do the branch checkout manually or using a DUB pregenerate command.

2/ ask to the dependency maintainer to add a git tag in the branch you'd like to use.
the DUB registry will automatically create a new version of the package, using the right branch. This is done for example for stx allocator and so far this work.
February 17, 2020
On 2/16/20 9:01 AM, Robert M. Münch wrote:
> I want to use a specific branch version if a package. I specified the branch version in a dub.selections.json file.
> 
> But it seems that dub requires a ZIP file that can be downloaded from code.dlang.org, which of course fails because the branch is only available on github.
> 
> Fetching rtree ~fix-#3 (getting selected version)...
> Downloading https://code.dlang.org/packages/rtree/~fix-#3.zip failed with 404 (Not Found).
> 
> How am I supposed to switch to a branch version of a package to try a bug-fix version for example?
> 

git clone that branch to a local repository.

dub add-local . in that repository. It will say something like "adding v1.0.1+commit..." then you mark your project as requiring ~> v1.0.1, and it will pick your local repository.

When you are done, make sure to dub remove-local that repository so it stops trying to grab your local copy.

-Steve