Skip to content

Commit 80d6e68

Browse files
committed
Merge remote-tracking branch 'origin/rc/v1.5.0' into rc/v1.5.0
2 parents d6a74bc + d2e6893 commit 80d6e68

File tree

6 files changed

+58
-54
lines changed

6 files changed

+58
-54
lines changed

doc/install_and_upgrade.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,18 @@ For more information and other shells, see [the shell auto-completion page](shel
295295

296296
## Upgrade
297297

298-
There are essentially three different approaches to upgrade:
298+
There are essentially four different approaches to upgrade:
299299

300-
* The `stack` tool itself ships with an `upgrade` command, which will build `stack` from source and install it to the default install path (see the previous section). You can use `stack upgrade` to get the latest official release, and `stack upgrade --git` to install from Git and live on the bleeding edge. If you follow this, make sure that this directory is on your `PATH` and takes precedence over the system installed `stack`. For more information, see [this discussion](https://github.com/commercialhaskell/stack/issues/237#issuecomment-126793301).
300+
* The `stack` tool itself ships with an `upgrade` command, which download a `stack` binary or build it from source and install it to the default install path (e.g. `~/.local/bin` or `%APPDATA%\local\bin`; see the [Path](#Path) section above). You can use `stack upgrade` to get the latest official release, and `stack upgrade --git` to install from Git and live on the bleeding edge. Make sure the default install directory is on your `PATH` and takes precedence over the system installed `stack`, or copy `stack` from that directory to the system location afterward. For more information, see [this discussion](https://github.com/commercialhaskell/stack/issues/237#issuecomment-126793301).
301301

302-
* If you're using a package manager (e.g., the Ubuntu debs listed above) and are happy with sticking with the officially released binaries, simply follow your normal package manager strategies for upgrading (e.g. `apt-get update && apt-get upgrade`).
302+
* If you're using a package manager and are happy with sticking with the officially released binaries from the distribution (which may the lag behind latest version of Stack significantly), simply follow your normal package manager strategies for upgrading (e.g. `apt-get update && apt-get upgrade`).
303303

304-
* If you're not using a package manager but want to stick with the official binaries (such as on Windows or Mac), you'll need to manually follow the steps above to download the newest binaries from the release page and replace the old binary.
304+
* The get.haskellstack.org script supports the `-f` argument to over-write the current stack executable. For example:
305+
306+
curl -sSL https://get.haskellstack.org/ | sh -s - -f
307+
308+
or:
309+
310+
wget -qO- https://get.haskellstack.org/ | sh -s - -f
311+
312+
* Manually follow the steps above to download the newest binaries from the release page and replace the old binary.

etc/scripts/get-stack.sh

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@
77
# or:
88
# 'wget -qO- https://get.haskellstack.org/ | sh'
99
#
10+
# By default, this installs 'stack' to '/usr/local/bin'.
11+
#
12+
# Arguments (use `... | sh -s - ARGUMENTS`)
13+
#
14+
# -q: reduce script's output
15+
# -f: force over-write even if 'stack' already installed
16+
# -d DESTDIR: change destination directory
17+
#
1018
# Make pull requests at:
1119
# https://github.com/commercialhaskell/stack/blob/master/etc/scripts/get-stack.sh
1220
#
1321

1422
HOME_LOCAL_BIN="$HOME/.local/bin"
15-
USR_LOCAL_BIN="/usr/local/bin"
23+
DEFAULT_DEST="/usr/local/bin/stack"
24+
DEST=""
1625
QUIET=""
1726
FORCE=""
1827
STACK_TEMP_DIR=
@@ -108,7 +117,7 @@ print_bindist_notice() {
108117
fi
109118
}
110119

111-
# Adds a `sudo` prefix if sudo is available to execute the given command
120+
# Adds a 'sudo' prefix if sudo is available to execute the given command
112121
# If not, the given command is run as is
113122
sudocmd() {
114123
$(command -v sudo) "$@"
@@ -454,15 +463,20 @@ install_from_bindist() {
454463
if ! tar xzf "$STACK_TEMP_DIR/$1.bindist" -C "$STACK_TEMP_DIR/$1"; then
455464
die "Extract bindist failed"
456465
fi
457-
if ! sudocmd install -c -o 0 -g 0 -m 0755 "$STACK_TEMP_DIR/$1"/*/stack "$USR_LOCAL_BIN/stack"; then
458-
die "Install to $USR_LOCAL_BIN/stack failed"
466+
STACK_TEMP_EXE="$STACK_TEMP_DIR/$(basename "$DEST")"
467+
mv "$STACK_TEMP_DIR/$1"/*/stack "$STACK_TEMP_EXE"
468+
# First attempt to install 'stack' as current user, then try with sudo if it fails
469+
if ! install -c -m 0755 "$STACK_TEMP_EXE" "$(dirname "$DEST")" 2>/dev/null; then
470+
if ! sudocmd install -c -o 0 -g 0 -m 0755 "$STACK_TEMP_EXE" "$(dirname "$DEST")"; then
471+
die "Install to $DEST failed"
472+
fi
459473
fi
460474

461475
post_install_separator
462-
info "Stack has been installed to: $USR_LOCAL_BIN/stack"
476+
info "Stack has been installed to: $DEST"
463477
info ""
464478

465-
check_usr_local_bin_on_path
479+
check_dest_on_path
466480
}
467481

468482
install_arm_binary() {
@@ -631,20 +645,26 @@ check_home_local_bin_on_path() {
631645
}
632646

633647
# Check whether /usr/local/bin is on the PATH, and print a warning if not.
634-
check_usr_local_bin_on_path() {
635-
if ! on_path "$USR_LOCAL_BIN" ; then
636-
info "WARNING: '$USR_LOCAL_BIN' is not on your PATH."
648+
check_dest_on_path() {
649+
if ! on_path "$(dirname $DEST)" ; then
650+
info "WARNING: '$(dirname $DEST)' is not on your PATH."
637651
info ""
638652
fi
639653
}
640654

641655
# Check whether Stack is already installed, and print an error if it is.
642656
check_stack_installed() {
643-
if [ "$FORCE" != "true" ] && has_stack ; then
644-
die "Stack $(stack_version) already appears to be installed at:
657+
if has_stack ; then
658+
if [ "$FORCE" = "true" ] ; then
659+
[ "$DEST" != "" ] || DEST="$(stack_location)"
660+
else
661+
die "Stack $(stack_version) already appears to be installed at:
645662
$(stack_location)
646663
Use 'stack upgrade' or your OS's package manager to upgrade,
647-
or pass --force to this script to install anyway."
664+
or pass '-f' to this script to over-write the existing binary."
665+
fi
666+
else
667+
[ "$DEST" != "" ] || DEST="$DEFAULT_DEST"
648668
fi
649669
}
650670

@@ -662,6 +682,10 @@ while [ $# -gt 0 ]; do
662682
FORCE="true"
663683
shift
664684
;;
685+
-d|--dest)
686+
DEST="$2/stack"
687+
shift 2
688+
;;
665689
*)
666690
echo "Invalid argument: $1" >&2
667691
exit 1

etc/scripts/release.hs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ options =
103103
"Label to give the uploaded release asset"
104104
, Option "" [noTestHaddocksOptName] (NoArg $ Right $ \g -> g{gTestHaddocks = False})
105105
"Disable testing building haddocks."
106-
-- FIXME: Use 'static' flag in stack.cabal instead. See https://github.com/commercialhaskell/stack/issues/3045.
107-
, Option "" [staticOptName] (NoArg $ Right $ \g -> g{gBuildArgs = gBuildArgs g ++ ["--split-objs", "--ghc-options=-optc-Os -optl-static -fPIC"]})
106+
, Option "" [staticOptName] (NoArg $ Right $ \g -> g{gBuildArgs = gBuildArgs g ++ ["--flag=stack:static"]})
108107
"Build a static binary."
109108
, Option "" [buildArgsOptName]
110109
(ReqArg
@@ -137,9 +136,7 @@ rules global@Global{..} args = do
137136
mapM_ (\f -> need [releaseDir </> f]) binaryPkgFileNames
138137

139138
distroPhonies ubuntuDistro ubuntuVersions debPackageFileName
140-
distroPhonies debianDistro debianVersions debPackageFileName
141139
distroPhonies centosDistro centosVersions rpmPackageFileName
142-
distroPhonies fedoraDistro fedoraVersions rpmPackageFileName
143140

144141
releaseDir </> "*" <.> uploadExt %> \out -> do
145142
let srcFile = dropExtension out
@@ -162,7 +159,7 @@ rules global@Global{..} args = do
162159
c
163160
() <- cmd0 "install" gBuildArgs $ concat $ concat
164161
[["--pedantic --no-haddock-deps"], [" --haddock" | gTestHaddocks]]
165-
() <- cmd0 (Cwd "etc/scripts") "install" gBuildArgs "cabal-install"
162+
() <- cmd0 (Cwd "etc/scripts") "install" "cabal-install"
166163
let cmd' c = cmd (AddPath [tmpDir] []) stackProgName (stackArgs global) c
167164
() <- cmd' "test" gBuildArgs "--pedantic --flag stack:integration-tests"
168165
return ()
@@ -240,9 +237,7 @@ rules global@Global{..} args = do
240237
(removeFile out)
241238

242239
debDistroRules ubuntuDistro ubuntuVersions
243-
debDistroRules debianDistro debianVersions
244240
rpmDistroRules centosDistro centosVersions
245-
rpmDistroRules fedoraDistro fedoraVersions
246241

247242
where
248243

@@ -429,28 +424,14 @@ rules global@Global{..} args = do
429424
rpmPackageVersionStr _ = stackVersionStr global
430425

431426
ubuntuVersions =
432-
[ ("12.04", "precise")
433-
, ("14.04", "trusty")
434-
, ("14.10", "utopic")
435-
, ("15.04", "vivid")
436-
, ("15.10", "wily")
437-
, ("16.04", "xenial")
438-
, ("16.10", "yakkety") ]
439-
debianVersions =
440-
[ ("7", "wheezy")
441-
, ("8", "jessie") ]
427+
[ ("14.04", "trusty")
428+
, ("16.04", "xenial") ]
442429
centosVersions =
443430
[ ("7", "el7")
444431
, ("6", "el6") ]
445-
fedoraVersions =
446-
[ ("22", "fc22")
447-
, ("23", "fc23")
448-
, ("24", "fc24") ]
449432

450433
ubuntuDistro = "ubuntu"
451-
debianDistro = "debian"
452434
centosDistro = "centos"
453-
fedoraDistro = "fedora"
454435

455436
anyDistroVersion distro = DistroVersion distro "*" "*"
456437

etc/scripts/vagrant-distros.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22
set -xe
3-
"$(dirname "$0")/with-vagrant.sh" debian-7-amd64 "$* upload-ubuntu-12.04 upload-ubuntu-14.04 upload-ubuntu-16.04 upload-ubuntu-16.10 upload-debian-8"
3+
"$(dirname "$0")/with-vagrant.sh" debian-7-amd64 "$* upload-ubuntu-14.04 upload-ubuntu-16.04"
44
"$(dirname "$0")/with-vagrant.sh" centos-7-x86_64 "$* upload-centos-7"
55
"$(dirname "$0")/with-vagrant.sh" centos-6-x86_64 "$* --binary-variant=gmp4 upload-centos-6"

etc/scripts/vagrant-releases.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
set -xe
3-
"$(dirname "$0")/with-vagrant.sh" alpine-3.4-x86_64 "--binary-variant=static --static $* release"
3+
"$(dirname "$0")/with-vagrant.sh" alpine-3.6-x86_64 "--binary-variant=static --static $* release"
44
"$(dirname "$0")/with-vagrant.sh" freebsd-11.0-amd64 "$* release" "export LANG=en_US.UTF-8;"
55
"$(dirname "$0")/with-vagrant.sh" debian-7-amd64 "$* release"
66
"$(dirname "$0")/with-vagrant.sh" debian-7-i386 "$* release"

etc/vagrant/alpine-3.4-x86_64/Vagrantfile renamed to etc/vagrant/alpine-3.6-x86_64/Vagrantfile

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Vagrant.configure(2) do |config|
2-
config.vm.box = "maier/alpine-3.4-x86_64"
2+
config.vm.box = "maier/alpine-3.6-x86_64"
33
config.vm.synced_folder ENV['STACK_BUILD_DIR'], "/vagrant-build", type: "rsync", rsync__verbose: true, rsync__exclude: [".stack-work/", "_release/", ".cabal-sandbox/", "cabal.sandbox.config", "dist/", ".#*#", "*.vdi", "*.vmdk"], rsync__args: ["--verbose", "--archive", "--delete", "-z", "--copy-links"], rsync__rsync_path: "/usr/bin/rsync", rsync__chown: false
44
config.vm.synced_folder "../../..", "/vagrant", type: "rsync", rsync__verbose: true, rsync__exclude: [".stack-work/", "_release/", ".cabal-sandbox/", "cabal.sandbox.config", "dist/", ".#*#", "*.vdi", "*.vmdk"], rsync__args: ["--verbose", "--archive", "--delete", "-z", "--copy-links"], rsync__rsync_path: "/usr/bin/rsync", rsync__chown: false
55
config.vm.provider "virtualbox" do |vb|
@@ -8,18 +8,9 @@ Vagrant.configure(2) do |config|
88
config.ssh.forward_agent = true
99
config.vm.provision "shell", inline: <<-SHELL
1010
set -xe
11-
#FIXME: See https://github.com/commercialhaskell/stack/issues/3045, probably use:
12-
#FIXME: apk --no-cache add --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing ghc ghc-dev cabal
13-
if ! grep 's3-us-west-2\.amazonaws\.com/alpine-ghc/7\.10' /etc/apk/repositories; then
14-
echo "https://s3-us-west-2.amazonaws.com/alpine-ghc/7.10" |sudo tee -a /etc/apk/repositories
15-
fi
16-
if ! test -s /etc/apk/keys/[email protected]; then
17-
curl -o /etc/apk/keys/[email protected] https://raw.githubusercontent.com/mitchty/alpine-ghc/master/mitch.tishmack%40gmail.com-55881c97.rsa.pub
18-
fi
19-
apk -q update
20-
apk add alpine-sdk linux-headers musl-dev gmp-dev zlib-dev ghc git rsync gnupg xz
21-
cp /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/crtbeginT.o /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/crtbeginT.o.orig
22-
cp /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/crtbeginS.o /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/crtbeginT.o
11+
apk update
12+
apk add alpine-sdk linux-headers musl-dev gmp-dev zlib-dev git rsync gnupg xz
13+
apk --no-cache add --repository http://dl-cdn.alpinelinux.org/alpine/edge/community ghc ghc-dev cabal
2314
if ! which stack; then
2415
curl -sSL https://www.stackage.org/stack/linux-x86_64-static \
2516
| tar xzvf - --wildcards --strip-components=1 -C /usr/local/bin '*/stack'

0 commit comments

Comments
 (0)