mirror of
https://github.com/jellyfin/jellyfin-packaging.git
synced 2024-11-23 05:59:41 +00:00
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.
This commit is contained in:
parent
8b7ede44a7
commit
e777812ef1
14
.github/workflows/release-build.yaml
vendored
14
.github/workflows/release-build.yaml
vendored
@ -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
|
||||
|
181
build.py
181
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():
|
||||
@ -412,16 +274,36 @@ def usage():
|
||||
print(f" BUILD_ARCH: A valid build OS CPU architecture (empty [portable/docker], amd64, arm64, or armhf)")
|
||||
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)
|
||||
|
120
build.yaml
Normal file
120
build.yaml
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user