From 07d02f8d4654956465c29594b55d7549a2d8b26b Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Fri, 20 Jan 2023 15:22:12 +0100 Subject: [PATCH] tool/port: access to metadata of ports Fixes #4685 --- tool/ports/metadata | 34 +++++++++++++++++ tool/ports/mk/metadata_single_port.mk | 54 +++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100755 tool/ports/metadata create mode 100644 tool/ports/mk/metadata_single_port.mk diff --git a/tool/ports/metadata b/tool/ports/metadata new file mode 100755 index 0000000000..9bcdb64db7 --- /dev/null +++ b/tool/ports/metadata @@ -0,0 +1,34 @@ +#!/usr/bin/make -f + +# +# \brief Tool for retrieving metadata of port sources +# \author Christian Helmuth +# \date 2023-01-20 +# + +ifndef VERBOSE +MAKEFLAGS += --no-print-directory +endif + +export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..) + +usage: + @$(ECHO) + @$(ECHO) "Tool for retrieving version information of port sources" + @$(ECHO) + @$(ECHO) "usage:" + @$(ECHO) + @$(ECHO) " $(notdir $(MAKEFILE_LIST)) " + @$(ECHO) + @$(ECHO) " whitespace-separated list of ports" + @$(ECHO) + +TARGETS = $(sort $(MAKECMDGOALS)) + +.PHONY: $(TARGETS) + +.NOTPARALLEL: + +$(TARGETS): + @$(MAKE) -f $(GENODE_DIR)/tool/ports/mk/metadata_single_port.mk $@ + @$(ECHO) diff --git a/tool/ports/mk/metadata_single_port.mk b/tool/ports/mk/metadata_single_port.mk new file mode 100644 index 0000000000..8a00cafa60 --- /dev/null +++ b/tool/ports/mk/metadata_single_port.mk @@ -0,0 +1,54 @@ +# +# \brief Retrieve version information of port source +# \author Christian Helmuth +# \date 2023-01-20 +# + +PORTS_TOOL_DIR ?= $(GENODE_DIR)/tool/ports + +include $(GENODE_DIR)/tool/ports/mk/front_end.inc +include $(GENODE_DIR)/tool/ports/mk/check_port_arg.inc + +# +# Include definitions provided by the port description file +# +include $(PORT) + +.NOTPARALLEL: + +# +# Assertion for the presence of a LICENSE and VERSION declarations in the port +# description +# +ifeq ($(LICENSE),) +$(TARGET): license_undefined +license_undefined: + @$(ECHO) "Error: License undefined"; false +endif + +ifeq ($(VERSION),) +$(TARGET): version_undefined +version_undefined: + @$(ECHO) "Error: Version undefined"; false +endif + +info: + @$(ECHO) "PORT: $(PORT_NAME)" + @$(ECHO) "LICENSE: $(LICENSE)" + @$(ECHO) "VERSION: $(VERSION)" + +%.file: + @$(ECHO) "SOURCE: $(URL($*)) ($*)" + +%.archive: + @$(ECHO) "SOURCE: $(URL($*)) ($*)" + +%.git: + @$(ECHO) "SOURCE: $(URL($*)) git $(REV($*)) ($*)" + +%.svn: + @$(ECHO) "SOURCE: $(URL($*)) svn $(REV($*)) ($*)" + +$(DOWNLOADS): info + +$(TARGET): $(DOWNLOADS)