diff --git a/eris/eris/tools.toml b/eris/eris/tools.toml index 4cf7c04..480b92a 100644 --- a/eris/eris/tools.toml +++ b/eris/eris/tools.toml @@ -148,7 +148,7 @@ tools_for_extensions = [ [unrar] dependencies = ["unrar"] url = "http://www.rarlabs.com/" - command = "unrar l" + command = "unrar-nonfree l" [7z] dependencies = ["p7zip"] @@ -214,7 +214,7 @@ tools_for_extensions = [ has_color = true [php8_syntax] - dependencies = ["php8.0-cli"] + dependencies = ["php-cli"] url = "https://en.wikipedia.org/wiki/PHP" command = "php --syntax-check" @@ -237,7 +237,7 @@ tools_for_extensions = [ [lua_syntax] dependencies = ["lua5.3"] url = "http://www.lua.org" - command = "luac -p" + command = "luac5.3 -p" [js_syntax] dependencies = ["nodejs"] diff --git a/eris/eris/worker.py b/eris/eris/worker.py index 69fbd54..dfb3923 100755 --- a/eris/eris/worker.py +++ b/eris/eris/worker.py @@ -31,7 +31,8 @@ class Worker: self.process = await create pid_line = await self.process.stdout.readline() self.child_pgid = int(pid_line.strip()) - os.setpriority(os.PRIO_PGRP, self.child_pgid, 19) + if "SNAP" not in os.environ: # Can't do setpriority inside snaps. + os.setpriority(os.PRIO_PGRP, self.child_pgid, 19) self.process.stdin.write(f"{self.compression}\n".encode("utf-8")) async def run_tool(self, path, tool): diff --git a/packaging/make-snap b/packaging/make-snap new file mode 100755 index 0000000..e43ce56 --- /dev/null +++ b/packaging/make-snap @@ -0,0 +1,19 @@ +#!/bin/bash + + +# Run this script from the project root. +# i.e. ./packaging/make-snap + + +set -e +set -x + + +# snap install lxd +# lxd init # Use defaults. Set size of loop device to at least 3GB. + +snapcraft clean --use-lxd +snapcraft --use-lxd --debug +sudo snap remove eris +sudo snap install --dangerous eris_*_amd64.snap +/snap/bin/eris -h diff --git a/packaging/make-snapcraft.py b/packaging/make-snapcraft.py new file mode 100755 index 0000000..4edf8a1 --- /dev/null +++ b/packaging/make-snapcraft.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3.9 +# -*- coding: utf-8 -*- + + +import textwrap + +import eris.__main__ +import eris.tools as tools + + +def main(): + lines = eris.__main__.__doc__.splitlines() + summary = lines[2] + description = textwrap.indent("\n".join(lines[2:]), " ") + print(f"""\ +name: eris +base: core20 +version: 2021.11.29 +summary: {summary} +description: | +{description} + +grade: devel +confinement: strict + +apps: + eris: + command: bin/eris + environment: + PYTHONPATH: $SNAP/lib/python3.9/site-packages:$SNAP/lib/python3.9/dist-packages:$PYTHONPATH + plugs: + - home + webserver: + command: bin/eris-webserver + environment: + PYTHONPATH: $SNAP/lib/python3.9/site-packages:$SNAP/lib/python3.9/dist-packages:$PYTHONPATH + plugs: + - home + - network-bind + +passthrough: + layout: + $SNAP/usr/bin/php: + symlink: $SNAP/usr/bin/php7.4 + +parts: + eris: + plugin: python + source: . + python-packages: + - ./termstr + - ./lscolors + - ./fill3 + - ./eris + requirements: + - ./termstr/requirements.txt + - ./fill3/requirements.txt + - ./eris/requirements.txt + build-environment: + - SNAPCRAFT_PYTHON_INTERPRETER: python3.9 + stage-packages: + - python3.9-venv + - python3-distutils + - python3-pkg-resources + - """, end="") + print("\n - ".join(sorted(tools.dependencies()))) + + +if __name__ == "__main__": + main() diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000..fc193dc --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,101 @@ +name: eris +base: core20 +version: 2021.11.29 +summary: Eris maintains an up-to-date set of reports for every file in a codebase. +description: | + Eris maintains an up-to-date set of reports for every file in a codebase. + + A status indicator summarises the state of each report, and a report is viewed + by selecting this status indicator with the cursor. + + The reports are cached in the codebase's root directory in a ".eris" + directory. + +grade: devel +confinement: strict + +apps: + eris: + command: bin/eris + environment: + PYTHONPATH: $SNAP/lib/python3.9/site-packages:$SNAP/lib/python3.9/dist-packages:$PYTHONPATH + plugs: + - home + webserver: + command: bin/eris-webserver + environment: + PYTHONPATH: $SNAP/lib/python3.9/site-packages:$SNAP/lib/python3.9/dist-packages:$PYTHONPATH + plugs: + - home + - network-bind + +passthrough: + layout: + $SNAP/usr/bin/php: + symlink: $SNAP/usr/bin/php7.4 + +parts: + eris: + plugin: python + source: . + python-packages: + - ./termstr + - ./lscolors + - ./fill3 + - ./eris + requirements: + - ./termstr/requirements.txt + - ./fill3/requirements.txt + - ./eris/requirements.txt + build-environment: + - SNAPCRAFT_PYTHON_INTERPRETER: python3.9 + stage-packages: + - python3.9-venv + - python3-distutils + - python3-pkg-resources + - binutils + - coreutils + - cppcheck + - dpkg + - elinks + - file + - g++ + - gcc + - genisoimage + - git + - golang-go + - html2text + - lua-check + - lua5.3 + - mediainfo + - nodejs + - p7zip + - pandoc + - perl + - perl-doc + - php-cli + - pylint + - python3-bandit + - python3-cairosvg + - python3-coverage + - python3-mccabe + - python3-mypy + - python3-pdfminer + - python3-pillow + - python3-pycodestyle + - python3-pydocstyle + - python3-pyflakes + - python3-pygments + - python3-pytest + - python3-pytest-cov + - rakudo + - rpm + - ruby2.7 + - shellcheck + - tar + - tidy + - unrar + - unzip + - wabt + - xz-utils + - yamllint