diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-05-07 00:13:44 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-05-07 00:13:44 +0200 |
commit | 9543748bda8bfcad015243a9d312cf203431b29f (patch) | |
tree | 29455f665fe933cd76ac6c1c90b9916898f9050d | |
parent | 0a7f6a2659b363e1d68202b9fd863b57f7420f4f (diff) | |
download | blogc-9543748bda8bfcad015243a9d312cf203431b29f.tar.gz blogc-9543748bda8bfcad015243a9d312cf203431b29f.tar.bz2 blogc-9543748bda8bfcad015243a9d312cf203431b29f.zip |
build: use yatr
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | .travis.yml | 75 | ||||
-rw-r--r-- | .travis/targets/clang-analyzer.sh | 42 | ||||
-rw-r--r-- | .travis/targets/dist-srpm.sh | 9 | ||||
-rw-r--r-- | .travis/targets/distcheck.sh | 9 | ||||
-rw-r--r-- | .travis/targets/make-embedded.sh | 5 | ||||
-rw-r--r-- | .travis/targets/static.sh | 32 | ||||
-rw-r--r-- | .travis/targets/valgrind.sh | 5 | ||||
-rw-r--r-- | .travis/targets/win32.sh | 30 | ||||
-rw-r--r-- | .travis/targets/win64.sh | 30 | ||||
-rwxr-xr-x | .travis/test-run.sh | 120 | ||||
-rw-r--r-- | .yatr.yml | 57 | ||||
-rwxr-xr-x | build-aux/build-static.sh | 22 | ||||
-rwxr-xr-x | build-aux/build-windows.sh | 18 | ||||
-rwxr-xr-x | build-aux/check-make-embedded.sh | 5 | ||||
-rwxr-xr-x | build-aux/clang-analyzer.sh | 30 |
16 files changed, 148 insertions, 347 deletions
@@ -32,10 +32,10 @@ Makefile.in /stamp-h1 .dirstamp /build-aux/* +!/build-aux/build-*.sh +!/build-aux/check-make-embedded.sh +!/build-aux/clang-analyzer.sh !/build-aux/git-version-gen -!/build-aux/travis-build.sh -!/build-aux/travis-build-github-lambda.sh -!/build-aux/travis-deploy.sh !/build-aux/valgrind.sh # installed .m4 files diff --git a/.travis.yml b/.travis.yml index 7f574c9..c503bc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,97 +1,53 @@ sudo: required language: c +addons: + apt: + packages: + - gcc-mingw-w64-i686 + - gcc-mingw-w64-x86-64 + - libcmocka-dev + - rpm + - valgrind + matrix: include: - compiler: gcc env: - TARGET=distcheck - addons: - apt: - packages: - - realpath - - libcmocka-dev - compiler: clang env: - TARGET=distcheck - addons: - apt: - packages: - - realpath - - libcmocka-dev + - DISABLE_PUBLISHER=1 - os: osx compiler: clang env: - TARGET=distcheck + - DISABLE_PUBLISHER=1 - compiler: gcc env: - TARGET=valgrind - addons: - apt: - packages: - - realpath - - libcmocka-dev - - valgrind - compiler: clang env: - TARGET=valgrind - addons: - apt: - packages: - - realpath - - libcmocka-dev - - valgrind - compiler: clang env: - TARGET=clang-analyzer - addons: - apt: - packages: - - realpath - - libcmocka-dev - compiler: gcc env: - TARGET=dist-srpm - addons: - apt: - packages: - - realpath - - libcmocka-dev - - rpm - compiler: gcc env: - TARGET=static - addons: - apt: - packages: - - realpath - - libcmocka-dev - compiler: gcc env: - - TARGET=make-embedded - addons: - apt: - packages: - - realpath - - libcmocka-dev + - TARGET=check-make-embedded - compiler: gcc env: - TARGET=win32 - addons: - apt: - packages: - - realpath - - libcmocka-dev - - gcc-mingw-w64-i686 - compiler: gcc env: - TARGET=win64 - addons: - apt: - packages: - - realpath - - libcmocka-dev - - gcc-mingw-w64-x86-64 install: - gem install ronn @@ -99,9 +55,4 @@ install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmocka; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install xz; fi -before_script: - - git fetch --unshallow - - ./autogen.sh - -script: - - ./.travis/test-run.sh +script: curl -sSf https://yatr.rgm.io/run.sh | bash diff --git a/.travis/targets/clang-analyzer.sh b/.travis/targets/clang-analyzer.sh deleted file mode 100644 index 31cd522..0000000 --- a/.travis/targets/clang-analyzer.sh +++ /dev/null @@ -1,42 +0,0 @@ -build() { - default_configure \ - --enable-silent-rules \ - --disable-tests - - local pn="$(grep PACKAGE_TARNAME config.h | cut -d\" -f2)" - local pv="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" - local p="${pn}-clang-analyzer-${pv}" - - set +e - scan-build \ - --use-cc="${CC}" \ - -o reports \ - make - local rv=$? - set -e - - local num_reports=$(ls -1 reports | wc -l) - [[ ${num_reports} -eq 0 ]] && return ${rv} - [[ ${num_reports} -eq 1 ]] - - local reports="reports/$(ls -1 reports)" - - if [[ -d "${reports}" ]]; then - mv "${reports}" clang-analyzer - tar \ - -cvJf "${p}.tar.xz" \ - clang-analyzer - rv=1 - fi - - return ${rv} -} - -deploy() { - FILES=( *.tar.xz ) - [[ ${RV} -ne 0 ]] && [[ "x${CC}" = "xclang" ]] -} - -extract() { - grep . -} diff --git a/.travis/targets/dist-srpm.sh b/.travis/targets/dist-srpm.sh deleted file mode 100644 index aa4e9e8..0000000 --- a/.travis/targets/dist-srpm.sh +++ /dev/null @@ -1,9 +0,0 @@ -build() { - default_configure - make dist-srpm -} - -deploy() { - FILES=( *.src.rpm ) - [[ ${RV} -eq 0 ]] && [[ "x${CC}" = "xgcc" ]] -} diff --git a/.travis/targets/distcheck.sh b/.travis/targets/distcheck.sh deleted file mode 100644 index e1cd9c5..0000000 --- a/.travis/targets/distcheck.sh +++ /dev/null @@ -1,9 +0,0 @@ -build() { - default_configure - make distcheck -} - -deploy() { - FILES=( *.{*.tar.{gz,bz2,xz},zip} ) - [[ ${RV} -eq 0 ]] && [[ "x${CC}" = "xgcc" ]] -} diff --git a/.travis/targets/make-embedded.sh b/.travis/targets/make-embedded.sh deleted file mode 100644 index d83c88a..0000000 --- a/.travis/targets/make-embedded.sh +++ /dev/null @@ -1,5 +0,0 @@ -build() { - default_configure \ - --enable-make-embedded - make check -} diff --git a/.travis/targets/static.sh b/.travis/targets/static.sh deleted file mode 100644 index d252860..0000000 --- a/.travis/targets/static.sh +++ /dev/null @@ -1,32 +0,0 @@ -build() { - default_configure \ - CFLAGS="-Wall -g -O2" \ - --disable-tests \ - --disable-git-receiver \ - --disable-runserver \ - --enable-make-embedded - - make LDFLAGS="-all-static" blogc - - rm -rf root - mkdir -p root - - local pv="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" - - install -m 755 blogc root/blogc - install -m 644 src/blogc-github-lambda/lambda_function.py root/lambda_function.py - install -m 644 ../LICENSE root/LICENSE - strip root/blogc - - pushd root > /dev/null - zip "../blogc-github-lambda-${pv}.zip" * - popd > /dev/null - - install -m 755 root/blogc "blogc-static-amd64-${pv}" - xz -z "blogc-static-amd64-${pv}" -} - -deploy() { - FILES=( *.zip blogc-static-*.xz ) - [[ ${RV} -eq 0 ]] && [[ "x${CC}" = "xgcc" ]] -} diff --git a/.travis/targets/valgrind.sh b/.travis/targets/valgrind.sh deleted file mode 100644 index 55d3faa..0000000 --- a/.travis/targets/valgrind.sh +++ /dev/null @@ -1,5 +0,0 @@ -build() { - default_configure \ - --enable-valgrind - make valgrind -} diff --git a/.travis/targets/win32.sh b/.travis/targets/win32.sh deleted file mode 100644 index 1a6745f..0000000 --- a/.travis/targets/win32.sh +++ /dev/null @@ -1,30 +0,0 @@ -build() { - default_configure \ - CC= \ - CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" \ - --host=i686-w64-mingw32 \ - --target=i686-w64-mingw32 \ - --disable-tests \ - --disable-git-receiver \ - --disable-make \ - --disable-runserver - make blogc.exe - - local pn="$(grep PACKAGE_TARNAME config.h | cut -d\" -f2)" - local pv="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" - local dest_dir="${pn}-${pv}-${TARGET}" - - rm -rf "${dest_dir}" - mkdir -p "${dest_dir}" - - cp .libs/blogc.exe "${dest_dir}/" - cp ../LICENSE "${dest_dir}/" - cp ../README.md "${dest_dir}/" - - zip "${dest_dir}.zip" "${dest_dir}"/* -} - -deploy() { - FILES=( *.zip ) - [[ ${RV} -eq 0 ]] && [[ "x${CC}" = "xgcc" ]] -} diff --git a/.travis/targets/win64.sh b/.travis/targets/win64.sh deleted file mode 100644 index c9fed2c..0000000 --- a/.travis/targets/win64.sh +++ /dev/null @@ -1,30 +0,0 @@ -build() { - default_configure \ - CC= \ - CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" \ - --host=x86_64-w64-mingw32 \ - --target=x86_64-w64-mingw32 \ - --disable-tests \ - --disable-git-receiver \ - --disable-make \ - --disable-runserver - make blogc.exe - - local pn="$(grep PACKAGE_TARNAME config.h | cut -d\" -f2)" - local pv="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" - local dest_dir="${pn}-${pv}-${TARGET}" - - rm -rf "${dest_dir}" - mkdir -p "${dest_dir}" - - cp .libs/blogc.exe "${dest_dir}/" - cp ../LICENSE "${dest_dir}/" - cp ../README.md "${dest_dir}/" - - zip "${dest_dir}.zip" "${dest_dir}"/* -} - -deploy() { - FILES=( *.zip ) - [[ ${RV} -eq 0 ]] && [[ "x${CC}" = "xgcc" ]] -} diff --git a/.travis/test-run.sh b/.travis/test-run.sh deleted file mode 100755 index a723f41..0000000 --- a/.travis/test-run.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash - -set -e - -REALPATH=grealpath -if ! command -v grealpath >/dev/null 2>&1; then - REALPATH=realpath -fi - -SCRIPT_DIR="$(dirname "$("${REALPATH}" "${BASH_SOURCE[0]}")")" -TARGET_SCRIPT="${SCRIPT_DIR}/targets/${TARGET}.sh" - -if [[ -n "${TARGET}" ]] && [[ -e "${TARGET_SCRIPT}" ]]; then - source "${TARGET_SCRIPT}" -else - echo "Target not defined or invalid!" - exit 1 -fi - -set -x - -BUILD=0 -[[ "x$(type -t build)" = "xfunction" ]] && BUILD=1 - -DEPLOY=0 -[[ "x$(type -t deploy)" = "xfunction" ]] && DEPLOY=1 - -EXTRACT=0 -[[ "x$(type -t extract)" = "xfunction" ]] && EXTRACT=1 - -SOURCE_DIR="$(dirname "${SCRIPT_DIR}")" -BUILD_DIR="${SOURCE_DIR}/build" - -default_configure() { - pushd "${BUILD_DIR}" > /dev/null - "${SOURCE_DIR}/configure" \ - CFLAGS="-Wall -g -O0" \ - --disable-silent-rules \ - --disable-valgrind \ - --enable-ronn \ - --enable-tests \ - --enable-git-receiver \ - --enable-make \ - --enable-runserver \ - "$@" - popd > /dev/null -} - -rm -rf "${BUILD_DIR}" -mkdir -p "${BUILD_DIR}" - -RV=0 - -if [[ ${BUILD} -eq 1 ]]; then - pushd "${BUILD_DIR}" > /dev/null - build || RV=1 - popd > /dev/null -fi - -[[ ${DEPLOY} -eq 1 ]] || exit ${RV} - -[[ "x${TRAVIS_PULL_REQUEST}" != "xfalse" ]] && exit ${RV} -[[ "x${TRAVIS_BRANCH}" != "xmaster" ]] && [[ "x${TRAVIS_TAG}" != xv* ]] && exit ${RV} - -[[ -d "${BUILD_DIR}" ]] || exit ${RV} - -FILES= -pushd "${BUILD_DIR}" > /dev/null -deploy || exit ${RV} -popd > /dev/null - -set +x - -PN="$(grep PACKAGE_TARNAME "${BUILD_DIR}/config.h" | cut -d\" -f2)" -PV="$(grep PACKAGE_VERSION "${BUILD_DIR}/config.h" | cut -d\" -f2)" - -do_sha512() { - pushd "$(dirname ${1})" > /dev/null - sha512sum "$(basename ${1})" - popd > /dev/null -} - -do_extract_flag() { - [[ ${EXTRACT} -eq 0 ]] && echo false && return 0 - basename "${1}" | extract &> /dev/null && echo true || echo false -} - -do_curl() { - curl \ - --silent \ - --form "project=${PN}" \ - --form "version=${PV}" \ - --form "file=@${1}" \ - --form "sha512=$(do_sha512 ${1})" \ - --form "extract=$(do_extract_flag ${1})" \ - "${DISTFILES_URL}" \ - &> /dev/null # make sure that we don't leak tokens -} - -echo -echo " * Found files:" -for f in "${FILES[@]}"; do - echo " ${f}" -done -echo - -for f in "${FILES[@]}"; do - echo " * Processing file: $(basename ${f}):" - - echo -n " Uploading file ... " - if do_curl "${BUILD_DIR}/${f}"; then - echo "done" - else - echo "fail" - fi - - echo -done - -exit ${RV} diff --git a/.yatr.yml b/.yatr.yml new file mode 100644 index 0000000..8f7e359 --- /dev/null +++ b/.yatr.yml @@ -0,0 +1,57 @@ +default_configure_args: + - "CFLAGS=-Wall -g -O0" + - --disable-silent-rules + - --disable-valgrind + - --enable-ronn + - --enable-tests + - --enable-git-receiver + - --enable-make + - --enable-runserver + +targets: + dist-srpm: + archive_filter: "*.src.rpm" + clang-analyzer: + configure_args: + - --enable-silent-rules + task_script: build-aux/clang-analyzer.sh + archive_extract_filter: "*.tar.xz" + valgrind: + configure_args: + - --enable-valgrind + check-make-embedded: + configure_args: + - --disable-git-receiver + - --disable-runserver + - --enable-make-embedded + task_script: build-aux/check-make-embedded.sh + static: + configure_args: + - "CFLAGS=-Wall -g -O2" + - --disable-tests + - --disable-git-receiver + - --disable-runserver + - --enable-make-embedded + task_script: build-aux/build-static.sh + win32: + configure_args: + - CC= + - "CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" + - --host=i686-w64-mingw32 + - --target=i686-w64-mingw32 + - --disable-tests + - --disable-git-receiver + - --disable-make + - --disable-runserver + task_script: build-aux/build-windows.sh + win64: + configure_args: + - CC= + - "CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" + - --host=x86_64-w64-mingw32 + - --target=x86_64-w64-mingw32 + - --disable-tests + - --disable-git-receiver + - --disable-make + - --disable-runserver + task_script: build-aux/build-windows.sh diff --git a/build-aux/build-static.sh b/build-aux/build-static.sh new file mode 100755 index 0000000..39d6444 --- /dev/null +++ b/build-aux/build-static.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -ex + +PV="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" + +${MAKE_CMD:-make} LDFLAGS="-all-static" blogc + +rm -rf root +mkdir -p root + +install -m 755 blogc root/blogc +install -m 644 src/blogc-github-lambda/lambda_function.py root/lambda_function.py +install -m 644 ../LICENSE root/LICENSE +strip root/blogc + +pushd root > /dev/null +zip "../blogc-github-lambda-${PV}.zip" * +popd > /dev/null + +install -m 755 root/blogc "blogc-static-amd64-${PV}" +xz -z "blogc-static-amd64-${PV}" diff --git a/build-aux/build-windows.sh b/build-aux/build-windows.sh new file mode 100755 index 0000000..3ed6b59 --- /dev/null +++ b/build-aux/build-windows.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -ex + +PN="$(grep PACKAGE_TARNAME config.h | cut -d\" -f2)" +PV="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" +DEST_DIR="${PN}-${TARGET}-${PV}" + +${MAKE_CMD:-make} blogc.exe + +rm -rf "${DEST_DIR}" +mkdir -p "${DEST_DIR}" + +cp .libs/blogc.exe "${DEST_DIR}/" +cp ../LICENSE "${DEST_DIR}/" +cp ../README.md "${DEST_DIR}/" + +zip "${DEST_DIR}.zip" "${DEST_DIR}"/* diff --git a/build-aux/check-make-embedded.sh b/build-aux/check-make-embedded.sh new file mode 100755 index 0000000..d2e5fe4 --- /dev/null +++ b/build-aux/check-make-embedded.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -ex + +${MAKE_CMD:-make} check diff --git a/build-aux/clang-analyzer.sh b/build-aux/clang-analyzer.sh new file mode 100755 index 0000000..1582b10 --- /dev/null +++ b/build-aux/clang-analyzer.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -ex + +PN="$(grep PACKAGE_TARNAME config.h | cut -d\" -f2)" +PV="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" +P="${PN}-clang-analyzer-${PV}" + +set +e +scan-build \ + --use-cc="${CC:-clang}" \ + -o reports \ + ${MAKE_CMD:-make} +RV=$? +set -e + +NUM_REPORTS=$(ls -1 reports | wc -l) +[[ ${NUM_REPORTS} -eq 0 ]] && exit ${RV} +[[ ${NUM_REPORTS} -eq 1 ]] + +REPORTS="reports/$(ls -1 reports)" +if [[ -d "${REPORTS}" ]]; then + mv "${REPORTS}" clang-analyzer + tar \ + -cvJf "${P}.tar.xz" \ + clang-analyzer + RV=1 +fi + +exit ${RV} |