Skip to content

Commit 0d14d6d

Browse files
patching sh for ops
1 parent 3645976 commit 0d14d6d

20 files changed

Lines changed: 111 additions & 53 deletions

.gitignore

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,25 @@
1919
.git-hooks/
2020
.vscode/
2121
.task/
22-
attic/
23-
_*
24-
ops
25-
!ops/
2622
.latestcheck
2723
.test_fail_then_succeed
28-
cookie.txt
29-
actions.zip
30-
nix/result
3124
.direnv/
25+
cookie.txt
26+
attic/
27+
*.zip
28+
_*
29+
7*
30+
!cmd/ops/
31+
ops
3232
tests/bats/
3333
tests/test_helper/bats-assert/
3434
tests/test_helper/bats-support/
35+
tests/prereq/olaris/bin
36+
tests/coreutils*
37+
tests/7z*
38+
!_patch
3539
_patch/task
3640
_patch/gosh
3741
_patch/wsk
3842
_patch/openwhisk-wskdeploy
3943
_patch/openwhisk-cli
40-
tests/prereq/olaris/bin
41-
dist/
42-
tests/coreutils*
43-
tests/7z*
44-
7*

.gitmodules

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[submodule "sh"]
2+
path = _patches/sh
3+
url = https://github.com/sciabarracom/sh
4+
branch = openserverless
5+
[submodule "task"]
6+
path = _patches/task
7+
url = https://github.com/sciabarracom/task
8+
branch = openserverless
9+
[submodule "wskdeploy"]
10+
path = _patches/wskdeploy
11+
url = https://github.com/sciabarracom/openwhisk-wskdeploy
12+
branch = openserverless
13+
[submodule "wsk"]
14+
path = _patches/wsk
15+
url = https://github.com/sciabarracom/openwhisk-cli
16+
branch = openserverless
17+
[submodule "modules/jq"]
18+
path = _patches/jq
19+
url = https://github.com/nuvolaris/gojq
20+
branch = openserverless
21+
[submodule "modules/awk"]
22+
path = _patches/awk
23+
url = https://github.com/nuvolaris/goawk
24+
branch = openserverless
25+
[submodule "modules/envsubst"]
26+
path = _patches/envsubst
27+
url = https://github.com/nuvolaris/envsubst
28+
branch = openserverless

.goreleaser.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ builds:
2929
goarch:
3030
- amd64
3131
- arm64
32+
ignore:
33+
- goos: windows
34+
goarch: arm64
3235

3336
archives:
3437
- id: default

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ tasks:
9090
desc: unit test (use F=-v to verbose)
9191
cmds:
9292
- rm -Rf ~/.ops
93-
- go clean -testcache
93+
- go clean -testcache -cache
9494
- go test -count=1 {{.F}} github.com/apache/openserverless-cli
9595
- go test -count=1 {{.F}} github.com/apache/openserverless-cli/config
9696
- go test -count=1 {{.F}} github.com/apache/openserverless-cli/tools

_patches/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Patches:
1+
# Patches to the tools
22

33
- changes to mvdan/sh:
44
- rename to sciabarracom/sh

_patches/awk

Submodule awk added at d0931fd

_patches/builtin_extra.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func isBuiltin(name string) bool {
5454
if isTools(name) {
5555
return true
5656
}
57-
return IsBuiltin1(name)
57+
return isBuiltin_orig(name)
5858
}
5959

6060
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
6565
cmd = append(cmd, name)
6666
}
6767
args = append(cmd, args...)
68-
fmt.Printf("%v\n", args)
69-
r.exitShell(ctx, 1)
68+
if os.Getenv("TRACE") != "" {
69+
fmt.Printf("%v\n", args)
70+
}
7071
r.exec(ctx, args)
7172
return r.exit
7273
}
7374

7475
if isTools(name) {
7576
args = append([]string{os.Getenv("OPS_CMD"), "-" + name}, args...)
76-
fmt.Printf("%v\n", args)
77-
r.exitShell(ctx, 1)
77+
if os.Getenv("TRACE") != "" {
78+
fmt.Printf("%v\n", args)
79+
}
7880
r.exec(ctx, args)
7981
return r.exit
80-
8182
}
82-
return r.BuiltinCode1(ctx, pos, name, args)
83+
return r.builtinCode_orig(ctx, pos, name, args)
8384
}

_patches/envsubst

Submodule envsubst added at 10ca029

_patches/jq

Submodule jq added at 54b7644

_patches/patch-sh.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,29 @@ cd "$(dirname $0)"
2121
go clean -cache -modcache -testcache
2222
HERE=$PWD
2323
STAG="v3.8.0"
24-
DTAG="v3.8.2"
24+
DTAG="v3.8.3"
2525
cd sh
26+
git reset --hard
2627
git checkout "$STAG" -B openserverless
2728
cp $HERE/builtin_extra.go interp/builtin_extra.go
2829
git add interp/builtin_extra.go
29-
sed -i -e 's!) builtinCode(!) BuiltinCode1(!' -e 's!func isBuiltin!func IsBuiltin1!' interp/builtin.go
30+
sed -i -e 's!) builtinCode(!) builtinCode_orig(!' -e 's!func isBuiltin!func isBuiltin_orig!' interp/builtin.go
3031
find . \( -name \*.go -o -name go.mod \) | while read file
3132
do echo $file
3233
sed -i 's!mvdan.cc/sh!github.com/sciabarracom/sh!' $file
3334
done
3435
go clean -modcache -cache -testcache -fuzzcache
3536
go mod tidy
37+
38+
#echo >>go.mod "replace github.com/sciabarracom/sh/v3/interp => ./interp"
39+
#echo >>go.mod "replace github.com/sciabarracom/sh/v3/syntax => ./syntax"
40+
#go build ./cmd/gosh
41+
#
42+
#exit
43+
3644
git commit -m "patching sh for ops" -a
3745
git tag $DTAG
3846
git push -f origin-auth openserverless --tags
3947
VER=$(git rev-parse --short HEAD)
4048
GOBIN=$HERE go install github.com/sciabarracom/sh/v3/cmd/gosh@$VER
41-
49+
OPS_CMD=$(which ops) OPS_TOOLS="jq awk" OPS_COREUTILS="ls cp mv" TRACE=1 ./gosh

0 commit comments

Comments
 (0)