Commit 04cc47ab authored by Mathias Stelzer's avatar Mathias Stelzer
Browse files

Merge branch 'packaging'

parents b1853b3e c41eaa00
Pipeline #818 passed with stages
in 20 minutes and 23 seconds
*.egg-info
*.pyc
*.swp
*.sqlite
*.egg-info
.idea/
*.swp
.coverage
.eggs/
.idea/
.pybuild
.tox/
build/
dist/
docs/_build/
.coverage
.tox/
htmlcov/
packaging/python-sysdirs_*
packaging/python3-sysdirs_*
packaging/debian/sysdirs
packaging/debian/MANIFEST.in
packaging/debian/README.rst
packaging/debian/setup.py
packaging/debian/.pybuild
packaging/debian/debian/debhelper-build-stamp
packaging/debian/debian/*.debhelper*
packaging/debian/debian/*.substvars
packaging/debian/debian/files
packaging/debian/debian/watch
packaging/debian/debian/python-sysdirs
packaging/debian/debian/python3-sysdirs
debian/*.debhelper*
debian/*.substvars
debian/debhelper-build-stamp
debian/files
debian/python-sysdirs
debian/python3-sysdirs
debian/watch
......@@ -10,28 +10,6 @@ variables: &variables
TERM: ansi
DEBIAN_FRONTEND: noninteractive
# cache
# apt
APT_CACHE_DIR: ${CI_PROJECT_DIR}/_cache/apt
# pip
XDG_CACHE_HOME: ${CI_PROJECT_DIR}/_cache/xdg
PIP_CACHE_DIR: ${CI_PROJECT_DIR}/_cache/xdg/pip
# commands
INIT_APT_CACHE: 'mkdir -p $${APT_CACHE_DIR}; echo "$$(find $${APT_CACHE_DIR} -type f | wc -l)" files in apt cache'
INIT_PIP_CACHE: 'mkdir -p $${PIP_CACHE_DIR}; echo "$$(find $${PIP_CACHE_DIR} -type f | wc -l)" files in pip cache'
APT: 'apt-get -o dir::cache::archives="$${APT_CACHE_DIR}"'
cache:
key: "sysdirs-$CI_COMMIT_REF_NAME-$CI_JOB_STAGE"
paths:
- _cache/apt
- _cache/xdg/pip
before_script:
- eval $INIT_APT_CACHE
- eval $INIT_PIP_CACHE
###############################################################################
# templates
......@@ -56,33 +34,39 @@ before_script:
- docker
dependencies: []
script:
- eval $APT update -qqy
- apt-get update -qqy
# build tools
- eval $APT install -qqy curl build-essential fakeroot devscripts python-dev python-pip python3-pip
- apt-get install -qqy curl build-essential fakeroot devscripts python-dev python-pip python3-pip
# Build-Depends
- eval $APT install -qqy debhelper dh-python python-all python-setuptools python-docutils python-sphinx python3-all python3-setuptools python3-docutils python3-sphinx
- apt-get install -qqy debhelper dh-python python-all python-setuptools python-docutils python-sphinx python3-all python3-setuptools python3-docutils python3-sphinx
- dpkg-buildpackage -us -uc
- mkdir build
- cd packaging/debian
- ./build.sh
- mv ../*.buildinfo build/ || true
- mv ../*.changes build/
- mv ../*.deb build/
- mv ../*.dsc build/
- mv ../*.tar.gz build/
artifacts:
name: '${PROJECT_NAME}_debian'
paths:
- 'packaging/python-${PROJECT_NAME}_*'
- 'packaging/python3-${PROJECT_NAME}_*'
- build/*
.test-built-deb template: &test-built-deb
stage: test-built
tags:
- docker
script:
- eval $APT update -qqy
- eval $APT install -qqy gdebi-core
- apt-get update -qqy
- apt-get install -qqy gdebi-core
- 'gdebi --non-interactive packaging/python-${PROJECT_NAME}_*.deb'
- 'gdebi --non-interactive build/python-${PROJECT_NAME}_*.deb'
- apt-get purge -qqy python-${PROJECT_NAME}
- 'gdebi --non-interactive packaging/python3-${PROJECT_NAME}_*.deb'
- 'gdebi --non-interactive build/python3-${PROJECT_NAME}_*.deb'
- apt-get purge -qqy python3-${PROJECT_NAME}
......@@ -93,7 +77,6 @@ test-py27:
<<: *test-py
image: python:2.7
before_script:
- eval $INIT_PIP_CACHE
- pip install mock
test-py33:
......@@ -231,6 +214,8 @@ deb:
- 'ssh apt@rolln.de "reprepro -b repos/debian remove unstable python-${PROJECT_NAME}"'
- 'ssh apt@rolln.de "reprepro -b repos/debian remove unstable python3-${PROJECT_NAME}"'
- 'scp packaging/python-${PROJECT_NAME}_* apt@rolln.de:repos/debian/incoming/'
- 'scp packaging/python3-${PROJECT_NAME}_* apt@rolln.de:repos/debian/incoming/'
- 'scp build/python-${PROJECT_NAME}_* apt@rolln.de:repos/debian/incoming/'
- 'scp build/python3-${PROJECT_NAME}_* apt@rolln.de:repos/debian/incoming/'
- 'ssh apt@rolln.de "reprepro -b repos/debian processincoming default"'
only:
- master
#!/bin/bash
PROJECT_NAME="sysdirs"
BUILD_TOOLS="curl build-essential fakeroot devscripts python-dev python-pip python3-pip"
BUILD_DEPENDS="debhelper dh-python python-all python-setuptools python-docutils python-sphinx python3-all python3-setuptools python3-docutils python3-sphinx"
BUILD_OUTPUT_COLOR="\033[0;36m" # Cyan
set -e
_echo() {
echo -e "${BUILD_OUTPUT_COLOR}${1}\033[0m"
}
# virtualenv
if [[ "${VIRTUAL_ENV:-}" ]]; then
if ! deactivate 2>/dev/null; then
echo -e "\033[0;31mERROR:\033[0m Please deactivate the virtualenv first!"
exit 1
fi
fi
###############################################################################
# clean
cleanup() {
_echo "Cleaning up build files ..."
rm setup.py || true
rm -r src || true
rm test_requirements.txt || true
rm MANIFEST.in || true
rm README.* || true
rm -r __pycache__ || true
}
cleanup
###############################################################################
# install dependencies
apt-get update
_echo "Installing build tools ..."
apt-get install ${BUILD_TOOLS}
_echo "Installing Build-Depends ..."
apt-get install ${BUILD_DEPENDS}
###############################################################################
# collect sources
_echo "Copying sources ..."
cp -R ../../src ./
cp ../../setup.py ./
cp ../../test_requirements.txt ./
cp ../../MANIFEST.in ./
cp ../../README.* ./
#_echo "Installing python packages for tests ..."
## The python-magic package in debian is the wrong one!
## For now we need to install it from pip.
#if hash pip; then
# pip install -r test_requirements.txt
# pip install mock
#fi
#if hash pip3; then
# pip3 install -r test_requirements.txt
#fi
#echo "refresh debian/watch from pypi ..."
##curl -o debian/watch http://pypi.debian.net/${PROJECT_NAME}/watch
###############################################################################
# build
echo
_echo "Changelog:"
echo
FIRST_LINE=true
while IFS= read line; do
if [[ "$line" =~ ^[\ ] ]] || [[ "$line" = "" ]] || [[ "${FIRST_LINE}" = true ]]; then
_echo " $line" # or whaterver you want to do with the $line variable
FIRST_LINE=false
else
break
fi
done <debian/changelog
echo
export PROJECT_VERSION="$(python setup.py --version)"
_echo "Building ${PROJECT_NAME} ${PROJECT_VERSION}"
if [[ "${DEBIAN_FRONTEND}" != "noninteractive" ]]; then
echo -e "Press ${BUILD_OUTPUT_COLOR}Enter\033[0m to continue ..."
read -t 5
fi
_echo "Running dpkg-buildpackage ..."
dpkg-buildpackage -rfakeroot -us -uc -F
cleanup
_echo "build complete."
......@@ -44,7 +44,7 @@ setup(
author='Mathias Stelzer',
author_email='knoppo@rolln.de',
url='https://rolln.de/knoppo/sysdirs',
keywords=' installer root user fhs etc var usr local share data xdg .config',
keywords='app package module installer root user fhs etc var usr local share data xdg .config config configuration',
license='GNU GPLv3+',
packages=find_packages('src'),
package_dir={'': 'src'},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment