Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Create RPM spec #152

Merged
merged 4 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ doc/apidoc
# benchmarks results
bench.*.result.txt

# packpack build directory
/build

# temporary directory for make apidoc-lint
doc/apidoc-lint-tmp
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "test-run"]
path = test-run
url = https://github.com/tarantool/test-run.git
[submodule "3rd_party/packpack"]
path = 3rd_party/packpack
url = https://github.com/packpack/packpack.git
124 changes: 67 additions & 57 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,75 @@
language: c

sudo: true
sudo: required

dist: trusty
services:
- docker

env:
- SHARD_VERSION=1.2 AVRO_SCHEMA=2.3.2
- SHARD_VERSION=2.1 AVRO_SCHEMA=2.3.2
- SHARD_VERSION=1.2 AVRO_SCHEMA=3.0.0
- SHARD_VERSION=2.1 AVRO_SCHEMA=3.0.0

branches:
only:
- master

before_install:
- sudo apt-get -qq update
- curl http://download.tarantool.org/tarantool/1.9/gpgkey |
sudo apt-key add -release=`lsb_release -c -s`
cache:
directories:
- $HOME/.cache
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don’t place anything into .cache explicitly or implicitly, so why? Or docker stores something here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t strongly against, but prefer to understand what and why we have.

Copy link
Contributor

@SudoBobo SudoBobo Jul 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packpack uses it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarification.


# install https download transport for APT
- sudo apt-get -y install apt-transport-https
git:
depth: 100500

