packaging: Let eris install on Fedora distributions

This commit is contained in:
Andrew Hamilton 2023-09-18 00:05:03 +10:00
parent 13345232d9
commit d5122f833a
8 changed files with 42 additions and 26 deletions

View file

@ -6,13 +6,12 @@ Eris maintains an up-to-date set of reports for every file in a codebase.
## Installation ## Installation
#### Debian / Ubuntu #### Debian / Ubuntu / Fedora
Install eris directly using pipx, and apt install the tools eris relies on: Install eris with pipx, then install all the tools eris uses:
sudo apt install pipx
pipx install --system-site-packages git+https://gitlab.com/ahamilton/eris@v2023.09.11#subdirectory=eris pipx install --system-site-packages git+https://gitlab.com/ahamilton/eris@v2023.09.11#subdirectory=eris
eris --apt-install-tools eris --install-all-tools
Or install from source: (including tools) Or install from source: (including tools)
@ -22,7 +21,7 @@ Or install from source: (including tools)
Then to run: Then to run:
eris -h eris
eris-webserver <project> # Or a simple web interface. eris-webserver <project> # Or a simple web interface.
## Tools ## Tools

View file

@ -51,7 +51,7 @@ Usage:
eris [options] <directory> eris [options] <directory>
eris -h | --help eris -h | --help
eris -i | --info eris -i | --info
eris -a | --apt-install-tools eris -a | --install-all-tools
eris --version eris --version
Example: Example:
@ -60,7 +60,7 @@ Example:
Options: Options:
-h, --help Show the full help. -h, --help Show the full help.
-i, --info Show information about the available tools. -i, --info Show information about the available tools.
-a, --apt-install-tools Install all tools. Ubuntu only. -a, --install-all-tools Install all tools.
-w COUNT, --workers=COUNT The number of processes working in parallel. -w COUNT, --workers=COUNT The number of processes working in parallel.
By default it is the number of cpus minus 1. By default it is the number of cpus minus 1.
-e "COMMAND", --editor="COMMAND" The command used to start the editor, in -e "COMMAND", --editor="COMMAND" The command used to start the editor, in
@ -1142,9 +1142,17 @@ def check_arguments():
sys.exit(1) sys.exit(1)
os.environ["ERIS_CONFIG"] = config_path os.environ["ERIS_CONFIG"] = config_path
import eris.tools as tools import eris.tools as tools
if arguments["--apt-install-tools"]: if arguments["--install-all-tools"]:
print("Installing all tools… (requires sudo)") print("Installing all tools… (requires sudo)")
subprocess.run(["sudo", "apt", "-y", "install"] + sorted(tools.dependencies()), check=True) tools_ = tools.dependencies()
package_manager = "apt"
if "ID=fedora\n" in open("/etc/os-release"):
tools_.remove("lua-check")
fedora_rename = {"lua5.3": "lua", "python3-bandit": "bandit",
"ruby3.1": "ruby", "xz-utils": "xz"}
tools_ = [fedora_rename.get(tool, tool) for tool in tools_]
package_manager = "dnf"
subprocess.run(["sudo", package_manager, "-y", "install"] + sorted(tools_), check=True)
print("Done.") print("Done.")
sys.exit(0) sys.exit(0)
if arguments["--info"]: if arguments["--info"]:

View file

@ -379,7 +379,7 @@ MAX_IMAGE_SIZE = 200
def _resize_image(image, new_width): def _resize_image(image, new_width):
import PIL.Image # Here to avoid 'Segmentation Fault' in apt-install-tools import PIL.Image # Here to avoid 'Segmentation Fault' in install-all-tools
scale = new_width / image.width scale = new_width / image.width
return image.resize((int(image.width * scale), int(image.height * scale)), PIL.Image.LANCZOS) return image.resize((int(image.width * scale), int(image.height * scale)), PIL.Image.LANCZOS)

View file

@ -148,12 +148,12 @@ tools_for_extensions = [
[unrar] [unrar]
dependencies = ["unrar"] dependencies = ["unrar"]
url = "http://www.rarlabs.com/" url = "http://www.rarlabs.com/"
command = "unrar-nonfree l" command = "unrar l"
[7z] [7z]
dependencies = ["p7zip"] dependencies = ["p7zip"]
url = "http://p7zip.sourceforge.net/" url = "http://p7zip.sourceforge.net/"
command = "7zr l" command = "7za l"
[unxz] [unxz]
dependencies = ["xz-utils"] dependencies = ["xz-utils"]
@ -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 = "luac5.3 -p" command = "luac -p"
[js_syntax] [js_syntax]
dependencies = ["nodejs"] dependencies = ["nodejs"]

View file

@ -2,13 +2,8 @@
set -e set -e
set -x
sudo apt install -y python3.11 pipx
pipx install --system-site-packages $1 ./eris pipx install --system-site-packages $1 ./eris
eris --apt-install-tools eris --install-all-tools
# When developing...
# python3.11 -m pip install -e ./eris
# python3.11 -m pip install -e ./fill3
# python3.11 -m pip install -e ./termstr
# python3.11 -m pip install -e ./lscolors

View file

@ -8,7 +8,7 @@ COPY . eris
RUN PIPX_BIN_DIR=/bin pipx install --system-site-packages ./eris/eris RUN PIPX_BIN_DIR=/bin pipx install --system-site-packages ./eris/eris
RUN chmod a+rwx -R /root RUN chmod a+rwx -R /root
RUN apt-get install -y sudo RUN apt-get install -y sudo
RUN eris --apt-install-tools RUN eris --install-all-tools
ENTRYPOINT ["eris"] ENTRYPOINT ["eris"]

View file

@ -0,0 +1,15 @@
FROM fedora
RUN dnf -y install python3.11 python3-pip pipx gcc python3.11-devel
COPY . eris
RUN PIPX_BIN_DIR=/bin pipx install --system-site-packages ./eris/eris
RUN chmod a+rwx -R /root
RUN dnf -y install sudo
RUN eris --install-all-tools
ENTRYPOINT ["eris"]
# docker build -t eris -f packaging/Dockerfile.fedora .

View file

@ -22,13 +22,12 @@ Eris maintains an up-to-date set of reports for every file in a codebase.
## Installation ## Installation
#### Debian / Ubuntu #### Debian / Ubuntu / Fedora
Install eris directly using pipx, and apt install the tools eris relies on: Install eris with pipx, then install all the tools eris uses:
sudo apt install pipx
pipx install --system-site-packages git+https://gitlab.com/ahamilton/eris@v2023.09.11#subdirectory=eris pipx install --system-site-packages git+https://gitlab.com/ahamilton/eris@v2023.09.11#subdirectory=eris
eris --apt-install-tools eris --install-all-tools
Or install from source: (including tools) Or install from source: (including tools)
@ -38,7 +37,7 @@ Or install from source: (including tools)
Then to run: Then to run:
eris -h eris
eris-webserver <project> # Or a simple web interface. eris-webserver <project> # Or a simple web interface.
## Tools ## Tools