File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ setup: force-upgrade setup-go setup-binaries setup-schemastore
94
94
setup-go :
95
95
go build -o $(PACKAGE_PATH ) /bin/ $(REPO_PATH ) /golang/cmd/...
96
96
go build -o $(PACKAGE_PATH ) /bin/cuevalidate.so -buildmode=c-shared $(REPO_PATH ) /golang/internal/cue_validator/cue_validator.go
97
- setup-binaries : $(PACKAGE_PATH ) /bin/slsa-verifier $(PACKAGE_PATH ) /resources/mvnw $(PACKAGE_PATH ) /resources/gradlew souffle
97
+ setup-binaries : $(PACKAGE_PATH ) /bin/slsa-verifier $(PACKAGE_PATH ) /resources/mvnw $(PACKAGE_PATH ) /resources/gradlew souffle gnu-sed
98
98
$(PACKAGE_PATH ) /bin/slsa-verifier :
99
99
git clone --depth 1 https://github.com/slsa-framework/slsa-verifier.git -b v2.5.1
100
100
cd slsa-verifier/cli/slsa-verifier && go build -o $(PACKAGE_PATH ) /bin/
@@ -170,6 +170,12 @@ souffle:
170
170
fi && \
171
171
command -v souffle || true
172
172
173
+ # Install gnu-sed on mac using homebrew
174
+ .PHONY : gnu-sed
175
+ gnu-sed :
176
+ if [ " $( OS_DISTRO) " == " Darwin" ]; then \
177
+ brew install gnu-sed; \
178
+ fi
173
179
174
180
# Install or upgrade an existing virtual environment based on the
175
181
# package dependencies declared in pyproject.toml.
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ for f in $files; do
52
52
fi
53
53
done
54
54
55
+ SED=" sed"
56
+ # Use gnu-sed (gsed) on mac.
57
+ if [[ " $( uname) " == " Darwin" ]]; then
58
+ SED=" gsed"
59
+ fi
60
+
55
61
if [ ${# missing_copyright_files[@]} -ne 0 ]; then
56
62
for f in " ${missing_copyright_files[@]} " ; do
57
63
@@ -86,14 +92,14 @@ if [ ${#missing_copyright_files[@]} -ne 0 ]; then
86
92
shebang_line=$( grep -m 1 -n " #!" " $f " )
87
93
if [[ -z " $shebang_line " ]]; then
88
94
# If there is no shebang, insert at the first line.
89
- sed -i " 1s/^/$expected \n\n/" " $f "
95
+ $SED -i " 1s/^/$expected \n\n/" " $f "
90
96
else
91
97
# If there is a shebang, append to the end of the line.
92
- sed -i " $( echo " $shebang_line " | cut -d : -f 1) " " s/$/\n\n$expected /" " $f "
98
+ $SED -i " $( echo " $shebang_line " | cut -d : -f 1) " " s/$/\n\n$expected /" " $f "
93
99
fi
94
100
else
95
101
echo " Copyright header needs update for $f ."
96
- sed -i " $line_number " " s/^.*/$expected /" " $f "
102
+ $SED -i " $line_number " " s/^.*/$expected /" " $f "
97
103
fi
98
104
done
99
105
echo " Copyright headers have been automatically added/updated. Please review and stage the changes before running git commit again."
You can’t perform that action at this time.
0 commit comments