2017-03-28 16:41:41 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
|
|
|
#
|
|
|
|
# \brief Tool for assembling a package archive
|
|
|
|
# \author Norman Feske
|
|
|
|
# \date 2017-03-17
|
|
|
|
#
|
|
|
|
|
|
|
|
define HELP_MESSAGE
|
|
|
|
|
|
|
|
Compress and sign depot content for publishing
|
|
|
|
|
|
|
|
usage:
|
|
|
|
|
2018-02-26 16:05:34 +00:00
|
|
|
$(firstword $(MAKEFILE_LIST)) <archive-path> {PUBLIC_DIR=<public>}
|
2017-03-28 16:41:41 +00:00
|
|
|
|
|
|
|
The <archive-path> denotes the archives (and implicitly their
|
|
|
|
dependencies) to publish from the depot to the public directory.
|
|
|
|
It must be given including the version number of the package archive.
|
|
|
|
|
|
|
|
This tool does not touch any Genode source repository. It solely
|
|
|
|
reads from the depot and writes to the public directory.
|
|
|
|
|
2018-02-26 16:05:34 +00:00
|
|
|
The optional 'PUBLIC_DIR' argument defines the location of the public
|
2017-03-28 16:41:41 +00:00
|
|
|
directory. If not specified, '<genode-dir>/public/' is used.
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..)
|
|
|
|
|
|
|
|
PUBLIC_DIR ?= $(GENODE_DIR)/public
|
|
|
|
|
|
|
|
include $(GENODE_DIR)/tool/depot/mk/front_end.inc
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Determine dependencies, check for completeness
|
|
|
|
#
|
|
|
|
|
|
|
|
ifneq ($(MAKECMDGOALS),)
|
2018-01-09 12:33:48 +00:00
|
|
|
DEPENDENCIES_CMD := $(GENODE_DIR)/tool/depot/dependencies DEPOT_DIR="$(DEPOT_DIR)" $(MAKECMDGOALS)
|
2017-03-28 16:41:41 +00:00
|
|
|
DEPENDENCIES_RESULT := $(shell $(DEPENDENCIES_CMD) 2> /dev/null || true)
|
|
|
|
endif
|
|
|
|
|
2018-02-01 16:56:57 +00:00
|
|
|
DEPENDENCIES_MISSING := $(sort $(foreach A, $(DEPENDENCIES_RESULT),\
|
|
|
|
$(if $(wildcard $(PUBLIC_DIR)/$A.tar.xz.sig),,$A)))
|
|
|
|
|
2017-03-28 16:41:41 +00:00
|
|
|
ifeq ($(filter Error:,$(DEPENDENCIES_RESULT)),)
|
2018-02-01 16:56:57 +00:00
|
|
|
ARCHIVES := $(DEPENDENCIES_MISSING)
|
2017-03-28 16:41:41 +00:00
|
|
|
else
|
|
|
|
ARCHIVES :=
|
|
|
|
$(MAKECMDGOALS): dependencies_error
|
|
|
|
endif
|
|
|
|
|
|
|
|
# re-execute the dependencies command to present the error to the user
|
|
|
|
dependencies_error:
|
|
|
|
@$(DEPENDENCIES_CMD)
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generate compressed and signed archives
|
|
|
|
#
|
|
|
|
|
|
|
|
include $(GENODE_DIR)/tool/depot/mk/gpg.inc
|
|
|
|
|
|
|
|
MISSING_PUBKEY_FILES := $(sort \
|
|
|
|
$(foreach A,$(ARCHIVES),\
|
|
|
|
$(if $(call pubkey_path,$A),,\
|
|
|
|
$(DEPOT_DIR)/$(call pubkey_filename,$A))))
|
|
|
|
|
2017-12-11 15:49:23 +00:00
|
|
|
TARGETS := $(addsuffix .tar.xz.sig,$(addprefix $(PUBLIC_DIR)/,$(ARCHIVES)))
|
2017-03-28 16:41:41 +00:00
|
|
|
|
2017-12-11 15:49:23 +00:00
|
|
|
$(PUBLIC_DIR)/%.tar.xz.sig : $(PUBLIC_DIR)/%.tar.xz
|
2017-03-28 16:41:41 +00:00
|
|
|
$(VERBOSE)rm -f $@;
|
2018-01-18 10:11:31 +00:00
|
|
|
$(VERBOSE)gpg --detach-sign --digest-algo SHA256 --no-tty --use-agent \
|
|
|
|
--local-user $(call pubkey_id,$*) $<
|
2017-03-28 16:41:41 +00:00
|
|
|
|
2017-12-11 15:49:23 +00:00
|
|
|
.PRECIOUS: $(TARGETS:.tar.xz.sig=.tar.xz)
|
2017-03-28 16:41:41 +00:00
|
|
|
|
2017-12-11 15:49:23 +00:00
|
|
|
$(PUBLIC_DIR)/%.tar.xz: $(DEPOT_DIR)/%
|
2017-03-28 16:41:41 +00:00
|
|
|
@$(ECHO) "$(DARK_COL)publish$(DEFAULT_COL) $@"
|
|
|
|
$(VERBOSE)test -e $(dir $@) || mkdir -p $(dir $@)
|
2017-12-11 15:49:23 +00:00
|
|
|
$(VERBOSE)tar cJf $@ -C $(dir $<) $(notdir $<)
|
2017-03-28 16:41:41 +00:00
|
|
|
|
|
|
|
ifneq ($(MISSING_PUBKEY_FILES),)
|
|
|
|
$(MAKECMDGOALS) $(TARGETS): missing_pubkey_files
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(MAKECMDGOALS): $(TARGETS)
|
|
|
|
@true
|
|
|
|
|