Never attempt to build protocol buffers offline

Building protocol buffers requires fetching utilities from the
Internet. Typically this is done at development time and the finished
buffers are included in dist; but if timestamps get off this can lead
mock to try to rebuild them during an offline build, causing the build
to fail.

This change moves all of the protoc targets into a section of the
Makefile that is disabled during an offline build.

- Closes #1155

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-03-28 16:53:39 -06:00
parent 45c933c846
commit bd468537ed
2 changed files with 20 additions and 20 deletions

View File

@@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix `wwctl profile list -a` format when kernerargs are set - Fix `wwctl profile list -a` format when kernerargs are set
- Fix a rendering bug in the documentation for GRUB boot support. #1132 - Fix a rendering bug in the documentation for GRUB boot support. #1132
- Replace slice in templates with sprig substr. #1093 - Replace slice in templates with sprig substr. #1093
- Don't attempt to rebuild protocol buffers in offline mode. #1155
## [4.5.0] 2024-02-08 ## [4.5.0] 2024-02-08

View File

@@ -160,25 +160,6 @@ reference: wwctl
latexpdf: reference latexpdf: reference
make -C userdocs latexpdf make -C userdocs latexpdf
protofiles = internal/pkg/api/routes/wwapiv1/routes.pb.go \
internal/pkg/api/routes/wwapiv1/routes.pb.gw.go \
internal/pkg/api/routes/wwapiv1/routes_grpc.pb.go
.PHONY: proto
proto: $(protofiles)
routes_proto = internal/pkg/api/routes/v1/routes.proto
$(protofiles): $(routes_proto)
PATH=$(TOOLS_BIN):$(PATH) $(PROTOC) \
-I /usr/include -I $(shell dirname $(routes_proto)) -I=. \
--grpc-gateway_opt logtostderr=true \
--go_out=. \
--go-grpc_out=. \
--grpc-gateway_out=. \
routes.proto
.PHONY: cleanproto
cleanproto:
rm -f $(protofiles)
.PHONY: cleanconfig .PHONY: cleanconfig
cleanconfig: cleanconfig:
@@ -231,7 +212,25 @@ dist: vendor
lint: $(GOLANGCI_LINT) lint: $(GOLANGCI_LINT)
$(protofiles): $(PROTOC) $(PROTOC_GEN_GRPC_GATEWAY) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) protofiles = internal/pkg/api/routes/wwapiv1/routes.pb.go \
internal/pkg/api/routes/wwapiv1/routes.pb.gw.go \
internal/pkg/api/routes/wwapiv1/routes_grpc.pb.go
.PHONY: proto
proto: $(protofiles)
routes_proto = internal/pkg/api/routes/v1/routes.proto
$(protofiles): $(routes_proto) $(PROTOC) $(PROTOC_GEN_GRPC_GATEWAY) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC)
PATH=$(TOOLS_BIN):$(PATH) $(PROTOC) \
-I /usr/include -I $(shell dirname $(routes_proto)) -I=. \
--grpc-gateway_opt logtostderr=true \
--go_out=. \
--go-grpc_out=. \
--grpc-gateway_out=. \
routes.proto
.PHONY: cleanproto
cleanproto:
rm -f $(protofiles)
clean: cleanvendor clean: cleanvendor
endif endif