aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-02-02 00:19:05 +0100
committerKarel Kočí <cynerd@email.cz>2018-02-02 00:19:05 +0100
commit39fc564b94530c84697c7324f50d6c16316fd18f (patch)
tree8c350a025335d9eab7e4e68413f019bb4f667db5
parent6ae254e743716617a60dd4236323f50dff523b0f (diff)
downloadturris-myrepo-39fc564b94530c84697c7324f50d6c16316fd18f.tar.gz
turris-myrepo-39fc564b94530c84697c7324f50d6c16316fd18f.tar.bz2
turris-myrepo-39fc564b94530c84697c7324f50d6c16316fd18f.zip
Change little bit how build_repo.sh works
-rw-r--r--.gitignore1
-rwxr-xr-xbuild_repo.sh85
-rw-r--r--pkgauto.mk43
3 files changed, 65 insertions, 64 deletions
diff --git a/.gitignore b/.gitignore
index 7ae3050..5097ae3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.*
!.gitignore
+repo
deactivated
diff --git a/build_repo.sh b/build_repo.sh
index 45c83dc..c0c972a 100755
--- a/build_repo.sh
+++ b/build_repo.sh
@@ -1,8 +1,7 @@
#!/bin/sh
set -e
-#set -x
-cd `dirname $0`
+# TODO add some help and some argumenst parsing
BOARD=omnia
if [ "$1" = "omnia" ] || [ "$1" = "turris" ] || [ "$1" = "all" ]; then
@@ -10,7 +9,7 @@ if [ "$1" = "omnia" ] || [ "$1" = "turris" ] || [ "$1" = "all" ]; then
shift
fi
-# remove previous build
+# remove previous builds
rm -rf .omnia-sdk
rm -rf .turris-sdk
@@ -27,6 +26,7 @@ pull_sdk() {
rsync -aW --inplace --delete .$1-sdk-clean/ .$1-sdk/
}
+# TODO these links won't be valid for ever
if [ "$BOARD" = "omnia" ] || [ "$BOARD" = "all" ]; then
pull_sdk omnia "https://repo.turris.cz/omnia/OpenWrt-SDK-mvebu_gcc-4.8-linaro_musl-1.1.15_eabi.Linux-x86_64.tar.bz2"
fi
@@ -43,9 +43,58 @@ for d in *; do
[ -d .turris-sdk ] && cp -r $d .turris-sdk/package/
done
-# Deploy pkgauto.mk
-[ -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
+
+deploy_pkgauto() {
+ cat >"$1/include/pkgauto.mk" <<EOF
+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=.$PWD/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//')
+
+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)
+PKG_BUILD_DIR:=\$(BUILD_DIR)/\$(PKG_NAME)
+HOST_BUILD_DIR:=\$(BUILD_DIR_HOST)/\$(PKG_NAME)
+
+# TODO drop TMP_REPO_PATH and GIT_ARGS
+EOF
+}
+
+[ -d .omnia-sdk ] && deploy_pkgauto .omnia-sdk
+[ -d .turris-sdk ] && deploy_pkgauto .turris-sdk
+
if [ -f CONFIG ]; then
echo -e "\e[1;34mApply CONFIG\e[0m"
@@ -64,24 +113,18 @@ if [ "$BOARD" = "turris" ] || [ "$BOARD" = "all" ]; then
(cd .turris-sdk; make $@)
fi
-deploy() {
- local TARGET="cynerd.cz:/var/www/myrepo"
- ssh cynerd.cz -- mkdir -p "/var/www/myrepo/$1" # Make sure that directory exists
- echo -e "\e[1;34mSign and deploy $1\e[0m"
- SEC=key.sec
- pushd .$1-sdk
- staging_dir/host/bin/usign -S -s ../$SEC -m bin/$2/packages/base/Packages
- scp bin/$2/packages/base/* "$TARGET/$1/"
- popd
- .$1-sdk/staging_dir/host/bin/usign -S -s $SEC -m $1.lua
- scp $1.lua "$TARGET/$1.lua"
- scp $1.lua.sig "$TARGET/$1.lua.sig"
- rm $1.lua.sig
+
+pull_out() {
+ echo -e "\e[1;34mMove and sign $1\e[0m"
+ [ -d repo/$1 ] || rm -rf repo/$1
+ mkdir -p repo
+ cp -r .$1-sdk/bin/$2/packages/base ./repo/$1
+ ./.$1-sdk/staging_dir/host/bin/usign -S -s key.sec -m "repo/$1/Packages"
}
if [ "$BOARD" = "omnia" ] || [ "$BOARD" = "all" ]; then
- deploy omnia mvebu-musl
+ pull_out omnia mvebu-musl
fi
if [ "$BOARD" = "turris" ] || [ "$BOARD" = "all" ]; then
- deploy turris mpc85xx
+ pull_out turris mpc85xx
fi
diff --git a/pkgauto.mk b/pkgauto.mk
deleted file mode 100644
index b433ea0..0000000
--- a/pkgauto.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-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=/%PKGAUTO%/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//')
-
-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)
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)
-
-# TODO drop TMP_REPO_PATH $GIT_ARGS