Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making get_repo, get_timestamp, get_commit, get_version files optional #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
MalteJ marked this conversation as resolved.
Show resolved Hide resolved
endif
ifeq ($(COMMIT),)
override COMMIT := $(shell [ -z "$$(git status --porcelain 2> /dev/null)" ] && git rev-parse HEAD 2> /dev/null || echo local)
MalteJ marked this conversation as resolved.
Show resolved Hide resolved
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