Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ if [ "$container_image" = localhost/builder ]; then
"$container_engine" build -t "$container_image" "$dir"
fi

repo="$(./get_repo)"
commit="$(./get_commit)"
timestamp="$(./get_timestamp)"
default_version="$(./get_version)"
repo=""
commit=""
timestamp=""
default_version=""
[ -e get_repo ] && repo="$(./get_repo)"
[ -e get_commit ] && commit="$(./get_commit)"
[ -e get_timestamp ] && timestamp="$(./get_timestamp)"
[ -e get_version ] && default_version="$(./get_version)"

[ -d $target_dir ] || mkdir $target_dir

Expand Down
18 changes: 11 additions & 7 deletions builder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ prelastword = $(word $(words $1),_ $1)
cname_version = $(call lastword,$(subst -, ,$1))
cname_arch = $(call prelastword,$(subst -, ,$1))

define require_var =
ifndef $1
$$(error '$1 undefined')
ifeq ($(REPO),)
override REPO := http://deb.debian.org/debian
Comment thread
MalteJ marked this conversation as resolved.
Outdated
endif
ifeq ($(COMMIT),)
override COMMIT := $(shell [ -z "$$(git status --porcelain 2> /dev/null)" ] && git rev-parse HEAD 2> /dev/null || echo local)
Comment thread
MalteJ marked this conversation as resolved.
Outdated
endif
ifeq ($(TIMESTAMP),)
override TIMESTAMP := 0
endif
ifeq ($(DEFAULT_VERSION),)
override DEFAULT_VERSION := bookworm
endif
endef

required_vars := REPO COMMIT TIMESTAMP DEFAULT_VERSION
$(foreach var,$(required_vars),$(eval $(call require_var,$(var))))

SHORT_COMMIT := $(shell head -c 8 <<< '$(COMMIT)')

Expand Down