genode/tool/ports/mk/check.mk
Alice Domage 74abf8132e tool/port: add .sparse-git install rule
Following Github support removal for svn [1], dde_rump port fails to
prepare. This commit introduces a new install rule for ports,
'.sparse-git'. It performs a sparse-checkout on the port repository, only
fetching required files.

[1] https://github.blog/2023-01-20-sunsetting-subversion-support/

Co-authored-by: Benjamin Lamowski <benjamin.lamowski@genode-labs.com>

Issue genodelabs#5072
Issue genodelabs/goa#28
2023-12-13 12:33:05 +01:00

71 lines
1.6 KiB
Makefile

#
# \brief Check for remote 3rd-party source code
# \author Stefan Kalkowski
# \date 2015-03-04
#
# This makefile must be invoked from the port directory.
#
# Arguments:
#
# PORT - port description file
#
check:
$(call check_tool,curl)
$(call check_tool,git)
$(call check_tool,svn)
# repository that contains the port description, used to look up patch files
REP_DIR := $(realpath $(dir $(PORT))/..)
#
# Include definitions provided by the port description file
#
include $(PORT)
#
# Include common definitions
#
include $(GENODE_DIR)/tool/ports/mk/common.inc
#
# Default rule that triggers the actual check steps
#
check: $(DOWNLOADS)
#
# Check source codes from a Git repository
#
%.git:
$(VERBOSE)git ls-remote --exit-code $(URL($*)) >/dev/null 2>&1
#
# Check source codes from a Git repository (sparse-checkout)
#
%.sparse-git:
$(VERBOSE)git ls-remote --exit-code $(URL($*)) >/dev/null 2>&1
#
# Check source codes from Subversion repository
#
%.svn:
$(VERBOSE)svn info -r $(REV($*)) $(URL($*)) >/dev/null 2>&1
#
# Check plain remote file
#
# Try to download first kilobytes at maximum, which succeeds with return code 0
# on small files or "(63) Maximum file size exceeded" if the file is larger.
# We call curl a second time if the first check fails. This gives download
# sites time to reconsider their response and helps, for example, to check the
# qemu-usb port.
#
CURL_CMD = curl -s -f -L -k --max-filesize 200000 \
--max-time 15 --retry 1 $(URL($*)) > /dev/null || [ $$? -eq 63 ]
%.file:
$(VERBOSE)$(CURL_CMD) || (sleep 1; $(CURL_CMD))
%.archive: %.file
$(VERBOSE)true