depot/sculpt: support for index files

The input for the pkg index is located at gems/run/sculpt/index.

The sculpt.run script uses this input for generating the depot index
file at depot/<user>/index/<version>.

The tool/depot/publish tool support arguments of the form
<user>/index/<version> where <version> corresponds to the Sculpt
version.

Issue #3172
This commit is contained in:
Norman Feske 2019-02-19 17:33:15 +01:00 committed by Christian Helmuth
parent 0d5b8cb0fe
commit 1b518965cc
3 changed files with 94 additions and 16 deletions

View File

@ -500,17 +500,6 @@ puts $fd "[sculpt_version]"
close $fd
#
# Assemble 'depot_users.tar' with the keys and download locations of the
# depot user found at genode/depot/.
#
set depot_users_files [exec sh -c "cd [genode_dir]; \
find depot -maxdepth 3 -name pubkey \
-or -name download"]
exec sh -c "tar cf [run_dir]/genode/depot_users.tar -C [genode_dir] \
[join $depot_users_files]"
#
# Depot packages to be included in the default installation
#
@ -599,6 +588,41 @@ exec tar cf [run_dir]/genode/launcher.tar -C [run_dir]/genode launcher
exec rm -r [run_dir]/genode/launcher
#
# Generate depot index from gems/run/sculpt/index
#
set fd [open [genode_dir]/repos/gems/run/sculpt/index r]
set pkg_index [read $fd]
close $fd
# filter 'pkg' attribute
set pattern {(\<pkg[^\>]+?path=")([^/]+)(")}
while {[regexp $pattern $pkg_index dummy head pkg tail]} {
set pkg_path [depot_user]/pkg/[current_pkg $pkg]
regsub $pattern $pkg_index "$head$pkg_path$tail" pkg_index
}
# write filtered pkg index into the depot
file mkdir [depot_dir]/[depot_user]/index
set fd [open [depot_dir]/[depot_user]/index/[sculpt_version] w]
puts $fd $pkg_index
close $fd
#
# Assemble 'depot_users.tar' with the keys and download locations of the
# depot user found at genode/depot/.
#
# Add current depot index of [depot_user] as generated above.
#
set depot_users_files [exec sh -c "cd [genode_dir]; \
find depot -maxdepth 3 -name pubkey \
-or -name download"]
exec sh -c "tar cf [run_dir]/genode/depot_users.tar -C [genode_dir] \
[join $depot_users_files] \
depot/[depot_user]/index/[sculpt_version]"
#
# Create boot image
#

View File

@ -0,0 +1,27 @@
<index>
<index name="GUI">
<pkg path="sticks_blue_backdrop" info="default desktop background"/>
<pkg path="themed_wm" info="ready-to-use window manager"/>
<pkg path="fonts_fs" info="font provider"/>
<pkg path="wm" info="window manager"/>
<pkg path="motif_decorator" info="Motif-style window decorator"/>
<pkg path="themed_decorator" info="modern-looking window decorator"/>
<pkg path="window_layouter" info="default window layouter"/>
</index>
<index name="Tools">
<pkg path="noux-system" info="command-line interface to the system"/>
<pkg path="qt5_textedit" info="Qt5-based text editor"/>
<pkg path="report_dump" info="save periodic snapshots of the report fs"/>
</index>
<index name="Demos">
<pkg path="nano3d" info="simple software-rendering demo"/>
</index>
<index name="Virtual machines">
<pkg path="vbox5-nova-sculpt" info="VBox5 for running Linux"/>
</index>
</index>

View File

@ -56,9 +56,31 @@ endif
dependencies_error:
@$(DEPENDENCIES_CMD)
TARGETS += $(addsuffix .tar.xz.sig,$(addprefix $(PUBLIC_DIR)/,$(ARCHIVES)))
#
# Generate compressed and signed archives
# Determine to-be-published index files from MAKECMDGOALS
#
INDEX_FILES := $(foreach A,$(MAKECMDGOALS),\
$(if $(call archive_has_type,$A,index),$A,))
INDEX_FILES_MISSING := $(sort $(foreach I, $(INDEX_FILES),\
$(if $(wildcard $(DEPOT_DIR)/$I),,$I)))
ifneq ($(INDEX_FILES_MISSING),)
$(MAKECMDGOALS): index_missing_error
else
TARGETS += $(addsuffix .xz.sig,$(addprefix $(PUBLIC_DIR)/,$(INDEX_FILES)))
endif
index_missing_error:
@echo "Error: missing depot content: $(INDEX_FILES_MISSING)"; false
#
# Generate compressed and signed archives and index files
#
include $(GENODE_DIR)/tool/depot/mk/gpg.inc
@ -68,20 +90,25 @@ MISSING_PUBKEY_FILES := $(sort \
$(if $(call pubkey_path,$A),,\
$(DEPOT_DIR)/$(call pubkey_filename,$A))))
TARGETS := $(addsuffix .tar.xz.sig,$(addprefix $(PUBLIC_DIR)/,$(ARCHIVES)))
$(PUBLIC_DIR)/%.tar.xz.sig : $(PUBLIC_DIR)/%.tar.xz
$(PUBLIC_DIR)/%.xz.sig : $(PUBLIC_DIR)/%.xz
$(VERBOSE)rm -f $@;
$(VERBOSE)$(GPG) --detach-sign --digest-algo SHA256 --no-tty --use-agent \
--local-user $(call pubkey_id,$*) - < $< > $@
.PRECIOUS: $(TARGETS:.tar.xz.sig=.tar.xz)
.PRECIOUS: $(TARGETS:.xz.sig=.xz)
# archive
$(PUBLIC_DIR)/%.tar.xz: $(DEPOT_DIR)/%
@$(ECHO) "$(DARK_COL)publish$(DEFAULT_COL) $@"
$(VERBOSE)test -e $(dir $@) || mkdir -p $(dir $@)
$(VERBOSE)tar cJf $@ -C $(dir $<) $(notdir $<)
# index file
$(PUBLIC_DIR)/%.xz: $(DEPOT_DIR)/%
@$(ECHO) "$(DARK_COL)publish$(DEFAULT_COL) $@"
$(VERBOSE)test -e $(dir $@) || mkdir -p $(dir $@)
$(VERBOSE)xz <$< >$@
ifneq ($(MISSING_PUBKEY_FILES),)
$(MAKECMDGOALS) $(TARGETS): missing_pubkey_files
endif