# append two lines to a list of source repositories
- sudo rm -f /etc/apt/sources.list.d/*tarantool*.list
- echo "deb http://download.tarantool.org/tarantool/1.9/ubuntu/ trusty main" |
sudo tee /etc/apt/sources.list.d/tarantool_1_9.list
- echo "deb-src http://download.tarantool.org/tarantool/1.9/ubuntu/ trusty main" |
sudo tee -a /etc/apt/sources.list.d/tarantool_1_9.list

install:
- sudo apt-get update
- sudo apt-get -y install tarantool tarantool-dev
- cd ..
- git clone https://github.com/rtsisyk/msgpuck
- cd msgpuck
- cmake .
- sudo make install
- cd ..
- tarantoolctl rocks install shard "${SHARD_VERSION}"
- tarantoolctl rocks install avro-schema "${AVRO_SCHEMA}"
- cd graphql
- git submodule update --recursive --init
- tarantoolctl rocks install lulpeg
- tarantoolctl rocks install lrexlib-pcre
- tarantoolctl rocks install http
- cd ..
# lua (with dev headers) is necessary for luacheck
- sudo apt-get install lua5.1
- sudo apt-get install liblua5.1-0-dev
- wget "http://luarocks.github.io/luarocks/releases/luarocks-2.4.4.tar.gz"
- tar xf luarocks-2.4.4.tar.gz
- cd luarocks-2.4.4
- ./configure
- make build
- sudo make install
- cd ../graphql
- sudo luarocks install luacheck
- sudo pip install virtualenv
- sudo luarocks install ldoc
env:
matrix:
- OS=el DIST=6
- OS=el DIST=7
- OS=fedora DIST=26
- OS=fedora DIST=27
- SHARD_VERSION=1.2 AVRO_SCHEMA=2.3.2
- SHARD_VERSION=2.1 AVRO_SCHEMA=2.3.2
- SHARD_VERSION=1.2 AVRO_SCHEMA=3.0.0
- SHARD_VERSION=2.1 AVRO_SCHEMA=3.0.0

script:
- make apidoc-lint
- make test
- git describe --long
- |
if [ -n "${OS}" ]; then
git clone https://github.com/packpack/packpack.git
packpack/packpack
else
./tools/ubuntu.trusty.test.sh
fi;
before_deploy:
- ls -l build/

deploy:
# Deploy packages to PackageCloud
- provider: packagecloud
username: ${PACKAGECLOUD_USER}
repository: "1_9"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{rpm,deb}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}"
- provider: packagecloud
username: ${PACKAGECLOUD_USER}
repository: "1_10"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{rpm,deb}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}"
- provider: packagecloud
username: ${PACKAGECLOUD_USER}
repository: "2_0"
token: ${PACKAGECLOUD_TOKEN}
dist: ${OS}/${DIST}
package_glob: build/*.{rpm,deb}
skip_cleanup: true
on:
branch: master
condition: -n "${OS}"
notifications:
email:
recipients:
- [email protected]
on_success: change
on_failure: always
1 change: 1 addition & 0 deletions 3rd_party/packpack
Submodule packpack added at 30ff7b
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ serve-apidoc: apidoc
.PHONY: demo
demo:
./demo/demo.lua $(TESTDATA)

.PHONY: rpm
rpm:
OS=el DIST=7 ./3rd_party/packpack/packpack
7 changes: 7 additions & 0 deletions rpm/prebuild-el-6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -exu # Strict shell (w/o -o pipefail)

sudo yum -y install https://centos6.iuscommunity.org/ius-release.rpm
sudo yum -y install python27
sudo yum -y install python27-devel
69 changes: 69 additions & 0 deletions rpm/tarantool-graphql.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Name: tarantool-graphql
# During package building {version} is overwritten by Packpack with
# VERSION. It is set to major.minor.patch.number_of_commits_above_last_tag.
# major.minor.patch tag and number of commits above are taken from the
# github repository: https://github.com/tarantool/graphql
Version: 0.0.1
Release: 1%{?dist}
Summary: Set of adapters for GraphQL query language to the Tarantool data model
Group: Applications/Databases
License: BSD
URL: https://github.com/tarantool/graphql
Source0: https://github.com/tarantool/graphql/archive/%{version}/graphql-%{version}.tar.gz
BuildArch: noarch

# Dependencies for `make test`
BuildRequires: tarantool >= 1.9.0.0
BuildRequires: tarantool-avro-schema >= 2.2.2.4
BuildRequires: tarantool-shard >= 2.1.0
BuildRequires: tarantool-http
BuildRequires: python-virtualenv
BuildRequires: tarantool-luacheck
BuildRequires: tarantool-lulpeg
BuildRequires: tarantool-lrexlib-pcre2

# Dependencies for a user
Requires: tarantool >= 1.9.0.0
Requires: tarantool-avro-schema >= 2.0.71
Requires: tarantool-lulpeg
# Dependencies below are not mandatory, they extend tarantool-graphql
# functionality. Currently we build packages for distros which do not have
# package manager versions which supports Suggests tag. We left section
# below commented till all actual distros will have necessary package manager
# versions.
#Suggests: tarantool-lrexlib-pcre2
#Suggests: tarantool-shard >= 2.1.0
#Suggests: tarantool-http

Copy link
Contributor

@SudoBobo SudoBobo Jun 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need shard, http, lrexlib in Requires? We need them not only for tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are optional. Are there recommended packages or like so? If so, we can add they to recommended. Otherwise, I think, we shouldn’t.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use Suggests: These dependencies will not be installed during package installation, instead they would be shown to user as an option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

%description
Set of adapters for GraphQL query language to the Tarantool data model

# /usr/share/tarantool
%define module_dir %{_datadir}/tarantool
%define br_module_dir %{buildroot}%{module_dir}

%prep
%setup -q -n %{name}-%{version}

%check
# Originally 'check' section is executed in
# /build/usr/src/degub/tarantool-graphql directory.
# It makes names of unix sockets too long and therefore tests fail.
# To avoid it we copy sources to /build/graphql and run tests there.
cp -R . /build/graphql
cd /build/graphql
make test

%install
mkdir -p %{br_module_dir}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we delete previous installation before installing the new one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess preparing of sandboxed build / install directories (it is not ones where a package will be installed finally, but they has the same directory structure) is rpmbuild task.

cp -r graphql %{br_module_dir}

%files
%{module_dir}/graphql

%changelog
* Thu Jul 12 2018 Ivan Koptelov <[email protected]> 0.0.1-1
- Initial release 0.0.1

* Sun May 20 2018 Alexander Turenko <[email protected]> 0.0.0-1
- Create pseudo-release 0.0.0 for testing deployment
31 changes: 31 additions & 0 deletions tools/ubuntu.trusty.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -euxo pipefail # Strict shell

sudo apt-get -qq update
curl http://download.tarantool.org/tarantool/1.9/gpgkey | \
sudo apt-key add -
release=`lsb_release -c -s`

# install https download transport for APT
sudo apt-get -y install apt-transport-https

# append two lines to a list of source repositories
sudo rm -f /etc/apt/sources.list.d/*tarantool*.list
echo "deb http://download.tarantool.org/tarantool/1.9/ubuntu/ ${release} main" | \
sudo tee /etc/apt/sources.list.d/tarantool_1_9.list
echo "deb-src http://download.tarantool.org/tarantool/1.9/ubuntu/ ${release} main" | \
sudo tee -a /etc/apt/sources.list.d/tarantool_1_9.list

sudo apt-get update
sudo apt-get -y install tarantool tarantool-dev libmsgpuck-dev
git submodule update --recursive --init
tarantoolctl rocks install lulpeg
tarantoolctl rocks install lrexlib-pcre
tarantoolctl rocks install http
tarantoolctl rocks install shard "${SHARD_VERSION}"
tarantoolctl rocks install avro-schema "${AVRO_SCHEMA}"
sudo apt-get install luarocks
sudo luarocks install luacheck
sudo pip install virtualenv
make test