Skip to content

Commit 480bd92

Browse files
committed
using default values. get_repo, get_timestamp, get_commit, get_version files become optional
1 parent 623b339 commit 480bd92

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

build

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,14 @@ if [ "$container_image" = localhost/builder ]; then
6363
"$container_engine" build -t "$container_image" "$dir"
6464
fi
6565

66-
repo="$(./get_repo)"
67-
commit="$(./get_commit)"
68-
timestamp="$(./get_timestamp)"
69-
default_version="$(./get_version)"
66+
repo=""
67+
commit=""
68+
timestamp=""
69+
default_version=""
70+
[ -e get_repo ] && repo="$(./get_repo)"
71+
[ -e get_commit ] && commit="$(./get_commit)"
72+
[ -e get_timestamp ] && timestamp="$(./get_timestamp)"
73+
[ -e get_version ] && default_version="$(./get_version)"
7074

7175
[ -d $target_dir ] || mkdir $target_dir
7276

builder/Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ prelastword = $(word $(words $1),_ $1)
1515
cname_version = $(call lastword,$(subst -, ,$1))
1616
cname_arch = $(call prelastword,$(subst -, ,$1))
1717

18-
define require_var =
19-
ifndef $1
20-
$$(error '$1 undefined')
18+
ifeq ($(REPO),)
19+
override REPO := http://deb.debian.org/debian
20+
endif
21+
ifeq ($(COMMIT),)
22+
override COMMIT := $(shell [ -z "$$(git status --porcelain 2> /dev/null)" ] && git rev-parse HEAD 2> /dev/null || echo local)
23+
endif
24+
ifeq ($(TIMESTAMP),)
25+
override TIMESTAMP := 0
26+
endif
27+
ifeq ($(DEFAULT_VERSION),)
28+
override DEFAULT_VERSION := bookworm
2129
endif
22-
endef
23-
24-
required_vars := REPO COMMIT TIMESTAMP DEFAULT_VERSION
25-
$(foreach var,$(required_vars),$(eval $(call require_var,$(var))))
2630

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

0 commit comments

Comments
 (0)