From 69fe19ca74ce5b00fa6d120ee6d20707443e5cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Wed, 27 Jun 2018 11:17:08 -0400 Subject: [PATCH 01/11] test-in-docker: fix in zsh > 5.3 The way I was filtering out entries in the frameworks array stopped working in newer versions of ZSH; it would convert the array into a string (you could see it with `typeset -p frameworks`) So I rewrote it. I don't see anything in the release notes for ZSH that would explain this and I didn't find any option that would restore this behavior. Related: #882 --- test-in-docker | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test-in-docker b/test-in-docker index 3c7255ec..d291402f 100755 --- a/test-in-docker +++ b/test-in-docker @@ -21,7 +21,10 @@ versions=( docker/base-*/Dockerfile(N.on:h:t:s/base-//) ) # List of frameworks typeset -a frameworks frameworks=( docker/*/Dockerfile(N.on:h:t) ) -frameworks=${(@)frameworks:#base-*} +for i in {$#frameworks..1}; do + # Remove all base entries + [[ "${frameworks[$i]}" = base-* ]] && frameworks[$i]=() +done # Known Issues typeset -A known_issues From 645034f74c6daca97c06f3dc99ae00e98522af49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Wed, 27 Jun 2018 11:21:01 -0400 Subject: [PATCH 02/11] test-in-docker: add additional warnings --- test-in-docker | 1 + 1 file changed, 1 insertion(+) diff --git a/test-in-docker b/test-in-docker index d291402f..89a223f1 100755 --- a/test-in-docker +++ b/test-in-docker @@ -6,6 +6,7 @@ set -eu default_version='4.3.11' setopt extended_glob glob_subst numeric_glob_sort +setopt warn_create_global warn_nested_var 2> /dev/null cd "${${(%):-%x}:A:h}" # TODO: Crazy Logic to munge TERM to something supported in Ubuntu 14.04 From 89863209fc81a70f6affa96ebd7df950cc3f8575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Wed, 27 Jun 2018 11:21:23 -0400 Subject: [PATCH 03/11] test-in-docker: make vars sorted and readonly Marking variables as readonly is helpful for debugging and preventing problems. --- test-in-docker | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test-in-docker b/test-in-docker index 89a223f1..f4e8e1c8 100755 --- a/test-in-docker +++ b/test-in-docker @@ -16,16 +16,18 @@ term=screen-256color # ...see Modifiers in zshexpn(1) for details. # List of ZSH versions -typeset -a versions +typeset -aU versions versions=( docker/base-*/Dockerfile(N.on:h:t:s/base-//) ) +typeset -r versions # List of frameworks -typeset -a frameworks +typeset -aU frameworks frameworks=( docker/*/Dockerfile(N.on:h:t) ) for i in {$#frameworks..1}; do # Remove all base entries [[ "${frameworks[$i]}" = base-* ]] && frameworks[$i]=() done +typeset -r frameworks # Known Issues typeset -A known_issues @@ -34,6 +36,7 @@ known_issues["4.3.11-zim"]="BROKEN: Zim wants ZSH 5.2 or newer." known_issues["5.0.3-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer." known_issues["5.1.1-zim"]="DEPRECATED: Zim wants ZSH 5.2 or newer." known_issues["4.3.11-zulu"]="Zulu doesn't work; it needs a newer version of git." +typeset -r known_issues err() { @@ -178,6 +181,8 @@ while (( $# > 0 )); do shift done +typeset -r use_version use_framework + build_and_run "$use_version" "$use_framework" # EOF From 83abdf742c04eae76b64a6fd22540373bd12f456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Wed, 27 Jun 2018 11:25:12 -0400 Subject: [PATCH 04/11] test-in-docker: add dry-run mode --- test-in-docker | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/test-in-docker b/test-in-docker index f4e8e1c8..98257fc3 100755 --- a/test-in-docker +++ b/test-in-docker @@ -72,6 +72,14 @@ check_for_known_issues() { fi } +cmd() { + if (( dry_run )); then + echo "${(@q)*}" 1>&2 + else + "${(@)*}" + fi +} + build_and_run() { local version="$1" local framework="$2" @@ -82,14 +90,14 @@ build_and_run() { print -P "%F{green}Preparing containers...%f" echo -n "p9k:base-${version}: " - docker build \ + cmd docker build \ --quiet \ --tag "p9k:base-${version}" \ --file "docker/base-${version}/Dockerfile" \ . echo -n "p9k:${version}-${framework}: " - docker build \ + cmd docker build \ --quiet \ --build-arg="base=base-${version}" \ --tag "p9k:${version}-${framework}" \ @@ -97,7 +105,7 @@ build_and_run() { . print -P "%F{green}Starting ${name} container...%f" - exec docker run \ + cmd docker run \ --rm \ --interactive \ --tty \ @@ -112,9 +120,10 @@ show_help() { echo echo "Loads up a docker image with powershell9k configured in " echo - echo " --frameworks Lists all available frameworks, newline separated." - echo " --versions Lists all available ZSH versions, newline separated." - echo " --zsh VER Uses ZSH with version VER." + echo " -f --frameworks Lists all available frameworks, newline separated." + echo " -v --versions Lists all available ZSH versions, newline separated." + echo " -z --zsh VER Uses ZSH with version VER." + echo " -n --dry-run Just prints the docker commands that would be run." echo " --help You're soaking in it." echo echo "ZSH versions:" @@ -137,6 +146,7 @@ fi # Parse flags and such. use_version=$default_version use_framework= +dry_run=0 while (( $# > 0 )); do case "$1" in -f | --frameworks ) @@ -156,6 +166,7 @@ while (( $# > 0 )); do err "No such ZSH version '${1}'" fi ;; + -n | --dry-run ) dry_run=1 ;; -h | --help ) show_help exit @@ -181,7 +192,7 @@ while (( $# > 0 )); do shift done -typeset -r use_version use_framework +typeset -r use_version use_framework dry_run build_and_run "$use_version" "$use_framework" From 3c27414e7e985536a8b286d09b2248e7dee8263e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Wed, 27 Jun 2018 16:52:16 -0400 Subject: [PATCH 05/11] test-in-docker: lint from @dritter --- test-in-docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-in-docker b/test-in-docker index 98257fc3..e55c9422 100755 --- a/test-in-docker +++ b/test-in-docker @@ -25,7 +25,7 @@ typeset -aU frameworks frameworks=( docker/*/Dockerfile(N.on:h:t) ) for i in {$#frameworks..1}; do # Remove all base entries - [[ "${frameworks[$i]}" = base-* ]] && frameworks[$i]=() + [[ "${frameworks[$i]}" == base-* ]] && frameworks[$i]=() done typeset -r frameworks From a94df3ddcb027d88717f854cd5f610a771c1c71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Wed, 27 Jun 2018 16:52:38 -0400 Subject: [PATCH 06/11] test-in-docker: resolve version and framework late --- test-in-docker | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test-in-docker b/test-in-docker index e55c9422..0ed1254f 100755 --- a/test-in-docker +++ b/test-in-docker @@ -2,8 +2,9 @@ set -eu -# The default ZSH to use. -default_version='4.3.11' +# The default ZSH to use; it can just be the first few characters. +# This should be the oldest version we support. +default_version='4.' setopt extended_glob glob_subst numeric_glob_sort setopt warn_create_global warn_nested_var 2> /dev/null @@ -144,8 +145,8 @@ if (( $# == 0 )); then fi # Parse flags and such. -use_version=$default_version -use_framework= +asked_for_version=$default_version +asked_for_framework= dry_run=0 while (( $# > 0 )); do case "$1" in @@ -159,12 +160,7 @@ while (( $# > 0 )); do ;; -z | --zsh ) shift - local v="$(resolve_version "$1")" - if [[ -n "$v" ]]; then - use_version=$v - else - err "No such ZSH version '${1}'" - fi + asked_for_version=$1 ;; -n | --dry-run ) dry_run=1 ;; -h | --help ) @@ -177,22 +173,27 @@ while (( $# > 0 )); do exit 1 ;; * ) - if [[ -z "$use_framework" ]]; then - local f="$(resolve_framework "$1")" - if [[ -n "$f" ]]; then - use_framework=$f - else - err "No such framework '${1}'" - fi + if [[ -z "$asked_for_framework" ]]; then + asked_for_framework=$1 else - err "You can only specify one framework at a time; you already specified '${use_framework}'" + err "You can only specify one framework at a time; you already specified '${asked_for_framework}'" fi ;; esac shift done -typeset -r use_version use_framework dry_run +typeset -r asked_for_version asked_for_framework + +typeset -r use_version="$(resolve_version "${asked_for_version}")" +if [[ -z "$use_version" ]]; then + err "No such ZSH version '${asked_for_version}'" +fi + +typeset -r use_framework="$(resolve_framework "${asked_for_framework}")" +if [[ -z "$use_framework" ]]; then + err "No such framework '${asked_for_framework}'" +fi build_and_run "$use_version" "$use_framework" From 20fdf0517c2b626540eb6783d4aa99350efe3c7f Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 26 Jun 2018 23:06:05 +0200 Subject: [PATCH 07/11] Add Dockerfiles for ZSH 5.3.1, 5.4.2, 5.5.1 --- docker/base-5.3.1/Dockerfile | 40 ++++++++++++++++++++++++++++++++++++ docker/base-5.4.2/Dockerfile | 35 +++++++++++++++++++++++++++++++ docker/base-5.5.1/Dockerfile | 35 +++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 docker/base-5.3.1/Dockerfile create mode 100644 docker/base-5.4.2/Dockerfile create mode 100644 docker/base-5.5.1/Dockerfile diff --git a/docker/base-5.3.1/Dockerfile b/docker/base-5.3.1/Dockerfile new file mode 100644 index 00000000..0294cf25 --- /dev/null +++ b/docker/base-5.3.1/Dockerfile @@ -0,0 +1,40 @@ +FROM debian:stretch + +# We switched here to debian, as there seems no ZSH 5.3 in ubuntu. + +RUN \ + apt-get update && \ + echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + git \ + zsh=5.3.1-4+b2 \ + mercurial \ + subversion \ + golang \ + jq \ + nodejs \ + ruby \ + python \ + python-virtualenv \ + sudo \ + locales + +RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred +# Locale generation is different in debian. We need to enable en_US +# locale and then regenerate locales. +RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen +RUN locale-gen "en_US.UTF-8" + +COPY docker/fred-sudoers /etc/sudoers.d/fred + +USER fred +WORKDIR /home/fred +ENV LANG=en_US.UTF-8 +ENV TERM=xterm-256color +ENV DEFAULT_USER=fred +ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + +RUN touch .zshrc + +CMD ["/bin/zsh", "-l"] diff --git a/docker/base-5.4.2/Dockerfile b/docker/base-5.4.2/Dockerfile new file mode 100644 index 00000000..8984c105 --- /dev/null +++ b/docker/base-5.4.2/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:18.04 + +RUN \ + apt-get update && \ + echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + git \ + zsh=5.4.2-3ubuntu3 \ + mercurial \ + subversion \ + golang \ + jq \ + nodejs \ + ruby \ + python \ + python-virtualenv \ + sudo \ + locales + +RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred +RUN locale-gen "en_US.UTF-8" + +COPY docker/fred-sudoers /etc/sudoers.d/fred + +USER fred +WORKDIR /home/fred +ENV LANG=en_US.UTF-8 +ENV TERM=xterm-256color +ENV DEFAULT_USER=fred +ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + +RUN touch .zshrc + +CMD ["/bin/zsh", "-l"] diff --git a/docker/base-5.5.1/Dockerfile b/docker/base-5.5.1/Dockerfile new file mode 100644 index 00000000..85fc570c --- /dev/null +++ b/docker/base-5.5.1/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:18.10 + +RUN \ + apt-get update && \ + echo 'golang-go golang-go/dashboard boolean false' | debconf-set-selections && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + git \ + zsh=5.5.1-1ubuntu1 \ + mercurial \ + subversion \ + golang \ + jq \ + nodejs \ + ruby \ + python \ + python-virtualenv \ + sudo \ + locales + +RUN adduser --shell /bin/zsh --gecos 'fred' --disabled-password fred +RUN locale-gen "en_US.UTF-8" + +COPY docker/fred-sudoers /etc/sudoers.d/fred + +USER fred +WORKDIR /home/fred +ENV LANG=en_US.UTF-8 +ENV TERM=xterm-256color +ENV DEFAULT_USER=fred +ENV POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=true + +RUN touch .zshrc + +CMD ["/bin/zsh", "-l"] From 74051e59fd8cb85b77136981a5dbbaa5e1c7530e Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 26 Jun 2018 23:04:46 +0200 Subject: [PATCH 08/11] Force creation of symlink in prezto --- docker/prezto/install.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/prezto/install.zsh b/docker/prezto/install.zsh index 9cca57ed..2b2e878c 100644 --- a/docker/prezto/install.zsh +++ b/docker/prezto/install.zsh @@ -9,7 +9,7 @@ for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do ln -nsf "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}" done -ln -s "${HOME}/p9k/powerlevel9k.zsh-theme" \ +ln -snf "${HOME}/p9k/powerlevel9k.zsh-theme" \ "${HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup" echo "zstyle ':prezto:module:prompt' theme 'powerlevel9k'" \ From b9e6e6f32a74f6a177c1367a262411afaf893a20 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 27 Jun 2018 23:26:50 +0200 Subject: [PATCH 09/11] Fixate ZSH versions in docker --- docker/base-5.0.3/Dockerfile | 2 +- docker/base-5.1.1/Dockerfile | 2 +- docker/base-5.2/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/base-5.0.3/Dockerfile b/docker/base-5.0.3/Dockerfile index e0b6c6c3..b1b85fcb 100644 --- a/docker/base-5.0.3/Dockerfile +++ b/docker/base-5.0.3/Dockerfile @@ -6,7 +6,7 @@ RUN \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ curl \ git \ - zsh \ + zsh=5.0.2-3ubuntu6.2 \ mercurial \ subversion \ golang \ diff --git a/docker/base-5.1.1/Dockerfile b/docker/base-5.1.1/Dockerfile index a7f644bf..c4fb6424 100644 --- a/docker/base-5.1.1/Dockerfile +++ b/docker/base-5.1.1/Dockerfile @@ -6,7 +6,7 @@ RUN \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ curl \ git \ - zsh \ + zsh=5.1.1-1ubuntu2.2 \ mercurial \ subversion \ golang \ diff --git a/docker/base-5.2/Dockerfile b/docker/base-5.2/Dockerfile index 62a10074..1898592c 100644 --- a/docker/base-5.2/Dockerfile +++ b/docker/base-5.2/Dockerfile @@ -6,7 +6,7 @@ RUN \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ curl \ git \ - zsh \ + zsh=5.2-5ubuntu1.2 \ mercurial \ subversion \ golang \ From 0b92e915c49a80a670307e84a828c5b89885928d Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 27 Jun 2018 23:27:17 +0200 Subject: [PATCH 10/11] Use ubuntu 17.10, as the sources for 17.04 seem to be down --- docker/base-5.2/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/base-5.2/Dockerfile b/docker/base-5.2/Dockerfile index 1898592c..2ec096fc 100644 --- a/docker/base-5.2/Dockerfile +++ b/docker/base-5.2/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.04 +FROM ubuntu:17.10 RUN \ apt-get update && \ From 4178240b2493115641c8cd204266e6d3d593af6b Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Thu, 12 Jul 2018 00:16:10 +0200 Subject: [PATCH 11/11] Add Dockerfile for zshing framework --- docker/zshing/Dockerfile | 7 +++++++ docker/zshing/install.zsh | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 docker/zshing/Dockerfile create mode 100644 docker/zshing/install.zsh diff --git a/docker/zshing/Dockerfile b/docker/zshing/Dockerfile new file mode 100644 index 00000000..a51a3067 --- /dev/null +++ b/docker/zshing/Dockerfile @@ -0,0 +1,7 @@ +ARG base +FROM p9k:${base} + +COPY docker/zshing/install.zsh /tmp/ +RUN zsh /tmp/install.zsh + +COPY ./ p9k/ diff --git a/docker/zshing/install.zsh b/docker/zshing/install.zsh new file mode 100644 index 00000000..8f926992 --- /dev/null +++ b/docker/zshing/install.zsh @@ -0,0 +1,16 @@ +#!zsh + +# install zshing https://github.com/zakariaGatter/zshing +git clone https://github.com/zakariaGatter/zshing.git ~/.zshing/zshing + +# Link P9K in zshing directory +ln -nsf ~/p9k ~/.zshing/powerlevel9k + +{ + echo + echo 'ZSHING_PLUGINS=( + "bhilburn/powerlevel9k" + )' + echo + echo "source ~/.zshing/zshing/zshing.zsh" +} >> ~/.zshrc