Re: Dub Error Message "Invalid variable: DUB"

2020-06-08 Thread Andre Pany via Digitalmars-d-learn

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


Re: Dub Error Message "Invalid variable: DUB"

2020-06-08 Thread Paul Backus via Digitalmars-d-learn

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


Re: Dub Error Message "Invalid variable: DUB"

2020-06-08 Thread Andre Pany via Digitalmars-d-learn

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



Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Paul Backus via Digitalmars-d-learn

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.


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Andre Pany via Digitalmars-d-learn

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


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Paul Backus via Digitalmars-d-learn

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


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Basile B. via Digitalmars-d-learn

On Sunday, 7 June 2020 at 12:24:13 UTC, Russel Winder wrote:
On Sun, 2020-06-07 at 10:30 +, Basile B. via 
Digitalmars-d-learn wrote: […]
What is the docker image that you use ?  If it is an older 
version maybe that the $DUB env variable is not yet supported 
by the dub version that's installed (it exists since 2.084.0 
according to [1]).


I am using ubuntu:focal. ubuntu:bionic has ldc 1.8 which is far 
too old. Focal has ldc 1.20.


I think the dub version is 1.19.

I am having to manually symbolically link /usr/bin/gcc and 
/usr/bin/cc so I suspect the installation of focal is not going 
quite right. Especially as I have to manually set a TZ variable 
to avoid a lock up.


In my .gitalab-ci.yml I use 'dlang2/ldc-ubuntu' [2] or 
'dlang2/dmd-ubuntu' [3] which give always recent versions of D.


[1] https://dlang.org/changelog/2.084.0.html
[2] https://hub.docker.com/r/dlang2/ldc-ubuntu
[3] https://hub.docker.com/r/dlang2/dmd-ubuntu


I shall have to investigate these docker images in favour of 
working with a bare Ubuntu.


Yes because that works reasonably well on gitlab.
The only problem is that you might have to setup other things as 
their ubuntu image is very light. Software like zip or even git 
are not there by default.


A simple example of `.gitlab-ci.yml` file to support D is

---
job:
  image: dlang2/dmd-ubuntu
  before_script:
  # tools that are not in their base ubuntu image
  - apt-get update -y
  - apt-get install -y supplemental_package_x
  - apt-get install -y supplemental_package_y
  # similarly to what's done on most of the other CI services
  script:
  - bash some_script.sh
  - dub build
  - dub test
  # - etc.
---


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Andre Pany via Digitalmars-d-learn

On Sunday, 7 June 2020 at 10:06:14 UTC, Russel Winder wrote:

On Sun, 2020-06-07 at 10:24 +0100, 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?


I am assuming that the error comes from the line:

preBuildCommands "$DUB run --compiler=$$DC unit-threaded -c 
gen_ut_main -- -f generated/ut_dub_main.d -d $DUB"


in the unittest configuration as suggested for using 
unit-threaded. The question is why does the symbol DUB not need 
to be defined locally or on Travis-CI, but only on GitLab?


|> printenv | grep -i dub
|>

On Travis-CI and locally Dub find where it is, why does it not 
do this on GitLab? It is at /usr/bin/dub in all cases.


$DUB is a variable but not an environment variable.
This is also the background why the environment variable $DC 
needs to be escaped here.


Kind regards
Andre



Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Andre Pany via Digitalmars-d-learn

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


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Russel Winder via Digitalmars-d-learn
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 Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



signature.asc
Description: This is a digitally signed message part


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2020-06-07 at 10:30 +, Basile B. via Digitalmars-d-learn wrote:
[…]
> What is the docker image that you use ?  If it is an older 
> version maybe that the $DUB env variable is not yet supported by 
> the dub version that's installed (it exists since 2.084.0 
> according to [1]).

I am using ubuntu:focal. ubuntu:bionic has ldc 1.8 which is far too old. Focal
has ldc 1.20.

I think the dub version is 1.19.

I am having to manually symbolically link /usr/bin/gcc and /usr/bin/cc so I
suspect the installation of focal is not going quite right. Especially as I
have to manually set a TZ variable to avoid a lock up.

> In my .gitalab-ci.yml I use 'dlang2/ldc-ubuntu' [2] or 
> 'dlang2/dmd-ubuntu' [3] which give always recent versions of D.
> 
> [1] https://dlang.org/changelog/2.084.0.html
> [2] https://hub.docker.com/r/dlang2/ldc-ubuntu
> [3] https://hub.docker.com/r/dlang2/dmd-ubuntu

I shall have to investigate these docker images in favour of working with a
bare Ubuntu.

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



signature.asc
Description: This is a digitally signed message part


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Jacob Carlborg via Digitalmars-d-learn

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


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Basile B. via Digitalmars-d-learn

On Sunday, 7 June 2020 at 10:06:14 UTC, Russel Winder wrote:

On Sun, 2020-06-07 at 10:24 +0100, 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?


I am assuming that the error comes from the line:

preBuildCommands "$DUB run --compiler=$$DC unit-threaded -c 
gen_ut_main -- -f generated/ut_dub_main.d -d $DUB"


in the unittest configuration as suggested for using 
unit-threaded. The question is why does the symbol DUB not need 
to be defined locally or on Travis-CI, but only on GitLab?


|> printenv | grep -i dub
|>

On Travis-CI and locally Dub find where it is, why does it not 
do this on GitLab? It is at /usr/bin/dub in all cases.


What is the docker image that you use ?  If it is an older 
version maybe that the $DUB env variable is not yet supported by 
the dub version that's installed (it exists since 2.084.0 
according to [1]).


In my .gitalab-ci.yml I use 'dlang2/ldc-ubuntu' [2] or 
'dlang2/dmd-ubuntu' [3] which give always recent versions of D.


[1] https://dlang.org/changelog/2.084.0.html
[2] https://hub.docker.com/r/dlang2/ldc-ubuntu
[3] https://hub.docker.com/r/dlang2/dmd-ubuntu


Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2020-06-07 at 10:24 +0100, 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?

I am assuming that the error comes from the line:

preBuildCommands "$DUB run --compiler=$$DC unit-threaded -c gen_ut_main -- -f 
generated/ut_dub_main.d -d $DUB"

in the unittest configuration as suggested for using unit-threaded. The
question is why does the symbol DUB not need to be defined locally or on
Travis-CI, but only on GitLab?

|> printenv | grep -i dub
|> 

On Travis-CI and locally Dub find where it is, why does it not do this on
GitLab? It is at /usr/bin/dub in all cases.

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



signature.asc
Description: This is a digitally signed message part


Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Russel Winder via Digitalmars-d-learn
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 Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



signature.asc
Description: This is a digitally signed message part