You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openserverless.apache.org by ms...@apache.org on 2024/08/05 10:46:48 UTC
(openserverless-cli) branch main updated (5a51687 -> 501db41)
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
from 5a51687 typo
new 3b190a8 0.1.0-2408041630.dev
new 3645976 0.1.0-2408041749.dev
new 0d14d6d patching sh for ops
new 2063e68 fix: subshell no more exiting when using utils and tools
new e55135a 0.1.0-2408051232.dev
new 501db41 fix prompt
The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.gitignore | 26 ++++++++++-----------
.gitmodules | 28 +++++++++++++++++++++++
.goreleaser.yaml | 3 +++
Taskfile.yml | 2 +-
_patches/README.md | 5 +++--
_patches/awk | 1 +
_patches/builtin_extra.go | 15 +++++++------
_patches/envsubst | 1 +
_patches/jq | 1 +
_patches/patch-sh.sh | 18 +++++++++++----
_patches/patch-task.sh | 9 +++++---
_patches/patch-wsk.sh | 4 +++-
_patches/patch-wskdeploy.sh | 4 +++-
_patches/sh | 1 +
_patches/task | 1 +
_patches/wsk | 1 +
_patches/wskdeploy | 1 +
go.mod | 4 ++--
go.sum | 8 +++----
preflight.go | 5 -----
prereq.go | 55 ++++++++++++++++++++++++++++-----------------
prereq_test.go | 2 ++
tools/sh.go | 2 +-
version.txt | 2 +-
24 files changed, 133 insertions(+), 66 deletions(-)
create mode 100644 .gitmodules
create mode 160000 _patches/awk
create mode 160000 _patches/envsubst
create mode 160000 _patches/jq
create mode 160000 _patches/sh
create mode 160000 _patches/task
create mode 160000 _patches/wsk
create mode 160000 _patches/wskdeploy
(openserverless-cli) 01/06: 0.1.0-2408041630.dev
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit 3b190a8a1277a76d18c2f244fab068ff9d3f07ee
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Sun Aug 4 16:30:53 2024 +0200
0.1.0-2408041630.dev
---
version.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/version.txt b/version.txt
index c9f5ddd..2f899b0 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.1.0-2408041450.dev
+0.1.0-2408041630.dev
(openserverless-cli) 02/06: 0.1.0-2408041749.dev
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit 3645976971dafdcdabb5690f1c49cd2b22445e4f
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Sun Aug 4 17:49:41 2024 +0200
0.1.0-2408041749.dev
---
version.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/version.txt b/version.txt
index 2f899b0..335eee7 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.1.0-2408041630.dev
+0.1.0-2408041749.dev
(openserverless-cli) 04/06: fix: subshell no more exiting when using utils and tools
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit 2063e68eea7c539480e1dca1c03eb124a8a16fac
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Mon Aug 5 12:31:38 2024 +0200
fix: subshell no more exiting when using utils and tools
---
.gitignore | 9 ++++-----
_patches/README.md | 3 ++-
_patches/patch-sh.sh | 4 +++-
_patches/patch-task.sh | 7 +++++--
_patches/patch-wsk.sh | 4 +++-
_patches/patch-wskdeploy.sh | 4 +++-
_patches/task | 2 +-
go.mod | 2 +-
go.sum | 4 ++--
9 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/.gitignore b/.gitignore
index aa81092..5c05e02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,8 +36,7 @@ tests/prereq/olaris/bin
tests/coreutils*
tests/7z*
!_patch
-_patch/task
-_patch/gosh
-_patch/wsk
-_patch/openwhisk-wskdeploy
-_patch/openwhisk-cli
+_patch/bin/task
+_patch/bin/gosh
+_patch/bin/wsk
+_patch/bin/openwhisk-wskdeploy
diff --git a/_patches/README.md b/_patches/README.md
index db944d7..465772d 100644
--- a/_patches/README.md
+++ b/_patches/README.md
@@ -39,11 +39,12 @@ This is the procedure we followed to build the patched versions of:
bash patch-wsk.sh
4. regenerate the go.mod/go.sum in top level (using the latest versions if you changed them!)
+
cd ..
rm go.mod go.sum
go mod init github.com/apache/openserverless-cli
go get github.com/sciabarracom/openwhisk-cli@v1.2.1
-go get github.com/sciabarracom/task/v3/cmd/taskmain@v3.38.9
+go get github.com/sciabarracom/task/v3/cmd/taskmain@v3.38.10
go mod tidy
go build
diff --git a/_patches/patch-sh.sh b/_patches/patch-sh.sh
index 76b6040..dc065bc 100644
--- a/_patches/patch-sh.sh
+++ b/_patches/patch-sh.sh
@@ -45,5 +45,7 @@ git commit -m "patching sh for ops" -a
git tag $DTAG
git push -f origin-auth openserverless --tags
VER=$(git rev-parse --short HEAD)
-GOBIN=$HERE go install github.com/sciabarracom/sh/v3/cmd/gosh@$VER
+cd ..
+mkdir -p bin
+GOBIN=$HERE/bin go install github.com/sciabarracom/sh/v3/cmd/gosh@$VER
OPS_CMD=$(which ops) OPS_TOOLS="jq awk" OPS_COREUTILS="ls cp mv" TRACE=1 ./gosh
diff --git a/_patches/patch-task.sh b/_patches/patch-task.sh
index ba78c5c..b6b1b4a 100644
--- a/_patches/patch-task.sh
+++ b/_patches/patch-task.sh
@@ -22,7 +22,8 @@ HERE=$PWD
SHVER=$(git ls-remote https://github.com/sciabarracom/sh | awk '/refs\/heads\/openserverless/{print $1}')
STAG="v3.38.0"
DTAG="v3.38.10"
-cd taskfile
+cd task
+git reset --hard
go clean -cache -modcache
git checkout "$STAG" -B openserverless
mkdir -p cmd/taskmain
@@ -80,5 +81,7 @@ go build
git tag $DTAG
git push origin-auth openserverless -f --tags
VER=$(git rev-parse HEAD)
-GOBIN=$HERE go install github.com/sciabarracom/task/v3/cmd/task@$VER
+cd ..
+mkdir -p bin
+GOBIN=$HERE/bin go install github.com/sciabarracom/task/v3/cmd/task@$VER
diff --git a/_patches/patch-wsk.sh b/_patches/patch-wsk.sh
index 7ae7817..dbee25d 100644
--- a/_patches/patch-wsk.sh
+++ b/_patches/patch-wsk.sh
@@ -45,5 +45,7 @@ git tag $DTAG
git push origin-auth openserverless -f --tags
go clean -modcache -cache -testcache -fuzzcache
VER=$(git rev-parse HEAD)
-GOBIN=$HERE go install github.com/sciabarracom/openwhisk-cli@$VER
+cd ..
+mkdir -p bin
+GOBIN=$HERE/bin go install github.com/sciabarracom/openwhisk-cli@$VER
diff --git a/_patches/patch-wskdeploy.sh b/_patches/patch-wskdeploy.sh
index 2b5cc8b..15a9033 100644
--- a/_patches/patch-wskdeploy.sh
+++ b/_patches/patch-wskdeploy.sh
@@ -39,5 +39,7 @@ git commit -m "patching sh for ops" -a
git tag $DTAG
git push origin-auth openserverless -f --tags
VER=$(git rev-parse HEAD)
-GOBIN=$HERE go install github.com/sciabarracom/openwhisk-wskdeploy@$VER
+cd ..
+mkdir -p bin
+GOBIN=$HERE/bin go install github.com/sciabarracom/openwhisk-wskdeploy@$VER
diff --git a/_patches/task b/_patches/task
index 781bf85..2c3fdce 160000
--- a/_patches/task
+++ b/_patches/task
@@ -1 +1 @@
-Subproject commit 781bf859e75a764fc76f59f76f830ec8e7d7003d
+Subproject commit 2c3fdcebad1da59613ec3e30d6fb96fac35e167c
diff --git a/go.mod b/go.mod
index b9f5af0..0a81b76 100644
--- a/go.mod
+++ b/go.mod
@@ -21,7 +21,7 @@ require (
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/sciabarracom/openwhisk-cli v1.2.1
github.com/sciabarracom/sh/v3 v3.8.3
- github.com/sciabarracom/task/v3 v3.38.9
+ github.com/sciabarracom/task/v3 v3.38.10
github.com/stretchr/testify v1.9.0
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8
github.com/zalando/go-keyring v0.2.5
diff --git a/go.sum b/go.sum
index 7c90fc2..6f1a296 100644
--- a/go.sum
+++ b/go.sum
@@ -345,8 +345,8 @@ github.com/sciabarracom/openwhisk-wskdeploy v1.2.1 h1:t5hgca9OFEO39t4OqIxcWybYRj
github.com/sciabarracom/openwhisk-wskdeploy v1.2.1/go.mod h1:bWjrIOIAzt8AcPqiJ0mWEecUxXbT4bY4ysMlJO6/q78=
github.com/sciabarracom/sh/v3 v3.8.3 h1:5afHdZzNkW5vgUMP7gHUpBYHezn3BoQsyNgKXKdTpkM=
github.com/sciabarracom/sh/v3 v3.8.3/go.mod h1:CeMVr3PRLhlUrS+VPLTp8dS5/6xNzmmX0h/WVHRR6DA=
-github.com/sciabarracom/task/v3 v3.38.9 h1:LozhBEsGQGYKJCAhOE+0s22IF92DATMNDU/RMzpbSCw=
-github.com/sciabarracom/task/v3 v3.38.9/go.mod h1:V88FdSzukQ90H9nzqexBsmBRXpoEpJGsVPMoOnkAsWc=
+github.com/sciabarracom/task/v3 v3.38.10 h1:KSu6B2CuHWail7rlTx5W72qM1klJbED3z2k7RzBvMkE=
+github.com/sciabarracom/task/v3 v3.38.10/go.mod h1:EMjHs6YrTofApnomes/CNiGQ1odZUZF6PTqmYW9EBic=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
(openserverless-cli) 05/06: 0.1.0-2408051232.dev
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit e55135a953de37907f8abb69adbc6b541ab7b50f
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Mon Aug 5 12:32:13 2024 +0200
0.1.0-2408051232.dev
---
version.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/version.txt b/version.txt
index 335eee7..ea54d9d 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.1.0-2408041749.dev
+0.1.0-2408051232.dev
(openserverless-cli) 06/06: fix prompt
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit 501db415710f8060360609bc8d55a442c2613d75
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Mon Aug 5 12:46:40 2024 +0200
fix prompt
---
tools/sh.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/sh.go b/tools/sh.go
index 92343fb..8067b07 100644
--- a/tools/sh.go
+++ b/tools/sh.go
@@ -102,7 +102,7 @@ func runInteractive(r *interp.Runner, stdin io.Reader, stdout, stderr io.Writer)
return false
}
}
- fmt.Fprintf(stdout, "$ ")
+ fmt.Fprintf(stdout, "@ ")
return true
}
if err := parser.Interactive(stdin, fn); err != nil {
(openserverless-cli) 03/06: patching sh for ops
Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-cli.git
commit 0d14d6d7bf7bbb90fc079ed9e153451bc68b8151
Author: Michele Sciabarra <mi...@sciabarra.com>
AuthorDate: Mon Aug 5 12:16:47 2024 +0200
patching sh for ops
---
.gitignore | 23 ++++++++++----------
.gitmodules | 28 ++++++++++++++++++++++++
.goreleaser.yaml | 3 +++
Taskfile.yml | 2 +-
_patches/README.md | 2 +-
_patches/awk | 1 +
_patches/builtin_extra.go | 15 +++++++------
_patches/envsubst | 1 +
_patches/jq | 1 +
_patches/patch-sh.sh | 14 +++++++++---
_patches/patch-task.sh | 2 +-
_patches/sh | 1 +
_patches/task | 1 +
_patches/wsk | 1 +
_patches/wskdeploy | 1 +
go.mod | 2 +-
go.sum | 4 ++--
preflight.go | 5 -----
prereq.go | 55 ++++++++++++++++++++++++++++++-----------------
prereq_test.go | 2 ++
20 files changed, 111 insertions(+), 53 deletions(-)
diff --git a/.gitignore b/.gitignore
index 56b2779..aa81092 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,26 +19,25 @@
.git-hooks/
.vscode/
.task/
-attic/
-_*
-ops
-!ops/
.latestcheck
.test_fail_then_succeed
-cookie.txt
-actions.zip
-nix/result
.direnv/
+cookie.txt
+attic/
+*.zip
+_*
+7*
+!cmd/ops/
+ops
tests/bats/
tests/test_helper/bats-assert/
tests/test_helper/bats-support/
+tests/prereq/olaris/bin
+tests/coreutils*
+tests/7z*
+!_patch
_patch/task
_patch/gosh
_patch/wsk
_patch/openwhisk-wskdeploy
_patch/openwhisk-cli
-tests/prereq/olaris/bin
-dist/
-tests/coreutils*
-tests/7z*
-7*
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..bfa876e
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,28 @@
+[submodule "sh"]
+ path = _patches/sh
+ url = https://github.com/sciabarracom/sh
+ branch = openserverless
+[submodule "task"]
+ path = _patches/task
+ url = https://github.com/sciabarracom/task
+ branch = openserverless
+[submodule "wskdeploy"]
+ path = _patches/wskdeploy
+ url = https://github.com/sciabarracom/openwhisk-wskdeploy
+ branch = openserverless
+[submodule "wsk"]
+ path = _patches/wsk
+ url = https://github.com/sciabarracom/openwhisk-cli
+ branch = openserverless
+[submodule "modules/jq"]
+ path = _patches/jq
+ url = https://github.com/nuvolaris/gojq
+ branch = openserverless
+[submodule "modules/awk"]
+ path = _patches/awk
+ url = https://github.com/nuvolaris/goawk
+ branch = openserverless
+[submodule "modules/envsubst"]
+ path = _patches/envsubst
+ url = https://github.com/nuvolaris/envsubst
+ branch = openserverless
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
index e24e977..303a997 100644
--- a/.goreleaser.yaml
+++ b/.goreleaser.yaml
@@ -29,6 +29,9 @@ builds:
goarch:
- amd64
- arm64
+ ignore:
+ - goos: windows
+ goarch: arm64
archives:
- id: default
diff --git a/Taskfile.yml b/Taskfile.yml
index 0d0c57c..55cfc4f 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -90,7 +90,7 @@ tasks:
desc: unit test (use F=-v to verbose)
cmds:
- rm -Rf ~/.ops
- - go clean -testcache
+ - go clean -testcache -cache
- go test -count=1 {{.F}} github.com/apache/openserverless-cli
- go test -count=1 {{.F}} github.com/apache/openserverless-cli/config
- go test -count=1 {{.F}} github.com/apache/openserverless-cli/tools
diff --git a/_patches/README.md b/_patches/README.md
index f02d061..db944d7 100644
--- a/_patches/README.md
+++ b/_patches/README.md
@@ -1,4 +1,4 @@
-# Patches:
+# Patches to the tools
- changes to mvdan/sh:
- rename to sciabarracom/sh
diff --git a/_patches/awk b/_patches/awk
new file mode 160000
index 0000000..d0931fd
--- /dev/null
+++ b/_patches/awk
@@ -0,0 +1 @@
+Subproject commit d0931fd55c2c3eadaacbea1ba3684dde951d2159
diff --git a/_patches/builtin_extra.go b/_patches/builtin_extra.go
index c42e0ac..43fa5b8 100644
--- a/_patches/builtin_extra.go
+++ b/_patches/builtin_extra.go
@@ -54,7 +54,7 @@ func isBuiltin(name string) bool {
if isTools(name) {
return true
}
- return IsBuiltin1(name)
+ return isBuiltin_orig(name)
}
func (r *Runner) builtinCode(ctx context.Context, pos syntax.Pos, name string, args []string) int {
@@ -65,19 +65,20 @@ func (r *Runner) builtinCode(ctx context.Context, pos syntax.Pos, name string, a
cmd = append(cmd, name)
}
args = append(cmd, args...)
- fmt.Printf("%v\n", args)
- r.exitShell(ctx, 1)
+ if os.Getenv("TRACE") != "" {
+ fmt.Printf("%v\n", args)
+ }
r.exec(ctx, args)
return r.exit
}
if isTools(name) {
args = append([]string{os.Getenv("OPS_CMD"), "-" + name}, args...)
- fmt.Printf("%v\n", args)
- r.exitShell(ctx, 1)
+ if os.Getenv("TRACE") != "" {
+ fmt.Printf("%v\n", args)
+ }
r.exec(ctx, args)
return r.exit
-
}
- return r.BuiltinCode1(ctx, pos, name, args)
+ return r.builtinCode_orig(ctx, pos, name, args)
}
diff --git a/_patches/envsubst b/_patches/envsubst
new file mode 160000
index 0000000..10ca029
--- /dev/null
+++ b/_patches/envsubst
@@ -0,0 +1 @@
+Subproject commit 10ca029cdb58695b98d525e833ba6dced90b5dcf
diff --git a/_patches/jq b/_patches/jq
new file mode 160000
index 0000000..54b7644
--- /dev/null
+++ b/_patches/jq
@@ -0,0 +1 @@
+Subproject commit 54b764416b6984bf36b79c42d8ccafa1ed1638df
diff --git a/_patches/patch-sh.sh b/_patches/patch-sh.sh
index abc830a..76b6040 100644
--- a/_patches/patch-sh.sh
+++ b/_patches/patch-sh.sh
@@ -21,21 +21,29 @@ cd "$(dirname $0)"
go clean -cache -modcache -testcache
HERE=$PWD
STAG="v3.8.0"
-DTAG="v3.8.2"
+DTAG="v3.8.3"
cd sh
+git reset --hard
git checkout "$STAG" -B openserverless
cp $HERE/builtin_extra.go interp/builtin_extra.go
git add interp/builtin_extra.go
-sed -i -e 's!) builtinCode(!) BuiltinCode1(!' -e 's!func isBuiltin!func IsBuiltin1!' interp/builtin.go
+sed -i -e 's!) builtinCode(!) builtinCode_orig(!' -e 's!func isBuiltin!func isBuiltin_orig!' interp/builtin.go
find . \( -name \*.go -o -name go.mod \) | while read file
do echo $file
sed -i 's!mvdan.cc/sh!github.com/sciabarracom/sh!' $file
done
go clean -modcache -cache -testcache -fuzzcache
go mod tidy
+
+#echo >>go.mod "replace github.com/sciabarracom/sh/v3/interp => ./interp"
+#echo >>go.mod "replace github.com/sciabarracom/sh/v3/syntax => ./syntax"
+#go build ./cmd/gosh
+#
+#exit
+
git commit -m "patching sh for ops" -a
git tag $DTAG
git push -f origin-auth openserverless --tags
VER=$(git rev-parse --short HEAD)
GOBIN=$HERE go install github.com/sciabarracom/sh/v3/cmd/gosh@$VER
-
+OPS_CMD=$(which ops) OPS_TOOLS="jq awk" OPS_COREUTILS="ls cp mv" TRACE=1 ./gosh
diff --git a/_patches/patch-task.sh b/_patches/patch-task.sh
index 5589c1e..ba78c5c 100644
--- a/_patches/patch-task.sh
+++ b/_patches/patch-task.sh
@@ -21,7 +21,7 @@ cd "$(dirname $0)"
HERE=$PWD
SHVER=$(git ls-remote https://github.com/sciabarracom/sh | awk '/refs\/heads\/openserverless/{print $1}')
STAG="v3.38.0"
-DTAG="v3.38.9"
+DTAG="v3.38.10"
cd taskfile
go clean -cache -modcache
git checkout "$STAG" -B openserverless
diff --git a/_patches/sh b/_patches/sh
new file mode 160000
index 0000000..f3da214
--- /dev/null
+++ b/_patches/sh
@@ -0,0 +1 @@
+Subproject commit f3da214dce8792e875c56f647f3d4900100def11
diff --git a/_patches/task b/_patches/task
new file mode 160000
index 0000000..781bf85
--- /dev/null
+++ b/_patches/task
@@ -0,0 +1 @@
+Subproject commit 781bf859e75a764fc76f59f76f830ec8e7d7003d
diff --git a/_patches/wsk b/_patches/wsk
new file mode 160000
index 0000000..39db77e
--- /dev/null
+++ b/_patches/wsk
@@ -0,0 +1 @@
+Subproject commit 39db77e21ff61258d72baa48e4ccbb66005cf44b
diff --git a/_patches/wskdeploy b/_patches/wskdeploy
new file mode 160000
index 0000000..67c642d
--- /dev/null
+++ b/_patches/wskdeploy
@@ -0,0 +1 @@
+Subproject commit 67c642d0ac144727e9cd80efdea1d73cea04dce2
diff --git a/go.mod b/go.mod
index f9561ae..b9f5af0 100644
--- a/go.mod
+++ b/go.mod
@@ -20,7 +20,7 @@ require (
github.com/nuvolaris/jj v0.0.0-20231020143327-10b90948a5d2
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/sciabarracom/openwhisk-cli v1.2.1
- github.com/sciabarracom/sh/v3 v3.8.2
+ github.com/sciabarracom/sh/v3 v3.8.3
github.com/sciabarracom/task/v3 v3.38.9
github.com/stretchr/testify v1.9.0
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8
diff --git a/go.sum b/go.sum
index 72a88e3..7c90fc2 100644
--- a/go.sum
+++ b/go.sum
@@ -343,8 +343,8 @@ github.com/sciabarracom/openwhisk-cli v1.2.1 h1:XVEAidwhmoOpvjKkqcIfGzLQwe850K5E
github.com/sciabarracom/openwhisk-cli v1.2.1/go.mod h1:KIF6FPfQ6d2mNSEFP7oiz49iHxjDCeFTnCS7XwHAlUI=
github.com/sciabarracom/openwhisk-wskdeploy v1.2.1 h1:t5hgca9OFEO39t4OqIxcWybYRjyBW7jDhg54eLar29U=
github.com/sciabarracom/openwhisk-wskdeploy v1.2.1/go.mod h1:bWjrIOIAzt8AcPqiJ0mWEecUxXbT4bY4ysMlJO6/q78=
-github.com/sciabarracom/sh/v3 v3.8.2 h1:ZAdlsq2d1UnvdbnOgENhZ/bTqKdwEM89ftX7kokVFnI=
-github.com/sciabarracom/sh/v3 v3.8.2/go.mod h1:CeMVr3PRLhlUrS+VPLTp8dS5/6xNzmmX0h/WVHRR6DA=
+github.com/sciabarracom/sh/v3 v3.8.3 h1:5afHdZzNkW5vgUMP7gHUpBYHezn3BoQsyNgKXKdTpkM=
+github.com/sciabarracom/sh/v3 v3.8.3/go.mod h1:CeMVr3PRLhlUrS+VPLTp8dS5/6xNzmmX0h/WVHRR6DA=
github.com/sciabarracom/task/v3 v3.38.9 h1:LozhBEsGQGYKJCAhOE+0s22IF92DATMNDU/RMzpbSCw=
github.com/sciabarracom/task/v3 v3.38.9/go.mod h1:V88FdSzukQ90H9nzqexBsmBRXpoEpJGsVPMoOnkAsWc=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
diff --git a/preflight.go b/preflight.go
index 522e757..c4cbacd 100644
--- a/preflight.go
+++ b/preflight.go
@@ -45,11 +45,6 @@ func preflightChecks() error {
preflight.check(checkInstalled("curl"))
preflight.check(checkInstalled("ssh"))
- if getOS() != "windows" {
- preflight.check(checkInstalled("grep"))
- preflight.check(checkInstalled("xz"))
- preflight.check(checkInstalled("gunzip"))
- }
return preflight.err
}
diff --git a/prereq.go b/prereq.go
index 9a80db8..4ccfd3d 100644
--- a/prereq.go
+++ b/prereq.go
@@ -175,53 +175,67 @@ func touchAndClean(dir string, name string, version string) error {
// download a prerequisite
func downloadPrereq(name string, task PrereqTask) error {
+
+ // names and version
+ // xname = executeable name
+ // vname = versioned executable name
version, ok := task.Vars["VERSION"]
if !ok {
+ trace("return because no version for ", name)
return nil
}
+ xname := addExeExt(name)
+ vname := xname + "-" + version
+ // ensure bindir
bindir, err := EnsureBindir()
if err != nil {
return err
}
// check if file and version exists
- vname := name + "-" + version
trace("checking", vname, version)
- if exists(bindir, name) {
- // check if there is an inconsistency in the versions
- if exists(bindir, vname) {
- trace("already downloaded", vname)
+ if exists(bindir, vname) {
+ trace("already downloaded", vname)
+ return nil
+ }
+
+ // checking different versions of the same file
+ oldver, seen := PrereqSeenMap[name]
+ if seen {
+ if oldver == version {
+ trace("same version again", vname)
return nil
}
- oldver, seen := PrereqSeenMap[name]
- if seen {
- if oldver == version {
- trace("same version again", vname)
- return nil
- }
- return fmt.Errorf("WARNING: %s prerequisite found twice with different versions!\nPrevious version: %s, ignoring %s", name, oldver, version)
- }
+ return fmt.Errorf("WARNING: %s prerequisite found twice with different versions!\nPrevious version: %s, ignoring %s", name, oldver, version)
}
+ PrereqSeenMap[name] = version
if taskDryRun {
fmt.Printf("downloading %s %s\n", name, version)
touch(bindir, name)
- touchAndClean(bindir, name, version)
} else {
fmt.Printf("ensuring prerequisite %s %s\n", name, version)
execPrereqTask(bindir, name)
// check if file and version exists
- // fixing the name for windows adding .exe
- name = addExeExt(name)
- if !exists(bindir, name) {
+ if !exists(bindir, xname) {
return fmt.Errorf("failed to download %s version %s", name, version)
}
+ // check if a file is zero length and remove in this case
+ fileInfo, err := os.Stat(joinpath(bindir, xname))
+ if err != nil {
+ return fmt.Errorf("failed to download %s version %s", name, version)
+ }
+ if fileInfo.Size() == 0 {
+ trace("removing the empty file ", xname)
+ err := os.Remove(joinpath(bindir, xname))
+ if err != nil {
+ return fmt.Errorf("cannot remove empty %s ", xname)
+ }
+ }
}
-
- PrereqSeenMap[name] = version
- return touchAndClean(bindir, name, version)
+ return touchAndClean(bindir, xname, version)
}
// ensure prereq are satified looking at the prereq.yml
@@ -237,6 +251,7 @@ func ensurePrereq(root string) error {
trace("ensurePrereq in", root)
prereq, err := loadPrereq(root)
for task := range prereq.Tasks {
+ trace("prereq", task)
err = downloadPrereq(task, prereq.Tasks[task])
if err != nil {
fmt.Printf("error in prereq %s: %v\n", task, err)
diff --git a/prereq_test.go b/prereq_test.go
index bacea9b..62de7f4 100644
--- a/prereq_test.go
+++ b/prereq_test.go
@@ -113,6 +113,8 @@ func Example_ensurePrereq() {
bindir, err := EnsureBindir()
if err == nil {
RemoveAll(bindir)
+ } else {
+ fmt.Printf("ERROR CANNOT REMOVE DIR %v\n", err)
}
dir := joinpath(joinpath(workDir, "tests"), "prereq")
fmt.Println(ensurePrereq(dir))