github.com/anchore/syft@v1.38.2/syft/pkg/cataloger/binary/test-fixtures/Makefile (about) 1 BIN=classifiers/bin 2 FINGERPRINT_FILE=$(BIN).fingerprint 3 4 5 .DEFAULT_GOAL := fixtures 6 7 # requirement 1: 'fixtures' goal to generate any and all test fixtures 8 fixtures: download 9 10 # requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted 11 fingerprint: clean-fingerprint $(FINGERPRINT_FILE) 12 13 list: ## list all managed binaries and snippets 14 go run ./manager list 15 16 download: ## download only binaries that are not covered by a snippet 17 go run ./manager download $(name) --skip-if-covered-by-snippet 18 19 download-all: ## download all managed binaries 20 go run ./manager download 21 22 add-snippet: ## add a new snippet from an existing binary 23 go run ./manager add-snippet 24 25 # requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint 26 .PHONY: $(FINGERPRINT_FILE) 27 $(FINGERPRINT_FILE): ## prints the sha256sum of the any input to the download command (to determine if there is a cache miss) 28 @sha256sum ./config.yaml > $(FINGERPRINT_FILE) 29 30 # requirement 4: 'clean' goal to remove all generated test fixtures 31 clean: ## clean up all downloaded binaries 32 rm -rf $(BIN) 33 34 clean-fingerprint: ## clean up all legacy fingerprint files 35 @find $(BIN) -name '*.fingerprint' -delete 36 37 38 ## Halp! ################################# 39 40 .PHONY: help 41 help: 42 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(BOLD)$(CYAN)%-25s$(RESET)%s\n", $$1, $$2}' 43 44 .PHONY: default list download download-all clean clean-fingerprint add-snippet fingerprint