-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (41 loc) · 1.83 KB
/
Copy pathMakefile
File metadata and controls
44 lines (41 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
SOURCE_FORMULAS := dryrun fixturize regresql
FORMULAS := $(SOURCE_FORMULAS)
.PHONY: update update-dryrun
## update a source-build formula to a new tag.
## usage: make update FORMULA=fixturize TAG=v0.4.0
update:
ifndef FORMULA
$(error FORMULA is required ($(SOURCE_FORMULAS)). Usage: make update FORMULA=fixturize TAG=v0.4.0)
endif
ifndef TAG
$(error TAG is required. Usage: make update FORMULA=$(FORMULA) TAG=v0.4.0)
endif
@URL="https://github.com/boringSQL/$(FORMULA)/archive/refs/tags/$(TAG).tar.gz"; \
echo "Fetching $$URL ..."; \
STATUS=$$(curl -sL -o /dev/null -w '%{http_code}' "$$URL"); \
if [ "$$STATUS" != "200" ]; then \
echo "Error: tag $(TAG) not found for $(FORMULA) (HTTP $$STATUS)"; exit 1; \
fi; \
SHA=$$(curl -sL "$$URL" | shasum -a 256 | cut -d' ' -f1); \
echo "Updating Formula/$(FORMULA).rb to $(TAG) (sha256: $$SHA)"; \
sed -i '' "s|url \".*\"|url \"$$URL\"|" Formula/$(FORMULA).rb; \
sed -i '' "s|sha256 \".*\"|sha256 \"$$SHA\"|" Formula/$(FORMULA).rb; \
echo "Done. Review with: git diff Formula/$(FORMULA).rb"
## update dryrun binary formula after a new release.
## usage: make update-dryrun TAG=v0.8.0
update-dryrun:
ifndef TAG
$(error TAG is required. Usage: make update-dryrun TAG=v0.8.0)
endif
$(eval VERSION := $(patsubst v%,%,$(TAG)))
@set -e; \
BASE="https://github.com/boringSQL/dryrun/releases/download/$(TAG)"; \
for target in aarch64-apple-darwin aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu; do \
URL="$$BASE/dry_run_cli-$$target.tar.xz"; \
echo "Fetching $$URL ..."; \
SHA=$$(curl -fsSL "$$URL" | shasum -a 256 | cut -d' ' -f1); \
echo " $$target -> $$SHA"; \
sed -i '' "/dry_run_cli-$$target\.tar\.xz/{n;s/sha256 \"[a-f0-9]*/sha256 \"$$SHA/;}" Formula/dryrun.rb; \
done; \
sed -i '' 's/version "[^"]*"/version "$(VERSION)"/' Formula/dryrun.rb
@echo "Done. Review with: git diff Formula/dryrun.rb"