From d7b7793976ee2d1fac1763c224edcc7405168c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 30 Aug 2018 11:18:06 +0200 Subject: Move autopkg to package so it is accessible --- autopkg-branch.mk | 24 -------------------- autopkg-common.mk | 36 ------------------------------ autopkg-tag.mk | 8 ------- personal-pkgs-repo/files/autopkg-branch.mk | 24 ++++++++++++++++++++ personal-pkgs-repo/files/autopkg-common.mk | 36 ++++++++++++++++++++++++++++++ personal-pkgs-repo/files/autopkg-tag.mk | 8 +++++++ 6 files changed, 68 insertions(+), 68 deletions(-) delete mode 100644 autopkg-branch.mk delete mode 100644 autopkg-common.mk delete mode 100644 autopkg-tag.mk create mode 100644 personal-pkgs-repo/files/autopkg-branch.mk create mode 100644 personal-pkgs-repo/files/autopkg-common.mk create mode 100644 personal-pkgs-repo/files/autopkg-tag.mk diff --git a/autopkg-branch.mk b/autopkg-branch.mk deleted file mode 100644 index 871cffb..0000000 --- a/autopkg-branch.mk +++ /dev/null @@ -1,24 +0,0 @@ -# Autopkg tracking given branch -AUTOPKG_VARIANT:=branch -$(call include_mk, autopkg-common.mk) - -ifndef PKG_SOURCE_BRANCH -$(error You have to define PKG_SOURCE_BRANCH before pkgauto.mk include) -endif - -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)") - -ifeq ($(PKG_VERSION),) -# Count commits since initial commit. -PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count "$(PKG_SOURCE_VERSION)") -# No previous version found (no tag) so we use 9999 instead -PKG_VERSION:=9999 -else -# Count commits since last version tag -PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count "$(PKG_VERSION)..$(PKG_SOURCE_VERSION)") -# .9999 is appended to not collide with possible existing package versions in repository -PKG_VERSION:=$(PKG_VERSION:v%=%).9999 -endif - -$(eval $(call AUTOPKG_TAIL)) diff --git a/autopkg-common.mk b/autopkg-common.mk deleted file mode 100644 index c539e1a..0000000 --- a/autopkg-common.mk +++ /dev/null @@ -1,36 +0,0 @@ -ifndef AUTOPKG_VARIANT - $(error "Don't include autopkg-common.mk directly!") -endif - -ifndef PKG_NAME -$(error You have to define PKG_NAME before pkgauto.mk include) -endif -ifndef PKG_SOURCE_URL -$(error You have to define PKG_SOURCE_URL before pkgauto.mk include) -endif - -TMP_REPO_PATH=$(DL_DIR)/autopkg/$(PKG_NAME) -GIT_ARGS=--git-dir='$(TMP_REPO_PATH)' --bare - -# Clone/update git history to bare repository -$(shell \ - if [ ! -d "$(TMP_REPO_PATH)" ]; then \ - git clone --mirror "$(PKG_SOURCE_URL)" "$(TMP_REPO_PATH)"; \ - else \ - git $(GIT_ARGS) remote update origin; \ - fi) - - -define AUTOPKG_TAIL - -PKG_SOURCE_PROTO:=git -PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz -PKG_SOURCE_SUBDIR:=$(PKG_NAME) -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME) - -undefine TMP_REPO_PATH -undefine GIT_ARGS -undefine AUTOPKG_TAIL - -endef diff --git a/autopkg-tag.mk b/autopkg-tag.mk deleted file mode 100644 index 6fe08d4..0000000 --- a/autopkg-tag.mk +++ /dev/null @@ -1,8 +0,0 @@ -# Autopkg tracking latest version tag -AUTOPKG_VARIANT:=tag -$(call include_mk, autopkg-common.mk) - -PKG_SOURCE_VERSION:=$(shell git $(GIT_ARGS) tag | grep '^v' | sort | tail -1) -PKG_VERSION:=$(subst v%,%,$(PKG_SOURCE_VERSION)) - -$(eval $(call AUTOPKG_TAIL)) diff --git a/personal-pkgs-repo/files/autopkg-branch.mk b/personal-pkgs-repo/files/autopkg-branch.mk new file mode 100644 index 0000000..871cffb --- /dev/null +++ b/personal-pkgs-repo/files/autopkg-branch.mk @@ -0,0 +1,24 @@ +# Autopkg tracking given branch +AUTOPKG_VARIANT:=branch +$(call include_mk, autopkg-common.mk) + +ifndef PKG_SOURCE_BRANCH +$(error You have to define PKG_SOURCE_BRANCH before pkgauto.mk include) +endif + +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)") + +ifeq ($(PKG_VERSION),) +# Count commits since initial commit. +PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count "$(PKG_SOURCE_VERSION)") +# No previous version found (no tag) so we use 9999 instead +PKG_VERSION:=9999 +else +# Count commits since last version tag +PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count "$(PKG_VERSION)..$(PKG_SOURCE_VERSION)") +# .9999 is appended to not collide with possible existing package versions in repository +PKG_VERSION:=$(PKG_VERSION:v%=%).9999 +endif + +$(eval $(call AUTOPKG_TAIL)) diff --git a/personal-pkgs-repo/files/autopkg-common.mk b/personal-pkgs-repo/files/autopkg-common.mk new file mode 100644 index 0000000..c539e1a --- /dev/null +++ b/personal-pkgs-repo/files/autopkg-common.mk @@ -0,0 +1,36 @@ +ifndef AUTOPKG_VARIANT + $(error "Don't include autopkg-common.mk directly!") +endif + +ifndef PKG_NAME +$(error You have to define PKG_NAME before pkgauto.mk include) +endif +ifndef PKG_SOURCE_URL +$(error You have to define PKG_SOURCE_URL before pkgauto.mk include) +endif + +TMP_REPO_PATH=$(DL_DIR)/autopkg/$(PKG_NAME) +GIT_ARGS=--git-dir='$(TMP_REPO_PATH)' --bare + +# Clone/update git history to bare repository +$(shell \ + if [ ! -d "$(TMP_REPO_PATH)" ]; then \ + git clone --mirror "$(PKG_SOURCE_URL)" "$(TMP_REPO_PATH)"; \ + else \ + git $(GIT_ARGS) remote update origin; \ + fi) + + +define AUTOPKG_TAIL + +PKG_SOURCE_PROTO:=git +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME) + +undefine TMP_REPO_PATH +undefine GIT_ARGS +undefine AUTOPKG_TAIL + +endef diff --git a/personal-pkgs-repo/files/autopkg-tag.mk b/personal-pkgs-repo/files/autopkg-tag.mk new file mode 100644 index 0000000..6fe08d4 --- /dev/null +++ b/personal-pkgs-repo/files/autopkg-tag.mk @@ -0,0 +1,8 @@ +# Autopkg tracking latest version tag +AUTOPKG_VARIANT:=tag +$(call include_mk, autopkg-common.mk) + +PKG_SOURCE_VERSION:=$(shell git $(GIT_ARGS) tag | grep '^v' | sort | tail -1) +PKG_VERSION:=$(subst v%,%,$(PKG_SOURCE_VERSION)) + +$(eval $(call AUTOPKG_TAIL)) -- cgit v1.2.3