Thread overview
Dub Error Message "Invalid variable: DUB"
Jun 07, 2020
Russel Winder
Jun 07, 2020
Jacob Carlborg
Jun 07, 2020
Russel Winder
Jun 07, 2020
Andre Pany
Jun 07, 2020
Paul Backus
Jun 07, 2020
Andre Pany
Jun 07, 2020
Paul Backus
Jun 08, 2020
Andre Pany
Jun 08, 2020
Paul Backus
Jun 08, 2020
Andre Pany
June 07, 2020
Hi,

Why on earth is Dub sending out this error message (Invalid variable: DUB) on GitLab but not on Travis-CI or locally?

OK, that was slightly rhetorical, more reasonably, why is dub sending out this message at all?

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



June 07, 2020
On 2020-06-07 11:24, Russel Winder wrote:
> Hi,
> 
> Why on earth is Dub sending out this error message (Invalid variable: DUB) on
> GitLab but not on Travis-CI or locally?
> 
> OK, that was slightly rhetorical, more reasonably, why is dub sending out this
> message at all?

Dub is supposed to make an environment variable named "DUB" available to the build script. It should contain the path to the Dub executable. I guess that somehow fails. Might be some unexpected character in the path?

-- 
/Jacob Carlborg
June 07, 2020
On Sun, 2020-06-07 at 13:21 +0200, Jacob Carlborg via Digitalmars-d-learn wrote:
> On 2020-06-07 11:24, Russel Winder wrote:
> > Hi,
> > 
> > Why on earth is Dub sending out this error message (Invalid variable: DUB)
> > on
> > GitLab but not on Travis-CI or locally?
> > 
> > OK, that was slightly rhetorical, more reasonably, why is dub sending out
> > this
> > message at all?
> 
> Dub is supposed to make an environment variable named "DUB" available to the build script. It should contain the path to the Dub executable. I guess that somehow fails. Might be some unexpected character in the path?

I guess dub 1.19 is just too old. I have to manually set "export DUB=/usr/bin/dub".

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



June 07, 2020
On Sunday, 7 June 2020 at 11:21:03 UTC, Jacob Carlborg wrote:
> On 2020-06-07 11:24, Russel Winder wrote:
>> Hi,
>> 
>> Why on earth is Dub sending out this error message (Invalid variable: DUB) on
>> GitLab but not on Travis-CI or locally?
>> 
>> OK, that was slightly rhetorical, more reasonably, why is dub sending out this
>> message at all?
>
> Dub is supposed to make an environment variable named "DUB" available to the build script. It should contain the path to the Dub executable. I guess that somehow fails. Might be some unexpected character in the path?

I am not sure but $DUB is a variable which could be used in dub descriptor file but it isn't an environment variable.

$DUB_EXE is an environment variable.

Kind regards
Andre
June 07, 2020
On Sunday, 7 June 2020 at 12:52:12 UTC, Andre Pany wrote:
>
> I am not sure but $DUB is a variable which could be used in dub descriptor file but it isn't an environment variable.
>
> $DUB_EXE is an environment variable.
>
> Kind regards
> Andre

If what you say is true, the Dub documentation needs to be updated:

https://dub.pm/package-format-json.html#environment-variables
June 07, 2020
On Sunday, 7 June 2020 at 15:37:27 UTC, Paul Backus wrote:
> On Sunday, 7 June 2020 at 12:52:12 UTC, Andre Pany wrote:
>>
>> I am not sure but $DUB is a variable which could be used in dub descriptor file but it isn't an environment variable.
>>
>> $DUB_EXE is an environment variable.
>>
>> Kind regards
>> Andre
>
> If what you say is true, the Dub documentation needs to be updated:
>
> https://dub.pm/package-format-json.html#environment-variables

Each of the table has an explanation section were they can be used. $DUB can only be used within the dub descriptor but not within scripts called from the hooks.

From the hooks you can use these environment variables: https://github.com/andre2007/dub/blob/376ff5854dcd7bbc6116f72001c8c6d13eb3cbf0/source/dub/generators/generator.d#L763

