Skip to content

Commit b07aa26

Browse files
authored
improve check for bin directory in makefile (#211)
* improve check for bin directory in makefile * fix lint
1 parent 191561f commit b07aa26

File tree

8 files changed

+10
-13
lines changed

8 files changed

+10
-13
lines changed

.toolbox.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TB_LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || p
66
## Location to install dependencies to
77
TB_LOCALBIN ?= $(TB_LOCALDIR)/bin
88
$(TB_LOCALBIN):
9-
mkdir -p $(TB_LOCALBIN)
9+
if [ ! -e $(TB_LOCALBIN) ]; then mkdir -p $(TB_LOCALBIN); fi
1010

1111
## Tool Binaries
1212
TB_DEEPCOPY_GEN ?= $(TB_LOCALBIN)/deepcopy-gen

pkg/makefile/.toolbox.mk.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ TB_LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || p
55
## Location to install dependencies to
66
TB_LOCALBIN ?= $(TB_LOCALDIR)/bin
77
$(TB_LOCALBIN):
8-
mkdir -p $(TB_LOCALBIN)
8+
if [ ! -e $(TB_LOCALBIN) ]; then mkdir -p $(TB_LOCALBIN); fi
99

1010
## Tool Binaries
1111
{{- range .Tools }}

pkg/makefile/renovate.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ func updateRenovateConfInternal(renovateCfgFile string) (bool, []byte, error) {
4242
found = true
4343
manager.UpdateParams()
4444
cms[i] = manager
45-
} else {
46-
if len(manager.FileMatch) > 0 && len(manager.ManagerFilePatterns) == 0 {
47-
manager.ManagerFilePatterns = manager.FileMatch
48-
manager.FileMatch = nil
49-
cms[i] = manager
50-
}
45+
} else if len(manager.FileMatch) > 0 && len(manager.ManagerFilePatterns) == 0 {
46+
manager.ManagerFilePatterns = manager.FileMatch
47+
manager.FileMatch = nil
48+
cms[i] = manager
5149
}
5250
}
5351
if !found {

pkg/types/renovate/renovate.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func (m *CustomManager) UpdateParams() {
3939
m.ManagerFilePatterns = []string{ManagerFilePatterns}
4040
m.MatchStrings = []string{MatchString}
4141
m.DatasourceTemplate = DatasourceTemplate
42-
4342
}
4443

4544
func (m *CustomManager) IsToolbox() bool {

testdata/.toolbox.mk.content.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TB_LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || p
66
## Location to install dependencies to
77
TB_LOCALBIN ?= $(TB_LOCALDIR)/bin
88
$(TB_LOCALBIN):
9-
mkdir -p $(TB_LOCALBIN)
9+
if [ ! -e $(TB_LOCALBIN) ]; then mkdir -p $(TB_LOCALBIN); fi
1010

1111
## Tool Binaries
1212
TB_CONTROLLER_GEN ?= $(TB_LOCALBIN)/controller-gen

testdata/.toolbox.mk.hybrid.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TB_LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || p
66
## Location to install dependencies to
77
TB_LOCALBIN ?= $(TB_LOCALDIR)/bin
88
$(TB_LOCALBIN):
9-
mkdir -p $(TB_LOCALBIN)
9+
if [ ! -e $(TB_LOCALBIN) ]; then mkdir -p $(TB_LOCALBIN); fi
1010

1111
## Tool Binaries
1212
TB_CONTROLLER_GEN ?= $(TB_LOCALBIN)/controller-gen

testdata/.toolbox.mk.renovate.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TB_LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || p
66
## Location to install dependencies to
77
TB_LOCALBIN ?= $(TB_LOCALDIR)/bin
88
$(TB_LOCALBIN):
9-
mkdir -p $(TB_LOCALBIN)
9+
if [ ! -e $(TB_LOCALBIN) ]; then mkdir -p $(TB_LOCALBIN); fi
1010

1111
## Tool Binaries
1212
TB_CONTROLLER_GEN ?= $(TB_LOCALBIN)/controller-gen

testdata/.toolbox.mk.tools.go.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TB_LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || p
66
## Location to install dependencies to
77
TB_LOCALBIN ?= $(TB_LOCALDIR)/bin
88
$(TB_LOCALBIN):
9-
mkdir -p $(TB_LOCALBIN)
9+
if [ ! -e $(TB_LOCALBIN) ]; then mkdir -p $(TB_LOCALBIN); fi
1010

1111
## Tool Binaries
1212
TB_CONTROLLER_GEN ?= $(TB_LOCALBIN)/controller-gen

0 commit comments

Comments
 (0)