From 4b74c1b39cbddb07fba9d8556faead521240818c Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 23 Jul 2018 17:23:46 +0200 Subject: [PATCH] build: Support docker to build binary package Usage: curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x - ls tmp/out/node-sqlite3/stage/sqlite3/*/node-*-*-* Or run.sh can be run in sources Change-Id: I79000463955d16eec8809c870f7d02c60da53432 Bug: https://github.com/mapbox/node-sqlite3/issues/418 Forwarded: https://github.com/mapbox/node-sqlite3/pull/1028 Origin: https://github.com/tizenteam/node-sqlite3 Signed-off-by: Philippe Coval --- Dockerfile | 7 +++ run.sh | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100755 run.sh diff --git a/Dockerfile b/Dockerfile index c14d98946..78bf2b016 100755 --- a/Dockerfile +++ b/Dockerfile @@ -74,3 +74,10 @@ RUN echo "#log: ${project}: Building sources" \ && find build/stage/ -type f \ && sync +WORKDIR /usr/local/${project}/${project} +RUN echo "#log: ${project}: Installing sources" \ + && set -x \ + && install -d /usr/local/src/${project}/ \ + && install *.tgz /usr/local/src/${project}/ \ + && cp -rfva ./build/stage/ /usr/local/src/${project}/ \ + && sync diff --git a/run.sh b/run.sh new file mode 100755 index 000000000..b1bba9bcd --- /dev/null +++ b/run.sh @@ -0,0 +1,167 @@ +#!/bin/bash +# -*- coding: utf-8 -*- +#{ +# ISC License +# Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") +# Copyright (c) 1995-2003 by Internet Software Consortium +# Permission to use, copy, modify, and /or distribute this software +# for any purpose with or without fee is hereby granted, +# provided that the above copyright notice +# and this permission notice appear in all copies. +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS. +# IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, +# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, +# NEGLIGENCE OR OTHER TORTIOUS ACTION, +# ARISING OUT OF OR IN CONNECTION WITH THE USE +# OR PERFORMANCE OF THIS SOFTWARE. +#} + +set -e +set -x + +env_() +{ + project="node-sqlite3" + org="tizenteam" + branch="master" + url_suffix="#{branch}" + + # user="rzr" # Update here if forking + # org="TizenTeam" + # branch="sandbox/${user}/${branch}" + # url_suffix="#{branch}" + url_suffix="" # TODO: For older docker + + url="https://github.com/${org}/${project}.git${url_suffix}" + run_url="https://github.com/raw/${org}/${project}/${branch}/run.sh" + + release="0.0.0" + src=false + if [ -d '.git' ] && which git > /dev/null 2>&1 ; then + src=true + branch=$(git rev-parse --abbrev-ref HEAD) ||: + release=$(git describe --tags || echo "$release") + fi + + SELF="$0" + [ "$SELF" != "$SHELL" ] || SELF="${PWD}/run.sh" + [ "$SELF" != "/bin/bash" ] || SELF="${DASH_SOURCE}" + [ "$SELF" != "/bin/bash" ] || SELF="${BASH_SOURCE}" + self_basename=$(basename -- "${SELF}") +} + + +usage_() +{ + cat< /dev/null 2>&1 ||: + docker create --name "${container}" "${tag}" /bin/true + rm -rf "${outdir}" + mkdir -p "${outdir}" + docker cp "${container}:${dir}" "${outdir}" + echo "Check Ouput files in:" + ls "${outdir}/"* + find "${outdir}" -type f -a -iname "*.tgz" -o -iname "*.tar.*" +} + + +test_() +{ + curl -sL "${run_url}" | bash - +} + + +main_() +{ + env_ "$@" + usage_ "$@" + prep_ "$@" + build_ "$@" +} + + +main_ "$@"