snap: Start snap support.
- Create a snapcraft.yaml file in snap directory. Couldn't put this in packaging directory. - Use make-snapcraft.py to generate the snapcraft file. - Use make-snap to make the snap from the snapcraft file. - Eris is confined to only access projects in home. - os.setpriority doesn't work in snaps. - eris-webserver is run as "eris.webserver".
This commit is contained in:
parent
abb9633e97
commit
0331a9da1e
5 changed files with 195 additions and 4 deletions
|
|
@ -148,7 +148,7 @@ tools_for_extensions = [
|
||||||
[unrar]
|
[unrar]
|
||||||
dependencies = ["unrar"]
|
dependencies = ["unrar"]
|
||||||
url = "http://www.rarlabs.com/"
|
url = "http://www.rarlabs.com/"
|
||||||
command = "unrar l"
|
command = "unrar-nonfree l"
|
||||||
|
|
||||||
[7z]
|
[7z]
|
||||||
dependencies = ["p7zip"]
|
dependencies = ["p7zip"]
|
||||||
|
|
@ -214,7 +214,7 @@ tools_for_extensions = [
|
||||||
has_color = true
|
has_color = true
|
||||||
|
|
||||||
[php8_syntax]
|
[php8_syntax]
|
||||||
dependencies = ["php8.0-cli"]
|
dependencies = ["php-cli"]
|
||||||
url = "https://en.wikipedia.org/wiki/PHP"
|
url = "https://en.wikipedia.org/wiki/PHP"
|
||||||
command = "php --syntax-check"
|
command = "php --syntax-check"
|
||||||
|
|
||||||
|
|
@ -237,7 +237,7 @@ tools_for_extensions = [
|
||||||
[lua_syntax]
|
[lua_syntax]
|
||||||
dependencies = ["lua5.3"]
|
dependencies = ["lua5.3"]
|
||||||
url = "http://www.lua.org"
|
url = "http://www.lua.org"
|
||||||
command = "luac -p"
|
command = "luac5.3 -p"
|
||||||
|
|
||||||
[js_syntax]
|
[js_syntax]
|
||||||
dependencies = ["nodejs"]
|
dependencies = ["nodejs"]
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ class Worker:
|
||||||
self.process = await create
|
self.process = await create
|
||||||
pid_line = await self.process.stdout.readline()
|
pid_line = await self.process.stdout.readline()
|
||||||
self.child_pgid = int(pid_line.strip())
|
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"))
|
self.process.stdin.write(f"{self.compression}\n".encode("utf-8"))
|
||||||
|
|
||||||
async def run_tool(self, path, tool):
|
async def run_tool(self, path, tool):
|
||||||
|
|
|
||||||
19
packaging/make-snap
Executable file
19
packaging/make-snap
Executable file
|
|
@ -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
|
||||||
70
packaging/make-snapcraft.py
Executable file
70
packaging/make-snapcraft.py
Executable file
|
|
@ -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()
|
||||||
101
snap/snapcraft.yaml
Normal file
101
snap/snapcraft.yaml
Normal file
|
|
@ -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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue