Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct debian packaging for Jacquard #105

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Debian packaging files
/debian/debhelper-build-stamp
/debian/files
/debian/jacquard.*.debhelper
/debian/jacquard.substvars
/debian/jacquard
/.pybuild

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- pip install pytest pytest-cov fakeredis hypothesis networkx mypy
- pip install -r script/linting/requirements.txt
- sudo apt-get update ; sudo apt-get install python3 python3-setuptools
- gem install fpm
- sudo apt-get install debhelper devscripts equivs
override:
- rm -rf jacquard_split.egg-info
- pip install -e .
Expand All @@ -22,7 +22,7 @@ test:
- script/linting/lint
- mypy -p jacquard --ignore-missing-imports --strict-optional
post:
- ./hax_debian.sh
- dpkg-buildpackage -us -uc -b
- mv *.deb $CIRCLE_ARTIFACTS/

deployment:
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jacquard (0.7.0) unstable; urgency=low

* Initial Debian packaged version

-- Peter Law <[email protected]> Sat, 28 Mar 2020 23:45:00 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
File renamed without changes.
18 changes: 18 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Source: jacquard
Maintainer: Alistair Lynn <[email protected]>
Priority: optional
Build-Depends: debhelper (>= 7.0.50~),
dh-systemd,
dh-python,
python3,
python3-setuptools,
Standards-Version: 3.9.6

Package: jacquard
Architecture: all
X-Python3-Version: >= 3.5
Depends: ${python3:Depends},
python3-waitress,
${misc:Depends},
Suggests: python3-sqlalchemy, python3-psycopg2
Description: Split-testing server
1 change: 1 addition & 0 deletions debian/jacquard.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
debian/config.cfg /etc/jacquard
13 changes: 13 additions & 0 deletions debian/jacquard.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Jacquard service

[Service]
User=www-data
WorkingDirectory=/var/jacquard
ExecStart=/usr/bin/waitress-serve-python3 --port=1212 jacquard.wsgi:app
PrivateTmp=on
PrivateDevices=on
Environment="JACQUARD_LOG_LEVEL=info"

[Install]
WantedBy=multi-user.target
5 changes: 5 additions & 0 deletions deb-jacquard-install.sh → debian/postinst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/sh

set -e

mkdir -p /var/jacquard
touch /var/jacquard/jacquard.db
chown www-data:www-data /var/jacquard/jacquard.db
chown www-data:www-data /var/jacquard
Expand Down
1 change: 1 addition & 0 deletions debian/pyversions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.5-
10 changes: 10 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/make -f

export PYBUILD_NAME = jacquard
export PYTHONDONTWRITEBYTECODE = 1

# Testing is done separately via CI
export PYBUILD_DISABLE = test

%:
dh $@ --with python3 --buildsystem=pybuild
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
31 changes: 0 additions & 31 deletions hax_debian.sh

This file was deleted.

30 changes: 0 additions & 30 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,6 @@
import os
import sys

# This monstrous hack is to support /etc generation for the Debian package
# with fpm.
if sys.argv[1] == 'install' and os.environ.get('JACQUARD_DEBIAN_HACK'):
def debian_etc_hack(root):
import pathlib
root_path = pathlib.Path(root)
config_dir = root_path / 'etc' / 'jacquard'

try:
config_dir.mkdir(parents=True)
except FileExistsError:
pass
try:
(config_dir / 'plugins').mkdir()
except FileExistsError:
pass

with (config_dir / 'config.cfg').open('wb') as f_out:
with open('debian.cfg', 'rb') as f_in:
config_file = f_in.read()
f_out.write(config_file)

try:
(root_path / 'var' / 'jacquard').mkdir(parents=True)
except FileExistsError:
pass

debian_etc_hack(sys.argv[3])
del debian_etc_hack


with open('README.rst', 'r', encoding='utf-8') as f:
long_description = f.read()
Expand Down