1
0
mirror of https://git.ikl.sh/132ikl/liteshort.git synced 2023-08-10 21:13:04 +03:00

Start work on Debian package, add CONVENTIONS document

This commit is contained in:
132ikl 2020-04-05 00:09:21 -04:00
parent f465ee2b76
commit 8a782c0843
8 changed files with 76 additions and 1 deletions

27
CONVENTIONS Normal file
View File

@ -0,0 +1,27 @@
The following is a description of design philosphies and standards for liteshort. This document is mostly for developers, however if you are interested feel free to take a peek.
DESIGN PHILOSPHIES:
- Liteshort should be light on hardware resources. It doesn't need to be as minimal as possible, however it should never use excessive amounts of memory or CPU time.
- Liteshort should have readable code. Readability is more important than small performance gains.
- Liteshort should be easily configurable. If something could be an option, it should be.
- Liteshort should be simple to install and maintain. Installing should be a simple process, whether from a package manager or when installing from source.
- Liteshort should follow system design standards. This includes basic Unix design principles and the Filesystem Hierarchy Standard.
FILE STRUCTURE:
- Executable file: /usr/bin/liteshort
- Source directory: /usr/lib/python3/dist-packages/liteshort
- Config directory: /etc/liteshort/
- Socket file: /run/liteshort.sock
PYPI PACKAGE:
The PyPi package should provide no more than the following:
- Install source to Python package directory
- Install template config files
- Install debug executable (liteshort.py) installed
- Install python-only requirements (no uwsgi)
DEBIAN PACAKGE:
The Debian package should provide no more than the following:
- Install uwsgi
- Install and enable systemd service
- Should be based upon pybuild, as to prevent redundant packaging

6
liteshort.py Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env python3
from liteshort.main import app
if __name__ == "__main__":
app.run()

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python3
import os import os
import random import random
import sqlite3 import sqlite3

11
package/build.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash -e
VERSION="$(cat liteshort/version.py | cut -d '\"' -f2)"
cd package/
git log --no-walk --tags --pretty="liteshort (%S) unstable; urgency=medium%n%n * See the full changelog at:%n * https://github.com/132ikl/liteshort/releases/tag/v%S%n%n -- Steven Spangler <132@ikl.sh> %cD%n" --decorate=off | sed 's/(v/(/g' | sed 's/\/v/\//g' > debian/changelog
dpkg-buildpackage -us -uc --build=all
cd ../

1
package/debian/compat Normal file
View File

@ -0,0 +1 @@
11

7
package/debian/control Normal file
View File

@ -0,0 +1,7 @@
Source: liteshort
Maintainer: Steven Spangler <132@ikl.sh>
Package: liteshort
Depends: python3-aiofiles, python3-fastapi, python3-h11, python3-httptools, python3-imutils, python3-jinja2, python3-netifaces, python3-numpy, python3-pydantic, python3-pynetworktables, python3-python-multipart, python3-requests, python3-starlette, python3-toposort, python3-uvicorn, python3-uvloop
Architecture: all
Description: User-friendly, actually lightweight, and configurable URL shortener

View File

@ -0,0 +1 @@
../../liteshort.service

23
package/debian/rules Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/make -f
DISTRIBUTION = buster
VERSION = $(VERSION)
PACKAGEVERSION = $(VERSION)-0~$(DISTRIBUTION)0
TARBALL = liteshort-$(VERSION).tar.gz
URL = https://github.com/132ikl/liteshort
%:
dh $@
override_dh_auto_clean:
override_dh_auto_test:
override_dh_auto_debian/tmp/build:
override_dh_auto_install:
git clone --depth 1 --branch "v$(VERSION)" "$(URL)" debian/tmp/build/
mkdir -p debian/liteshort/usr/lib/python3/dist-packages/
mkdir -p debian/liteshort/usr/bin/
cp -r debian/tmp/build/liteshort/ debian/liteshort/usr/lib/python3/dist-packages/
cp debian/tmp/build/liteshort.py debian/liteshort/usr/bin/liteshort
chmod +x debian/liteshort/usr/bin/liteshort
override_dh_gencontrol:
dh_gencontrol -- -v$(PACKAGEVERSION)