aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am23
-rwxr-xr-xbuild-aux/travis-build-github-lambda.sh41
-rwxr-xr-xbuild-aux/travis-build.sh13
-rw-r--r--src/blogc-github-lambda/lambda_function.py8
5 files changed, 56 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
index 759ed0c..e4b6874 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ Makefile.in
/build-aux/*
!/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
@@ -94,3 +95,4 @@ blogc-*.rpm
/src/blogc-github-lambda/*.pyo
/build/
+/root/
diff --git a/Makefile.am b/Makefile.am
index 104ec83..ba3f12a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -703,25 +703,4 @@ valgrind: all
endif
-## Helpers: blogc-github-lambda
-
-blogc-github-lambda-$(VERSION).zip: blogc $(top_srcdir)/LICENSE $(top_srcdir)/src/blogc-github-lambda/lambda_function.py
- -rm -f blogc-github-lambda-$(VERSION).zip
- $(MKDIR_P) src/blogc-github-lambda
- $(INSTALL) -m 644 \
- $(top_srcdir)/LICENSE \
- src/blogc-github-lambda/
- $(INSTALL) -m 644 -C \
- $(top_srcdir)/src/blogc-github-lambda/lambda_function.py \
- src/blogc-github-lambda/
- $(INSTALL) -m 755 \
- blogc \
- src/blogc-github-lambda/blogc
- $(STRIP) src/blogc-github-lambda/blogc
- cd src/blogc-github-lambda && \
- zip -rq $(abs_top_builddir)/blogc-github-lambda-$(VERSION).zip LICENSE blogc lambda_function.py
-
-blogc-github-lambda: blogc-github-lambda-$(VERSION).zip
-
-
-.PHONY: dist-srpm valgrind blogc-github-lambda
+.PHONY: dist-srpm valgrind
diff --git a/build-aux/travis-build-github-lambda.sh b/build-aux/travis-build-github-lambda.sh
new file mode 100755
index 0000000..1a41077
--- /dev/null
+++ b/build-aux/travis-build-github-lambda.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+set -ex
+
+PV_DEPS=2
+
+PN_DEPS="blogc-lambda-deps"
+P_DEPS="${PN_DEPS}-${PV_DEPS}"
+A_DEPS="${P_DEPS}.tar.xz"
+SRC_DEPS="https://travis-distfiles.rgm.io/${PN_DEPS}/${P_DEPS}/${P_DEPS}.tar.xz"
+
+rm -rf root build
+mkdir -p root build
+
+wget -c "${SRC_DEPS}" "${SRC_DEPS}.sha512"
+sha512sum -c "${A_DEPS}.sha512"
+tar -xvf "${A_DEPS}" -C root/
+
+pushd build > /dev/null
+../configure \
+ CFLAGS="-Wall -g -O0" \
+ --enable-ronn \
+ --disable-silent-rules \
+ --enable-tests \
+ --enable-valgrind \
+ --enable-git-receiver \
+ --enable-runserver
+popd > /dev/null
+
+make -C build LDFLAGS="-all-static" blogc
+
+PV="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)"
+
+install -m 755 build/blogc root/bin/blogc
+install -m 644 src/blogc-github-lambda/lambda_function.py root/lambda_function.py
+install -m 644 LICENSE root/licenses/blogc
+strip root/bin/blogc
+
+pushd root/ > /dev/null
+zip -rq "../blogc-github-lambda-${PV}.zip" *
+popd > /dev/null
diff --git a/build-aux/travis-build.sh b/build-aux/travis-build.sh
index 9d72839..429622a 100755
--- a/build-aux/travis-build.sh
+++ b/build-aux/travis-build.sh
@@ -2,6 +2,11 @@
set -ex
+if [[ "x${TARGET}" = "xblogc-github-lambda" ]]; then
+ build-aux/travis-build-github-lambda.sh
+ exit $?
+fi
+
rm -rf build
mkdir -p build
@@ -16,10 +21,4 @@ pushd build > /dev/null
--enable-git-receiver \
--enable-runserver
-popd > /dev/null
-
-if [[ "x${TARGET}" = "xblogc-github-lambda" ]]; then
- make -C build LDFLAGS="-all-static" "${TARGET}"
-else
- make -C build "${TARGET}"
-fi
+make -C build "${TARGET}"
diff --git a/src/blogc-github-lambda/lambda_function.py b/src/blogc-github-lambda/lambda_function.py
index 69ad395..9320544 100644
--- a/src/blogc-github-lambda/lambda_function.py
+++ b/src/blogc-github-lambda/lambda_function.py
@@ -23,6 +23,9 @@ import shutil
cwd = os.path.dirname(os.path.abspath(__file__))
+os.environ['PATH'] = '%s:%s' % (os.path.join(cwd, 'bin'),
+ os.environ.get('PATH', ''))
+
GITHUB_AUTH = os.environ.get('GITHUB_AUTH')
if GITHUB_AUTH is not None and ':' not in GITHUB_AUTH:
GITHUB_AUTH = boto3.client('kms').decrypt(
@@ -141,8 +144,9 @@ def lambda_handler(event, context):
repo_name = payload['repository']['name']
repo_full_name = payload['repository']['full_name']
rootdir = get_tarball(repo_full_name)
- rv = subprocess.call(['make', '-C', rootdir, 'OUTPUT_DIR=_build',
- 'BLOGC=%s' % os.path.join(cwd, 'blogc')],
+ rv = subprocess.call([os.path.join(cwd, 'bin', 'make'), '-C', rootdir,
+ 'OUTPUT_DIR=_build',
+ 'BLOGC=%s' % os.path.join(cwd, 'bin', 'blogc')],
stdout=None if debug else subprocess.PIPE,
stderr=None if debug else subprocess.PIPE)
if rv != 0: