github.com/anchore/syft@v1.38.2/syft/pkg/cataloger/redhat/test-fixtures/Makefile (about)

     1  RPMSDIR=rpms
     2  FINGERPRINT_FILE=$(RPMSDIR).fingerprint
     3  
     4  ifndef RPMSDIR
     5      $(error RPMSDIR is not set)
     6  endif
     7  
     8  
     9  .DEFAULT_GOAL := fixtures
    10  
    11  # requirement 1: 'fixtures' goal to generate any and all test fixtures
    12  fixtures: rpms
    13  
    14  # requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted
    15  fingerprint: $(FINGERPRINT_FILE)
    16  
    17  rpms:
    18  	mkdir -p $(RPMSDIR)
    19  	@# see note from https://dl.fedoraproject.org/pub/epel/7/README
    20  	@#  ATTENTION
    21  	@# ======================================
    22  	@# The contents of this directory have been moved to our archives available at:
    23  	@#
    24  	@# http://archives.fedoraproject.org/pub/archive/epel/
    25  
    26  	cd $(RPMSDIR) && curl -LO https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/a/abc-1.01-9.hg20160905.el7.x86_64.rpm
    27  	cd $(RPMSDIR) && curl -LO https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/z/zork-1.0.3-1.el7.x86_64.rpm
    28  
    29  # requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint
    30  .PHONY: $(FINGERPRINT_FILE)
    31  $(FINGERPRINT_FILE):
    32  	@find Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE)
    33  	@#cat $(FINGERPRINT_FILE) | sha256sum | awk '{print $$1}'
    34  
    35  # requirement 4: 'clean' goal to remove all generated test fixtures
    36  .PHONY: clean
    37  clean:
    38  	rm -rf $(RPMSDIR) $(FINGERPRINT_FILE)