aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild_repo.sh4
-rw-r--r--pkgauto.mk10
2 files changed, 11 insertions, 3 deletions
diff --git a/build_repo.sh b/build_repo.sh
index 30bfa83..0a1217a 100755
--- a/build_repo.sh
+++ b/build_repo.sh
@@ -44,8 +44,8 @@ for d in *; do
done
# Deploy pkgauto.mk
-[ -d .omnia-sdk ] && cp pkgauto.mk .omnia-sdk/include/
-[ -d .turris-sdk ] && cp pkgauto.mk .turris-sdk/include/
+[ -d .omnia-sdk ] && sed "s#%PKGAUTO%#$PWD/.pkgauto#" pkgauto.mk > .omnia-sdk/include/pkgauto.mk
+[ -d .turris-sdk ] && sed "s#%PKGAUTO%#$PWD/.pkgauto#" pkgauto.mk > .turris-sdk/include/pkgauto.mk
if [ -f CONFIG ]; then
echo -e "\e[1;34mApply CONFIG\e[0m"
diff --git a/pkgauto.mk b/pkgauto.mk
index 8bd0386..b433ea0 100644
--- a/pkgauto.mk
+++ b/pkgauto.mk
@@ -11,7 +11,7 @@ ifndef PKG_SOURCE_BRANCH
$(error You have to define PKG_SOURCE_BRANCH before pkgauto.mk include)
endif
-TMP_REPO_PATH=/tmp/myrepo_$(PKG_NAME)
+TMP_REPO_PATH=/%PKGAUTO%/myrepo_$(PKG_NAME)
GIT_ARGS=--git-dir='$(TMP_REPO_PATH)' --bare
@@ -25,7 +25,15 @@ $(shell \
PKG_SOURCE_VERSION:=$(shell git $(GIT_ARGS) rev-parse $(PKG_SOURCE_BRANCH))
PKG_VERSION:=$(shell git $(GIT_ARGS) describe --abbrev=0 --tags $(PKG_SOURCE_BRANCH) | sed 's/^v//')
+
+ifeq ($(PKG_VERSION),)
+# No version found so we use 9999 instead and count commits since initial commit.
+PKG_VERSION:=9999
+PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count $(PKG_SOURCE_VERSION))
+else
PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count v$(PKG_VERSION)..$(PKG_SOURCE_VERSION))
+PKG_VERSION:=$(PKG_VERSION).9999
+endif
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)