diff --git a/CONVENTIONS b/CONVENTIONS new file mode 100644 index 0000000..7152125 --- /dev/null +++ b/CONVENTIONS @@ -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 diff --git a/liteshort.py b/liteshort.py new file mode 100755 index 0000000..1ef84b6 --- /dev/null +++ b/liteshort.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +from liteshort.main import app + +if __name__ == "__main__": + app.run() diff --git a/liteshort/main.py b/liteshort/main.py index 17ac5be..f32044f 100644 --- a/liteshort/main.py +++ b/liteshort/main.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 import os import random import sqlite3 diff --git a/package/build.sh b/package/build.sh new file mode 100755 index 0000000..1d18086 --- /dev/null +++ b/package/build.sh @@ -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 ../ diff --git a/package/debian/compat b/package/debian/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/package/debian/compat @@ -0,0 +1 @@ +11 diff --git a/package/debian/control b/package/debian/control new file mode 100644 index 0000000..1d43344 --- /dev/null +++ b/package/debian/control @@ -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 diff --git a/package/debian/liteshort.service b/package/debian/liteshort.service new file mode 120000 index 0000000..647522d --- /dev/null +++ b/package/debian/liteshort.service @@ -0,0 +1 @@ +../../liteshort.service \ No newline at end of file diff --git a/package/debian/rules b/package/debian/rules new file mode 100755 index 0000000..75c8e31 --- /dev/null +++ b/package/debian/rules @@ -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)