Skip to content

Commit

Permalink
Adding packaging via travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
fukanchik committed Jun 12, 2016
1 parent 5ebbf0b commit b93d6eb
Show file tree
Hide file tree
Showing 14 changed files with 289 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -27,7 +27,6 @@ var/
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
Expand Down
37 changes: 37 additions & 0 deletions .travis.yml
@@ -0,0 +1,37 @@
sudo: required

services:
- docker

language: python

python:
- "2.7"

script:
- ./pkg/travis.sh

env:
matrix:
- OS=ubuntu DIST=trusty PACK=deb
- OS=el DIST=7 PACK=rpm
- OS=fedora DIST=23 PACK=rpm
- OS=debian DIST=jessie PACK=deb

notifications:
email: false
irc: false

deploy:
provider: releases
api_key:
secure:
file_glob: true
file:
- ../out/*.rpm
- ../out/*.deb
skip_cleanup: true
on:
tags: true
all_branches: true

1 change: 1 addition & 0 deletions README.md
@@ -1,3 +1,4 @@
[![Build Status](https://travis-ci.org/SergeySatskiy/cdm-flowparser.svg?branch=master)](https://travis-ci.org/SergeySatskiy/cdm-flowparser)
# cdm-flowparser
cdm-flowparser project is a Python 2 extension module.
It takes a file with a python code (or a character buffer), parses it and
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
@@ -0,0 +1,5 @@
cdm-flowparser (0.1-1) unstable; urgency=low

* source package automatically created by stdeb 0.8.5

-- Sergey Satskiy <sergey.satskiy@gmail.com> Sun, 06 Mar 2016 23:47:08 -0500
1 change: 1 addition & 0 deletions debian/compat
@@ -0,0 +1 @@
9
22 changes: 22 additions & 0 deletions debian/control
@@ -0,0 +1,22 @@
Source: cdm-flowparser
Priority: optional
Maintainer: Sergey Satsjiy <sergey.satskiy@gmail.com>
Build-Depends: python-all-dev (>= 2.6.6-3), debhelper (>= 7)
Standards-Version: 3.9.5
Section: libs

Package: cdm-flowparser
Section: libs
Architecture: any
Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}
Description: Provides hierarchical representation of the code in as fragments.
cdm-flowparser takes a file with a python code (or a character buffer), parses it and
provides back a hierarchical representation of the code in terms of fragments.
Each fragment describes a portion of the input content:
a start point (line, column and absolute position) plus an end point
(line, column and absolute position).
Comments are preserved too.
The parser is used in the Codimension Python IDE to generate a flowchart like
diagrams for an arbitrary Python code as the user types it. Basically a pause
in typing is detected and the diagram is regenerated.

42 changes: 42 additions & 0 deletions debian/copyright
@@ -0,0 +1,42 @@
Upstream-Name: cdm-flowparser
Upstream-Contact: Sergey Satskiy <sergey.satskiy@gmail.com>
Source: https://code.google.com/p/codimension/

Files: cdm-flowparser/*
Copyright: 2010, 2011 Sergey Satskiy <sergey.satskiy@gmail.com>
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

Files: debian/*
Copyright: 2010, 2011 Sergey Satskiy <sergey.satskiy@gmail.com>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

1 change: 1 addition & 0 deletions debian/docs
@@ -0,0 +1 @@
README.md
31 changes: 31 additions & 0 deletions debian/rules
@@ -0,0 +1,31 @@
#!/usr/bin/make -f

# This file was automatically generated by stdeb 0.8.5 at
# Mon, 01 Feb 2016 00:04:37 -0500

%:
dh $@ --with python2 --buildsystem=python_distutils


override_dh_auto_clean:
python setup.py clean -a
find . -name \*.pyc -exec rm {} \;



override_dh_auto_build:
python setup.py build --force



override_dh_auto_install:
python setup.py install --force --root=debian/python-cdm-flowparser --no-compile -O0 --install-layout=deb



override_dh_python2:
dh_python2 --no-guessing-versions




1 change: 1 addition & 0 deletions debian/source/format
@@ -0,0 +1 @@
3.0 (quilt)
20 changes: 20 additions & 0 deletions pkg/build_deb.sh
@@ -0,0 +1,20 @@
#!/bin/bash -x

projectfull="$1"
project="$2"
version="$3"

cp ~/result/${projectfull}.tar.gz ${project}_${version}.orig.tar.gz

tar xzf ${project}_${version}.orig.tar.gz

(
cd ${projectfull}
sudo mk-build-deps -i --tool "apt-get -y"
rm -f *.deb
dch --force-bad-version --distribution unstable --package ${project} --newversion ${version}-$(lsb_release -si)~$(lsb_release -sc) "new release"
debuild -us -uc
)

#mv -f *.deb ~/result/

18 changes: 18 additions & 0 deletions pkg/build_rpm.sh
@@ -0,0 +1,18 @@
#!/bin/bash -x

export projectfull="$1"
export project="$2"
export version="$3"

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

cp ~/result/${projectfull}.tar.gz ~/rpmbuild/SOURCES/${projectfull}.tar.gz
tar xzf ~/result/${projectfull}.tar.gz
cp ${projectfull}/pkg/${project}.spec ~/rpmbuild/SPECS

sudo version=${version} yum-builddep -y ~/rpmbuild/SPECS/${project}.spec
rpmbuild -ba --define "version $version" ~/rpmbuild/SPECS/${project}.spec

rm ~/rpmbuild/RPMS/x86_64/*debuginfo*.rpm
mv -f ~/rpmbuild/RPMS/x86_64/*.rpm ~/result/

49 changes: 49 additions & 0 deletions pkg/cdm-flowparser.spec
@@ -0,0 +1,49 @@
%define name cdm-flowparser
%define release 1
%define version %{getenv:version}

Summary: Parse python code to hierarchical representation in terms of fragments.
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GPLv3+
Group: Development/Libraries
URL: https://github.com/SergeySatskiy/codimension

Requires: python

BuildRequires: python-devel
BuildRequires: gcc-c++
Source: https://github.com/SergeySatskiy/codimension/releases/%{name}-%{version}.tar.gz

%description
cdm-flowparser takes a file with a python code (or a character buffer), parses it and
provides back a hierarchical representation of the code in terms of fragments.
Each fragment describes a portion of the input content:
a start point (line, column and absolute position) plus an end point (line, column and absolute position).

Comments are preserved too.

The parser is used in the Codimension Python IDE to generate a flowchart like diagrams for an arbitrary
Python code as the user types it. Basically a pause in typing is detected and the diagram is regenerated.

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

%build
make

%install
python setup.py install --root=${RPM_BUILD_ROOT} --record=INSTALLED_FILES

%check
make check

%files -f INSTALLED_FILES
%doc AUTHORS LICENSE ChangeLog README.md docs/cml.txt
#%{python_sitearch}/cdmbriefparser.pyo

%changelog
* Sat Jan 16 2016 Sergey Fukanchik <fukanchik@gmail.com> - 2.0.0
- Initial version of the package.

61 changes: 61 additions & 0 deletions pkg/travis.sh
@@ -0,0 +1,61 @@
#!/bin/bash -x

script=$(readlink -f $0)
script_dir=$(dirname $script)

VERSION=$(git describe --always --tags --abbrev=0)
if [ -z "${VERSION}" ]; then
echo "Can't get version"
exit 1
fi

VERSION=${VERSION#v}

TRAVIS_REPO_NAME=$(echo $TRAVIS_REPO_SLUG | cut -d '/' -f 2)
DOCKER_REPO=tarantool/build

project=${TRAVIS_REPO_NAME}
projectfull=${project}-${VERSION}

echo "Building ${projectfull}"

cd ..

case ${PACK} in
deb)
TARANTOOL_IMAGE=${DOCKER_REPO}:${OS}-${DIST}
;;
rpm)
TARANTOOL_IMAGE=${DOCKER_REPO}:${OS}${DIST}
;;
*)
echo "Packaging ${PACK} is not supported."
exit 1
;;
esac

tar_name=${projectfull}.tar.gz

mkdir out

cp -r ${TRAVIS_REPO_NAME} ${projectfull}
tar czf ${tar_name} ${projectfull}
cp ${tar_name} out/
cp ${TRAVIS_REPO_NAME}/pkg/build_${PACK}.sh out/

echo "FROM ${TARANTOOL_IMAGE}" > Dockerfile
echo "RUN useradd -s ${SHELL} -u $(id -u) -d ${HOME} ${USER}" >> Dockerfile
echo "RUN usermod -a -G wheel ${USER} || :;\\" >> Dockerfile
echo " usermod -a -G adm ${USER} || :;\\" >> Dockerfile
echo " usermod -a -G sudo ${USER} || :;\\" >> Dockerfile
echo " usermod -a -G mock ${USER} || :" >> Dockerfile
echo "USER ${USER}" >> Dockerfile

cat Dockerfile

mv Dockerfile out/

docker build --rm=true --quiet=true -t ${TARANTOOL_IMAGE}-for-${USER} out

docker run --volume ${PWD}/out:/home/${USER}/result --workdir /home/${USER}/result --rm=true --user=${USER} ${TARANTOOL_IMAGE}-for-${USER} bash -x /home/${USER}/result/build_${PACK}.sh ${projectfull} ${project} ${VERSION}

0 comments on commit b93d6eb

Please sign in to comment.