diff options
author | Karel Kočí <cynerd@email.cz> | 2018-02-01 22:22:55 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-02-01 22:22:55 +0100 |
commit | 453bf5553b1bdbc74640784a3fc9ee8f0835481e (patch) | |
tree | b69764d946e276d91f4a399e0642c7202bbac15d /pkgauto.mk | |
parent | c6bed5cb193a7d42834cedee12fe6ee559f17620 (diff) | |
download | turris-myrepo-453bf5553b1bdbc74640784a3fc9ee8f0835481e.tar.gz turris-myrepo-453bf5553b1bdbc74640784a3fc9ee8f0835481e.tar.bz2 turris-myrepo-453bf5553b1bdbc74640784a3fc9ee8f0835481e.zip |
Implement and use universal pkgauto instead of updater-ng-auto
Diffstat (limited to 'pkgauto.mk')
-rw-r--r-- | pkgauto.mk | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgauto.mk b/pkgauto.mk new file mode 100644 index 0000000..8bd0386 --- /dev/null +++ b/pkgauto.mk @@ -0,0 +1,35 @@ +ifneq ($(PKG_SOURCE_PROTO),git) +$(error Only supported protocol is git) +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 +ifndef PKG_SOURCE_BRANCH +$(error You have to define PKG_SOURCE_BRANCH before pkgauto.mk include) +endif + +TMP_REPO_PATH=/tmp/myrepo_$(PKG_NAME) + +GIT_ARGS=--git-dir='$(TMP_REPO_PATH)' --bare + +$(shell \ + if [ ! -d "$(TMP_REPO_PATH)" ]; then \ + git clone --bare "$(PKG_SOURCE_URL)" "$(TMP_REPO_PATH)"; \ + else \ + git $(GIT_ARGS) fetch "$(PKG_SOURCE_URL)"; \ + fi \ +) + +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//') +PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count v$(PKG_VERSION)..$(PKG_SOURCE_VERSION)) + +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) + +# TODO drop TMP_REPO_PATH $GIT_ARGS |