wilzbach/dlang-docker

Dub not added?

dedupely opened this issue · 9 comments

It would make testing a lot easier to dub part of this package.

I am not sure what you are referring to?
Dub should be installed on these images?

I think a lot of DMD users use Dub along side it (not to mention it's used by lots of packages including vibe.d). It seems to be included in repos along side DMD as well. Would be a huge benefit, since all my projects are dub packages and it's much easier to run dub test then a dmd command.

@dedupely Dub is already available in this docker image. It almost always comes with the D compiler.

Yes I am not sure how I can help here.

Thanks @aberba I probably just didn't know where to look. I'll hunt for it. Thanks!

Just using dub should work. If not feel free to reopen this issue with steps on how to reproduce.

Also note that this package is for testing/CI purposes only. For shipping production applications you don't need a D compiler nor dub. Simply use static linking and copy it over in another docker container (though this container might be convenient to use for building the application)

Guys sorry, I'm such a docker n00b I didn't know what I was doing. It's working after the fact. I'm using dub on docker in conjunction with circleci to run builds and tests.

Hi, I am using this image(dlang2/ldc-circleci) to test my simple project with CircleCI. However, the circleci reported that dub: Permission denied

#!/bin/bash -eo pipefail
make test
dub build -b unittest -c unittest -v --compiler=dmd
make: execvp: dub: Permission denied
Makefile:10: recipe for target 'testbin' failed
make: *** [testbin] Error 127
Exited with code 2

After ssh into the container I found that some directories cannot be accessed by circleci user:

circleci@8fda93793c7b:~$ echo $PATH
/dlang/ldc-1.10.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
circleci@8fda93793c7b:~$ ls /dlang/ldc-1.10.0/bin -al
ls: cannot access '/dlang/ldc-1.10.0/bin': Permission denied
circleci@8fda93793c7b:~$ ls /dlang/ldc-1.10.0 -al
ls: cannot access '/dlang/ldc-1.10.0/bin': Permission denied
ls: cannot access '/dlang/ldc-1.10.0/lib': Permission denied
ls: cannot access '/dlang/ldc-1.10.0/import': Permission denied
ls: cannot access '/dlang/ldc-1.10.0/lib32': Permission denied
ls: cannot access '/dlang/ldc-1.10.0/etc': Permission denied
total 48
dr-xr-xr-x 12 root root  4096 Jul 19 09:46 .
dr-xr-xr-x  4 root root  4096 Jul 19 09:46 ..
-r-xr-xr-x  1 root root 26369 Jun 19 18:58 LICENSE
-r-xr-xr-x  1 root root   468 Jun 19 18:58 README
-r-xr-xr-x  1 root root   757 Jul 19 09:46 activate
-r-xr-xr-x  1 root root   869 Jul 19 09:46 activate.fish
d?????????  ? ?    ?        ?            ? bin
d?????????  ? ?    ?        ?            ? etc
d?????????  ? ?    ?        ?            ? import
d?????????  ? ?    ?        ?            ? lib
d?????????  ? ?    ?        ?            ? lib32

However, after running sudo ls /dlang/ldc-1.10.0/bin -al, everything suddenly works smoothly:

circleci@8fda93793c7b:~$ sudo ls /dlang/ldc-1.10.0/bin -al
total 98956
dr-xr-xr-x  2 root root     4096 Jun 19 19:00 .
dr-xr-xr-x 12 root root     4096 Jul 19 09:46 ..
-r-xr-xr-x  1 root root  1354240 Jun 19 19:00 ddemangle
-r-xr-xr-x  1 root root 15809184 Jun 19 18:59 dub
-r-xr-xr-x  1 root root  2306080 Jun 19 19:00 dustmite
-r-xr-xr-x  1 root root  6200544 Jun 19 18:19 ldc-build-runtime
-r-xr-xr-x  1 root root  3547384 Jun 19 18:19 ldc-profdata
-r-xr-xr-x  1 root root  1018152 Jun 19 18:19 ldc-prune-cache
-r-xr-xr-x  1 root root 66494080 Jun 19 18:19 ldc2
-r-xr-xr-x  1 root root  2862512 Jun 19 18:18 ldmd2
-r-xr-xr-x  1 root root  1715000 Jun 19 19:00 rdmd
circleci@8fda93793c7b:~$ dub -v
Using dub registry url 'https://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at /var/lib/dub/packages/local-packages.json
Looking for local package map at /home/circleci/.dub/packages/local-packages.json
No package found in current working directory.

Neither a package description file, nor source/app.d was found in
/home/circleci
Please run DUB from the root directory of an existing package, or run
"dub init --help" to get information on creating a new package.

No valid root package found - aborting.

Hi I ran into that too (see e.g. dlang/dmd#7579), but I could never reproduce this locally.
However, I found a workaround:

sudo ls -l /dlang/dmd-2.078.0/linux && sudo ls -l /dlang/dmd-2.078.0/src

https://github.com/dlang/dmd/blob/master/.circleci/config.yml#L29

The idea of making the binary files owned by root was that you get a clear error when you try to modify them. Though I can try to chown it to circleci: #4