From 684ce272e6eda98914f35c0efd1efaf9f02b076f Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Wed, 4 Mar 2015 14:46:43 +0100 Subject: [PATCH] tool/ports: add tool to check source availability The 'check_port_source' checks whether all remote sources defined for a given port are currently available. It returns zero, when all remote resources are available. Fix #1430 --- tool/ports/check_port_source | 27 ++++++++++++++++ tool/ports/mk/check.mk | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100755 tool/ports/check_port_source create mode 100644 tool/ports/mk/check.mk diff --git a/tool/ports/check_port_source b/tool/ports/check_port_source new file mode 100755 index 0000000000..8018438cec --- /dev/null +++ b/tool/ports/check_port_source @@ -0,0 +1,27 @@ +#!/usr/bin/make -f + +# +# \brief Tool for checking remote 3rd-party sources +# \author Stefan Kalkowski +# \date 2015-03-04 +# + +# +# Determine Genode base directory based on the known location of the +# 'create_builddir' tool within the Genode source tree +# +export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..) + +include $(GENODE_DIR)/tool/ports/mk/front_end.inc +include $(GENODE_DIR)/tool/ports/mk/check_port_arg.inc + +usage: + @$(ECHO) + @$(ECHO) "--- check remote sources of port ---" + @$(ECHO) "usage: check_port_source " + @$(ECHO) + +$(TARGET): + $(VERBOSE)$(MAKE) --no-print-directory \ + -f $(GENODE_DIR)/tool/ports/mk/check.mk \ + PORT=$(PORT) VERBOSE=$(VERBOSE) diff --git a/tool/ports/mk/check.mk b/tool/ports/mk/check.mk new file mode 100644 index 0000000000..b127761de4 --- /dev/null +++ b/tool/ports/mk/check.mk @@ -0,0 +1,61 @@ +# +# \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: + +# +# Utility to check if a tool is installed +# +check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.)) + +$(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 Subversion repository +# +%.svn: + $(VERBOSE)svn info -r $(REV($*)) $(URL($*)) >/dev/null 2>&1 + +# +# Check plain remote file +# +%.file: + $(VERBOSE)curl -f -L -k -r -2 $(URL($*)) > /dev/null 2>&1 + +%.archive: %.file + $(VERBOSE)true