Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

def name = 'sovrin'

def buildDebUbuntu = { repoName, releaseVersion, sourcePath ->
def volumeName = "sovrin-deb-u1604"
sh "docker volume rm -f $volumeName"
dir('build-scripts/ubuntu-1604') {
sh "./build-sovrin-docker.sh $sourcePath"
}
return "$volumeName"
}

options = new TestAndPublishOptions()
options.enable([StagesEnum.PACK_RELEASE_DEPS, StagesEnum.PACK_RELEASE_ST_DEPS])
testAndPublish(name, [ubuntu: [:]], true, options)
testAndPublish(name, [ubuntu: [:]], true, options, [ubuntu: buildDebUbuntu])
24 changes: 24 additions & 0 deletions build-scripts/ubuntu-1604/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:16.04

RUN apt-get update -y && apt-get install -y \
# common stuff
git \
wget \
unzip \
python3.5 \
python3-pip \
python-setuptools \
python3-venv \
# fmp
ruby \
ruby-dev \
rubygems \
gcc \
make

# install fpm
RUN gem install --no-ri --no-rdoc fpm

WORKDIR /root

ADD . /root
14 changes: 14 additions & 0 deletions build-scripts/ubuntu-1604/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Build a sovrin package using docker

```
./build-sovrin-docker.sh <path-to-sources>
```
Built package is placed in a docker volume `sovrin-deb-u1604`.

### Build a sovrin package

```
./build-sovrin.sh <path to sources> <output-path: default='.'>
```

Built package is placed in the `output-path` folder.
33 changes: 33 additions & 0 deletions build-scripts/ubuntu-1604/build-sovrin-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -x
set -e

PKG_SOURCE_PATH=$1
PKG_NAME=sovrin
OUTPUT_VOLUME_NAME=${PKG_NAME}-deb-u1604
IMAGE_NAME=${PKG_NAME}-build-u1604

if [ -z ${PKG_SOURCE_PATH} ]; then
echo "Usage: $0 path-to-package-sources"
exit 1;
fi

if [ -z $2 ]; then
CMD="/root/build-"${PKG_NAME}".sh /input /output"
else
CMD=$2
fi

docker build -t ${IMAGE_NAME} -f Dockerfile .
docker volume create --name ${OUTPUT_VOLUME_NAME}

docker run \
-i \
--rm \
-v ${PKG_SOURCE_PATH}:/input \
-v ${OUTPUT_VOLUME_NAME}:/output \
-e PKG_NAME=${PKG_NAME} \
${IMAGE_NAME} \
$CMD

26 changes: 26 additions & 0 deletions build-scripts/ubuntu-1604/build-sovrin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -x
set -e

INPUT_PATH=$1
OUTPUT_PATH=${2:-.}

PACKAGE_NAME=sovrin

fpm --input-type "python" \
--output-type "deb" \
--architecture "amd64" \
--verbose \
--python-package-name-prefix "python3" \
--python-bin "/usr/bin/python3" \
--exclude "*.pyc" \
--exclude "*.pyo" \
--maintainer "Sovrin Foundation <repo@sovrin.org>" \
--before-install "preinst" \
--after-install "postinst" \
--before-remove "prerm" \
--no-python-fix-dependencies \
--name ${PACKAGE_NAME} \
--package ${OUTPUT_PATH} \
${INPUT_PATH}
26 changes: 26 additions & 0 deletions build-scripts/ubuntu-1604/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# it should be fixed

# workaround when .sovrin become regular file
if [ -f /home/sovrin/.sovrin ]; then
rm /home/sovrin/.sovrin
fi
mkdir -p /home/sovrin/.sovrin

cp -nr /usr/local/lib/python3.5/dist-packages/sovrin/transactions_local /home/sovrin/.sovrin 2>/dev/null
cp -nr /usr/local/lib/python3.5/dist-packages/sovrin/transactions_sandbox /home/sovrin/.sovrin 2>/dev/null
cp -nr /usr/local/lib/python3.5/dist-packages/sovrin/transactions_live /home/sovrin/.sovrin 2>/dev/null
cp -nr /usr/local/lib/python3.5/dist-packages/sovrin/pool_transactions_local /home/sovrin/.sovrin 2>/dev/null
cp -nr /usr/local/lib/python3.5/dist-packages/sovrin/pool_transactions_sandbox /home/sovrin/.sovrin 2>/dev/null
cp -nr /usr/local/lib/python3.5/dist-packages/sovrin/pool_transactions_live /home/sovrin/.sovrin 2>/dev/null

chown -R sovrin:sovrin /home/sovrin/.sovrin


# Automatically added from template:
if which py3compile >/dev/null 2>&1; then
py3compile -O -p sovrin /usr/local/lib/python3.5/dist-packages/
fi

# End automatically added section
5 changes: 5 additions & 0 deletions build-scripts/ubuntu-1604/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

if ! id -u sovrin > /dev/null 2>&1; then
useradd -r -m -s /bin/bash -U sovrin
fi
5 changes: 5 additions & 0 deletions build-scripts/ubuntu-1604/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Automatically added from template:

dpkg -L sovrin | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)'

# End automatically added section