Kind regards
Andre
June 07, 2020
On Sunday, 7 June 2020 at 16:26:17 UTC, Andre Pany wrote:
> On Sunday, 7 June 2020 at 15:37:27 UTC, Paul Backus wrote:
>> On Sunday, 7 June 2020 at 12:52:12 UTC, Andre Pany wrote:
>>>
>>> I am not sure but $DUB is a variable which could be used in dub descriptor file but it isn't an environment variable.
>>>
>>> $DUB_EXE is an environment variable.
>>>
>>> Kind regards
>>> Andre
>>
>> If what you say is true, the Dub documentation needs to be updated:
>>
>> https://dub.pm/package-format-json.html#environment-variables
>
> Each of the table has an explanation section were they can be used. $DUB can only be used within the dub descriptor but not within scripts called from the hooks.
>
> From the hooks you can use these environment variables: https://github.com/andre2007/dub/blob/376ff5854dcd7bbc6116f72001c8c6d13eb3cbf0/source/dub/generators/generator.d#L763
>
> Kind regards
> Andre

The documentations says:

> Inside of custom commands directives a number of additional variables is available:

...and then lists the variables from the function you linked to. "Additional" implies that they are not the only variables that can be used in hooks, and that the variables listed previously (such as $DUB) can also be used. If this is not the case, then the documentation is inaccurate and should be updated.

I would also add: if you feel the need to link to the source code to explain to use a feature, rather than referring to the documentation, that is a good sign that the documentation is inadequate.
June 08, 2020
On Sunday, 7 June 2020 at 16:54:48 UTC, Paul Backus wrote:
> On Sunday, 7 June 2020 at 16:26:17 UTC, Andre Pany wrote:
>> On Sunday, 7 June 2020 at 15:37:27 UTC, Paul Backus wrote:
>>> On Sunday, 7 June 2020 at 12:52:12 UTC, Andre Pany wrote:
>>>>
>>>> I am not sure but $DUB is a variable which could be used in dub descriptor file but it isn't an environment variable.
>>>>
>>>> $DUB_EXE is an environment variable.
>>>>
>>>> Kind regards
>>>> Andre
>>>
>>> If what you say is true, the Dub documentation needs to be updated:
>>>
>>> https://dub.pm/package-format-json.html#environment-variables
>>
>> Each of the table has an explanation section were they can be used. $DUB can only be used within the dub descriptor but not within scripts called from the hooks.
>>
>> From the hooks you can use these environment variables: https://github.com/andre2007/dub/blob/376ff5854dcd7bbc6116f72001c8c6d13eb3cbf0/source/dub/generators/generator.d#L763
>>
>> Kind regards
>> Andre
>
> The documentations says:
>
>> Inside of custom commands directives a number of additional variables is available:
>
> ...and then lists the variables from the function you linked to. "Additional" implies that they are not the only variables that can be used in hooks, and that the variables listed previously (such as $DUB) can also be used. If this is not the case, then the documentation is inaccurate and should be updated.
>
> I would also add: if you feel the need to link to the source code to explain to use a feature, rather than referring to the documentation, that is a good sign that the documentation is inadequate.

I had a second look on the descriptions and from a non native speaker view it sounds correct.
But you are right from a native speaker view the wording might be incorrect.

If you have time, could you check the wording and make a proposal?

https://github.com/dlang/dub-docs/blob/master/views/inc.package_format.envvars.dt

Kind regards
Andre

June 08, 2020
On Monday, 8 June 2020 at 17:55:24 UTC, Andre Pany wrote:
>
> I had a second look on the descriptions and from a non native speaker view it sounds correct.
> But you are right from a native speaker view the wording might be incorrect.
>
> If you have time, could you check the wording and make a proposal?
>
> https://github.com/dlang/dub-docs/blob/master/views/inc.package_format.envvars.dt
>
> Kind regards
> Andre

https://github.com/dlang/dub-docs/pull/26
June 08, 2020
On Monday, 8 June 2020 at 18:38:17 UTC, Paul Backus wrote:
> On Monday, 8 June 2020 at 17:55:24 UTC, Andre Pany wrote:
>>
>> I had a second look on the descriptions and from a non native speaker view it sounds correct.
>> But you are right from a native speaker view the wording might be incorrect.
>>
>> If you have time, could you check the wording and make a proposal?
>>
>> https://github.com/dlang/dub-docs/blob/master/views/inc.package_format.envvars.dt
>>
>> Kind regards
>> Andre
>
> https://github.com/dlang/dub-docs/pull/26

Thanks a lot.

Kind regards
Andre