From d00b9ca1e1664fb9f708001e58a5adcf309fa888 Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Mon, 16 Oct 2017 21:43:15 +0200 Subject: [PATCH] CI: Import Alpine package backport for leveldb-1.18 --- scripts/Dockerfile.alpine.in | 14 ++++++++++---- scripts/Dockerfile.minimal.in | 19 ++++++++++++++++--- scripts/leveldb-1.18.APKBUILD | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 scripts/leveldb-1.18.APKBUILD diff --git a/scripts/Dockerfile.alpine.in b/scripts/Dockerfile.alpine.in index 51087d4f3..4ff29c838 100644 --- a/scripts/Dockerfile.alpine.in +++ b/scripts/Dockerfile.alpine.in @@ -3,15 +3,14 @@ FROM alpine:$alpine_version RUN apk update && apk upgrade && \ - apk add alpine-sdk openssh bash nano ncurses-dev rsync xz m4 \ + apk add build-base snappy-dev abuild \ + alpine-sdk openssh bash nano ncurses-dev rsync xz m4 \ opam aspcud \ gmp-dev libev-dev libressl-dev linux-headers pcre-dev perl zlib-dev \ libsodium-dev snappy-dev && \ - apk add leveldb-dev \ - --update-cache \ - --repository http://nl.alpinelinux.org/alpine/edge/testing && \ rm -f /var/cache/apk/* && \ adduser -S opam && \ + adduser opam abuild && \ echo 'opam ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/opam && \ chmod 440 /etc/sudoers.d/opam && \ chown root:root /etc/sudoers.d/opam && \ @@ -21,6 +20,13 @@ USER opam WORKDIR /home/opam +COPY scripts/leveldb-1.18.APKBUILD /home/opam/leveldb-1.18/APKBUILD +RUN sudo chown -R opam leveldb-1.18 + +RUN abuild-keygen -a && \ + cd leveldb-1.18 && \ + abuild checksum && abuild -r + RUN mkdir .ssh && \ chmod 700 .ssh && \ git config --global user.email "docker@example.com" && \ diff --git a/scripts/Dockerfile.minimal.in b/scripts/Dockerfile.minimal.in index a8dce42bf..7938f97e3 100644 --- a/scripts/Dockerfile.minimal.in +++ b/scripts/Dockerfile.minimal.in @@ -3,22 +3,35 @@ FROM alpine:$alpine_version LABEL distro_style="apk" distro="alpine" distro_long="alpine-$alpine_version" arch="x86_64" operatingsystem="linux" RUN adduser -S tezos && \ + adduser tezos abuild && \ apk update && \ apk upgrade && \ apk add sudo bash libssl1.0 libsodium libev gmp git snappy && \ - apk add leveldb \ - --update-cache \ - --repository http://nl.alpinelinux.org/alpine/edge/testing && \ rm -f /var/cache/apk/* && \ echo 'tezos ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/tezos && \ chmod 440 /etc/sudoers.d/tezos && \ chown root:root /etc/sudoers.d/tezos && \ sed -i 's/^Defaults.*requiretty//g' /etc/sudoers + USER tezos COPY . /home/tezos + WORKDIR /home/tezos +RUN sudo apk update && \ + sudo apk add abuild build-base snappy-dev && \ + abuild-keygen -ai && \ + mkdir leveldb-1.18 && \ + cp scripts/leveldb-1.18.APKBUILD leveldb-1.18/APKBUILD && \ + cd leveldb-1.18 && \ + abuild checksum && abuild -r && \ + cd .. && \ + sudo apk del build-base snappy-dev abuild && \ + sudo apk add packages/tezos/x86_64/leveldb-1.18-r0.apk && \ + rm -rf leveldb-1.18 packages && \ + sudo rm -f /var/cache/apk/* + RUN sudo chown root:root bin/* && \ sudo chmod a+rx bin/* && \ sudo mv bin/* /usr/local/bin && \ diff --git a/scripts/leveldb-1.18.APKBUILD b/scripts/leveldb-1.18.APKBUILD new file mode 100644 index 000000000..bb52b3b92 --- /dev/null +++ b/scripts/leveldb-1.18.APKBUILD @@ -0,0 +1,35 @@ +# Contributor: Natanael Copa +# Maintainer: +pkgname=leveldb +pkgver=1.18 +pkgrel=0 +pkgdesc="A fast and lightweight key/value database library by Google" +url="https://github.com/google/leveldb" +arch="all" +license="BSD" +depends="" +depends_dev="" +makedepends="$depends_dev snappy-dev" +install="" +subpackages="$pkgname-dev $pkgname-doc" +source="$pkgname-$pkgver.tar.gz::https://github.com/google/$pkgname/archive/v$pkgver.tar.gz" + +_builddir="$srcdir"/leveldb-$pkgver + +build() { + cd "$_builddir" + make || return 1 +} + +package() { + cd "$_builddir" + mkdir -p "$pkgdir"/usr/lib "$pkgdir"/usr/share/doc + cp -a lib*.so* "$pkgdir"/usr/lib || return 1 + cp -a include "$pkgdir"/usr/ || return 1 + cp -a doc "$pkgdir"/usr/share/doc/$pkgname || return 1 + +} + +md5sums="73770de34a2a5ab34498d2e05b2b7fa0 leveldb-1.18.tar.gz" +sha256sums="4aa1a7479bc567b95a59ac6fb79eba49f61884d6fd400f20b7af147d54c5cee5 leveldb-1.18.tar.gz" +sha512sums="3d9c55a7bf8692914784ec33c273704ce9978496b071c7b661708f049d0d4ccd51a44441f50c3e536725caeb9896575192f52708a4bb1c0222cecdeec89919a3 leveldb-1.18.tar.gz"