aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2024-02-16 02:41:10 -0500
committerJoshua M. Boniface <joshua@boniface.me>2024-02-16 02:43:32 -0500
commite777812ef14245fcf223513ab3389eea1d627c4a (patch)
tree8b66749e45f1db3e53feb19ca2bfb88c120b79a7
parentAdd note on portable architectures (diff)
downloadjellyfin-packaging-e777812ef14245fcf223513ab3389eea1d627c4a.tar.gz
jellyfin-packaging-e777812ef14245fcf223513ab3389eea1d627c4a.tar.bz2
jellyfin-packaging-e777812ef14245fcf223513ab3389eea1d627c4a.zip
Move configuration into YAML document
Simplifies changes in the future especially for new releases of e.g. Debian/Ubuntu, and makes the definitions easier to read.
-rw-r--r--.github/workflows/release-build.yaml14
-rwxr-xr-xbuild.py181
-rw-r--r--build.yaml120
3 files changed, 159 insertions, 156 deletions
diff --git a/.github/workflows/release-build.yaml b/.github/workflows/release-build.yaml
index 67b2f37..401d186 100644
--- a/.github/workflows/release-build.yaml
+++ b/.github/workflows/release-build.yaml
@@ -27,7 +27,7 @@ jobs:
- name: "Install dependencies"
run: |-
- sudo apt-get install --yes python3-git
+ sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@v3
@@ -77,7 +77,7 @@ jobs:
- name: "Install dependencies"
run: |-
- sudo apt-get install --yes python3-git
+ sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@v3
@@ -164,7 +164,7 @@ jobs:
- name: "Install dependencies"
run: |-
- sudo apt-get install --yes python3-git
+ sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@v3
@@ -249,7 +249,7 @@ jobs:
- name: "Install dependencies"
run: |-
- sudo apt-get install --yes python3-git
+ sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@v3
@@ -307,7 +307,7 @@ jobs:
- name: "Install dependencies"
run: |-
- sudo apt-get install --yes python3-git
+ sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@v3
@@ -365,7 +365,7 @@ jobs:
- name: "Install dependencies"
run: |-
- sudo apt-get install --yes python3-git
+ sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@v3
@@ -418,7 +418,7 @@ jobs:
- name: "Install dependencies"
run: |-
- sudo apt-get install --yes python3-git
+ sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@v3
diff --git a/build.py b/build.py
index 8a8c4f3..a713cd3 100755
--- a/build.py
+++ b/build.py
@@ -11,6 +11,7 @@ from os import system
import os.path
from subprocess import run, PIPE
import sys
+from yaml import load, SafeLoader
from git import Repo
@@ -255,154 +256,15 @@ def build_docker(jellyfin_version, build_type, _build_arch, _build_version):
# Define a map of possible configurations
-configurations = {
- "debian": {
- "def": build_package_deb,
- "dockerfile": "debian/docker/Dockerfile",
- "imagename": "jellyfin-builder",
- "archmaps": {
- "amd64": {
- "PACKAGE_ARCH": "amd64",
- },
- "arm64": {
- "PACKAGE_ARCH": "arm64",
- },
- "armhf": {
- "PACKAGE_ARCH": "armhf",
- },
- },
- "releases": {
- "bullseye": "11",
- "bookworm": "12",
- },
- "cross-gcc": {
- "bullseye": "10",
- "bookworm": "12",
- },
- },
- "ubuntu": {
- "def": build_package_deb,
- "dockerfile": "debian/docker/Dockerfile",
- "imagename": "jellyfin-builder",
- "archmaps": {
- "amd64": {
- "PACKAGE_ARCH": "amd64",
- },
- "arm64": {
- "PACKAGE_ARCH": "arm64",
- },
- "armhf": {
- "PACKAGE_ARCH": "armhf",
- },
- },
- "releases": {
- "focal": "20.04",
- "jammy": "22.04",
- "noble": "24.04",
- },
- "cross-gcc": {
- "focal": "10",
- "jammy": "12",
- "noble": "12",
- },
- },
- "fedora": {
- "def": build_package_rpm,
- },
- "centos": {
- "def": build_package_rpm,
- },
- "linux": {
- "def": build_linux,
- "dockerfile": "portable/Dockerfile",
- "imagename": "jellyfin-builder",
- "archivetypes": "tar",
- "archmaps": {
- "amd64": {
- "PACKAGE_ARCH": "amd64",
- "DOTNET_ARCH": "x64",
- },
- "amd64-musl": {
- "PACKAGE_ARCH": "amd64-musl",
- "DOTNET_ARCH": "musl-x64",
- },
- "arm64": {
- "PACKAGE_ARCH": "arm64",
- "DOTNET_ARCH": "arm64",
- },
- "arm64-musl": {
- "PACKAGE_ARCH": "arm64-musl",
- "DOTNET_ARCH": "musl-arm64",
- },
- "armhf": {
- "PACKAGE_ARCH": "armhf",
- "DOTNET_ARCH": "arm",
- },
- },
- },
- "windows": {
- "def": build_windows,
- "dockerfile": "portable/Dockerfile",
- "imagename": "jellyfin-builder",
- "archivetypes": "zip",
- "archmaps": {
- "amd64": {
- "PACKAGE_ARCH": "amd64",
- "DOTNET_ARCH": "x64",
- },
- "arm64": {
- "PACKAGE_ARCH": "arm64",
- "DOTNET_ARCH": "arm64",
- },
- },
- },
- "macos": {
- "def": build_macos,
- "dockerfile": "portable/Dockerfile",
- "imagename": "jellyfin-builder",
- "archivetypes": "tar",
- "archmaps": {
- "amd64": {
- "PACKAGE_ARCH": "amd64",
- "DOTNET_ARCH": "x64",
- },
- "arm64": {
- "PACKAGE_ARCH": "arm64",
- "DOTNET_ARCH": "arm64",
- },
- },
- },
- "portable": {
- "def": build_portable,
- "dockerfile": "portable/Dockerfile",
- "imagename": "jellyfin-builder",
- "archivetypes": "tar,zip",
- },
- "docker": {
- "def": build_docker,
- "dockerfile": "docker/Dockerfile",
- "imagename": "jellyfin/jellyfin",
- "archmaps": {
- "amd64": {
- "PACKAGE_ARCH": "amd64",
- "DOTNET_ARCH": "x64",
- "QEMU_ARCH": "x86_64",
- "IMAGE_ARCH": "amd64",
- },
- "arm64": {
- "PACKAGE_ARCH": "arm64",
- "DOTNET_ARCH": "arm64",
- "QEMU_ARCH": "aarch64",
- "IMAGE_ARCH": "arm64v8",
- },
- "armhf": {
- "PACKAGE_ARCH": "armhf",
- "DOTNET_ARCH": "arm",
- "QEMU_ARCH": "arm",
- "IMAGE_ARCH": "arm32v7",
- },
- }
- },
+function_definitions = {
+ "build_package_deb": build_package_deb,
+ "build_package_rpm": build_package_rpm,
+ "build_portable": build_portable,
+ "build_linux": build_linux,
+ "build_windows": build_windows,
+ "build_macos": build_macos,
+ "build_portable": build_portable,
+ "build_docker": build_docker,
}
def usage():
@@ -413,15 +275,35 @@ def usage():
print(f" BUILD_VERSION: A valid build OS version (packaged OS types only)")
try:
+ with open("build.yaml") as fh:
+ configurations = load(fh, Loader=SafeLoader)
+except Exception as e:
+ print(f"Error: Failed to find 'build.yaml' configuration: {e}")
+ exit(1)
+
+try:
jellyfin_version = sys.argv[1]
build_type = sys.argv[2]
except IndexError:
usage()
exit(1)
+
+if build_type not in configurations.keys():
+ print(f"Error: The specified build type {build_type} is not valid: choices are: {', '.join(configurations.keys())}")
+ exit(1)
+
+try:
+ if configurations[build_type]['build_function'] not in function_definitions.keys():
+ raise ValueError
+except Exception:
+ print(f"Error: The specified build type {build_type} does not define a valid build function in this script.")
+ exit(1)
+
try:
build_arch = sys.argv[3]
except IndexError:
build_arch = None
+
try:
build_version = sys.argv[4]
except IndexError:
@@ -429,5 +311,6 @@ except IndexError:
if jellyfin_version == "master":
jellyfin_version = datetime.now().strftime("%Y%m%d%H")
+ print(f"Autocorrecting 'master' version to {jellyfin_version}")
-configurations[build_type]['def'](jellyfin_version, build_type, build_arch, build_version)
+function_definitions[configurations[build_type]['build_function']](jellyfin_version, build_type, build_arch, build_version)
diff --git a/build.yaml b/build.yaml
new file mode 100644
index 0000000..e3b0819
--- /dev/null
+++ b/build.yaml
@@ -0,0 +1,120 @@
+---
+# Build definitions for `build.py`
+
+# DEB packages
+debian:
+ build_function: build_package_deb
+ archmaps:
+ amd64:
+ PACKAGE_ARCH: amd64
+ arm64:
+ PACKAGE_ARCH: arm64
+ armhf:
+ PACKAGE_ARCH: armhf
+ cross-gcc:
+ bookworm: '12'
+ bullseye: '10'
+ dockerfile: debian/docker/Dockerfile
+ imagename: jellyfin-builder-debian
+ releases:
+ bookworm: '12'
+ bullseye: '11'
+ubuntu:
+ build_function: build_package_deb
+ archmaps:
+ amd64:
+ PACKAGE_ARCH: amd64
+ arm64:
+ PACKAGE_ARCH: arm64
+ armhf:
+ PACKAGE_ARCH: armhf
+ cross-gcc:
+ focal: '10'
+ jammy: '12'
+ noble: '12'
+ dockerfile: debian/docker/Dockerfile
+ imagename: jellyfin-builder-ubuntu
+ releases:
+ focal: '20.04'
+ jammy: '22.04'
+ noble: '24.04'
+
+# RPM packages (TODO)
+centos:
+ build_function: build_package_rpm
+fedora:
+ build_function: build_package_rpm
+
+# Portable archives
+linux:
+ build_function: build_linux
+ archivetypes: tar
+ archmaps:
+ amd64:
+ DOTNET_ARCH: x64
+ PACKAGE_ARCH: amd64
+ amd64-musl:
+ DOTNET_ARCH: musl-x64
+ PACKAGE_ARCH: amd64-musl
+ arm64:
+ DOTNET_ARCH: arm64
+ PACKAGE_ARCH: arm64
+ arm64-musl:
+ DOTNET_ARCH: musl-arm64
+ PACKAGE_ARCH: arm64-musl
+ armhf:
+ DOTNET_ARCH: arm
+ PACKAGE_ARCH: armhf
+ dockerfile: portable/Dockerfile
+ imagename: jellyfin-builder-linux
+windows:
+ build_function: build_windows
+ archivetypes: zip
+ archmaps:
+ amd64:
+ DOTNET_ARCH: x64
+ PACKAGE_ARCH: amd64
+ arm64:
+ DOTNET_ARCH: arm64
+ PACKAGE_ARCH: arm64
+ dockerfile: portable/Dockerfile
+ imagename: jellyfin-builder-windows
+macos:
+ build_function: build_macos
+ archivetypes: tar
+ archmaps:
+ amd64:
+ DOTNET_ARCH: x64
+ PACKAGE_ARCH: amd64
+ arm64:
+ DOTNET_ARCH: arm64
+ PACKAGE_ARCH: arm64
+ dockerfile: portable/Dockerfile
+ imagename: jellyfin-builder-macos
+portable:
+ build_function: build_portable
+ archivetypes: tar-gz,zip
+ dockerfile: portable/Dockerfile
+ imagename: jellyfin-builder-portable
+
+# Docker images
+docker:
+ build_function: build_docker
+ archmaps:
+ amd64:
+ DOTNET_ARCH: x64
+ IMAGE_ARCH: amd64
+ PACKAGE_ARCH: amd64
+ QEMU_ARCH: x86_64
+ arm64:
+ DOTNET_ARCH: arm64
+ IMAGE_ARCH: arm64v8
+ PACKAGE_ARCH: arm64
+ QEMU_ARCH: aarch64
+ armhf:
+ DOTNET_ARCH: arm
+ IMAGE_ARCH: arm32v7
+ PACKAGE_ARCH: armhf
+ QEMU_ARCH: arm
+ dockerfile: docker/Dockerfile
+ imagename: jellyfin/jellyfin
bgstack15