Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow installing dub in standalone #301

Merged
merged 1 commit into from
May 10, 2019
Merged

Allow installing dub in standalone #301

merged 1 commit into from
May 10, 2019

Conversation

wilzbach
Copy link
Member

This allows using the installer script to install an individual version of DUB.

The main motivation for this are the failing DUB + Vibe.d Travis builds which still test very old DMD versions which don't come with the latest DUB binaries.

In the future we might support something like dmd-2.072.0+dub (latest dub) or dmd-2.072.2+dub.1.7.2, but for now this allows @s-ludwig to do add this extra line to update to the latest dub:

. $(~/dlang/install.sh dub -a)

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@wilzbach wilzbach force-pushed the dub branch 2 times, most recently from c2fe280 to 707db0d Compare February 21, 2018 01:26
else
log "Using dub shipped with $2"
DUB_BIN_PATH="${ROOT}/dub"
install_dub
fi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deliberately avoided updating the default dub symlink (which happens in install_dub), though there are pros and cons for this.

DUB_VERSION="$(fetch "${mirrors[@]}")"
local DUB="dub-${DUB_VERSION}"
if [ -z "$1" ] ; then
COMPILER="$DUB"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure on the best way to deal with this.
The problem is that I wanted to reuse the logic here in install_dub, but in install dmd path, we can't set COMPILER, but for install dub we should.

The missing coverage is because currently we only use specific versions on for the CI.

script/install.sh Outdated Show resolved Hide resolved
@@ -580,6 +616,8 @@ download_and_unpack() {
download "$tmp/$name" "$do_verify" "${urls[@]}"
if [[ $name =~ \.tar\.xz$ ]]; then
tar --strip-components=1 -C "$tmp" -Jxf "$tmp/$name"
elif [[ $name =~ \.tar\.gz$ ]]; then
tar -C "$tmp" -xf "$tmp/$name"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dub binary is in the root-level.

esac

logV "Writing environment variables to $ROOT/$1/activate"
cat > "$ROOT/$1/activate" <<EOF
deactivate() {
export PATH="\$_OLD_D_PATH"
EOF
if [ -n "$libpath" ] ; then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following code writes thin activate scripts that only set the variables that are actually set.
In other words things like LIBRARY_PATH aren't written for dub

test/all.sh Outdated
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $DIR/common.sh

for file in $(find "$DIR" -name "*.sh") ; do
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motivation: it's a lot more convenient to have small files as they can be run individually.
I have already run into this before, e.g. #297 (contains the same idea with test/all.sh)

@wilzbach
Copy link
Member Author

wilzbach commented May 2, 2018

FYI this has now been used by Vibe.d (vibe-d/vibe.d#2140) and Dub (vibe-d/vibe.d#2140) for about a month with the builds being a lot more greenish...

@wilzbach
Copy link
Member Author

At DConf Martin was a bit sceptical about using + as it's a valid SemVer character.
How about using @, | or : instead?

@PetarKirov
Copy link
Member

How about simply dmd-2.072.2,dub.1.7.2?

script/install.sh Outdated Show resolved Hide resolved
script/install.sh Show resolved Hide resolved
script/install.sh Outdated Show resolved Hide resolved
test/all.sh Outdated Show resolved Hide resolved
@wilzbach wilzbach force-pushed the dub branch 10 times, most recently from c9b4641 to 4b2741e Compare March 20, 2019 10:38
@wilzbach
Copy link
Member Author

How about simply dmd-2.072.2,dub.1.7.2?

Ok. Went with this ;-)

@wilzbach
Copy link
Member Author

24 days ago

Any objections?

CC @ZombineDev @thewilsonator

@thewilsonator
Copy link
Collaborator

Not really, but I don't understand the code very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants