This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 937
test-in-docker: fix with newer ZSH versions #884
Closed
docwhat
wants to merge
11
commits into
Powerlevel9k:next
from
docwhat:pr/fix-test-in-docker-on-newer-zsh
Closed
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
69fe19c
test-in-docker: fix in zsh > 5.3
docwhat 645034f
test-in-docker: add additional warnings
docwhat 8986320
test-in-docker: make vars sorted and readonly
docwhat 83abdf7
test-in-docker: add dry-run mode
docwhat 3c27414
test-in-docker: lint from @dritter
docwhat a94df3d
test-in-docker: resolve version and framework late
docwhat 20fdf05
Add Dockerfiles for ZSH 5.3.1, 5.4.2, 5.5.1
dritter 74051e5
Force creation of symlink in prezto
dritter b9e6e6f
Fixate ZSH versions in docker
dritter 0b92e91
Use ubuntu 17.10, as the sources for 17.04 seem to be down
dritter 4178240
Add Dockerfile for zshing framework
dritter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -15,13 +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) ) | ||
frameworks=${(@)frameworks:#base-*} | ||
for i in {$#frameworks..1}; do | ||
# Remove all base entries | ||
[[ "${frameworks[$i]}" = base-* ]] && frameworks[$i]=() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a stylistic note: I would go here with double equals. That is more readable IMHO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 3c27414 |
||
done | ||
typeset -r frameworks | ||
|
||
# Known Issues | ||
typeset -A known_issues | ||
|
@@ -30,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() | ||
{ | ||
|
@@ -65,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" | ||
|
@@ -75,22 +90,22 @@ 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}" \ | ||
--file "docker/${framework}/Dockerfile" \ | ||
. | ||
|
||
print -P "%F{green}Starting ${name} container...%f" | ||
exec docker run \ | ||
cmd docker run \ | ||
--rm \ | ||
--interactive \ | ||
--tty \ | ||
|
@@ -105,9 +120,10 @@ show_help() { | |
echo | ||
echo "Loads up a docker image with powershell9k configured in <framework>" | ||
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:" | ||
|
@@ -130,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 ) | ||
|
@@ -149,6 +166,7 @@ while (( $# > 0 )); do | |
err "No such ZSH version '${1}'" | ||
fi | ||
;; | ||
-n | --dry-run ) dry_run=1 ;; | ||
-h | --help ) | ||
show_help | ||
exit | ||
|
@@ -174,6 +192,8 @@ while (( $# > 0 )); do | |
shift | ||
done | ||
|
||
typeset -r use_version use_framework dry_run | ||
|
||
build_and_run "$use_version" "$use_framework" | ||
|
||
# EOF |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should set the minimum version to something like 5.3 in regard of #877
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started to do that in a94df3d but then remembered why I have it the way I do.
The default should be the oldest version of zsh we support, not newest.
Either way, it is easier to change now and it has the same lookup properties the command line does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well. The oldest supported version of ZSH is 5.3 in
next
(at least in the battery segment). Otherwise it is 5.1.