From 46491d0813948923a970b9600df54c7059637230 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Sun, 17 Apr 2022 23:24:15 +0200 Subject: [PATCH 1/8] Rewrite Fedora build version detection Rewrite so we don't need to constantly update with every new Fedora release. This is especially useful when Fedora and Jellyfin release cycles don't line up. Version selection is as follows: * TARGET environment variable, which is currently used already * Currently running Fedora version * Hardcoded Fallback version that can be updated occasionally --- fedora/Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fedora/Makefile b/fedora/Makefile index 261fd262d8..6f9cf47190 100644 --- a/fedora/Makefile +++ b/fedora/Makefile @@ -8,13 +8,17 @@ TARBALL :=$(NAME)-$(subst -,~,$(VERSION)).tar.gz epel-7-x86_64_repos := https://packages.microsoft.com/rhel/7/prod/ epel-8-x86_64_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/ -fedora_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/ -fedora-34-x86_64_repos := $(fedora_repos) -fedora-35-x86_64_repos := $(fedora_repos) -fedora-34-x86_64_repos := $(fedora_repos) + +fed_ver := $(shell rpm -E %fedora) +# fallback when not running on Fedora +fed_ver ?= 36 +TARGET ?= fedora-$(fed_ver)-x86_64 + +ifeq ($(findstring fedora,$(TARGET)),fedora) +$(TARGET)_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/ +endif outdir ?= $(PWD)/$(DIR)/ -TARGET ?= fedora-35-x86_64 srpm: $(DIR)/$(SRPM) tarball: $(DIR)/$(TARBALL) From c243f588a05fc264b024da3ff725977f886e04d0 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Thu, 21 Apr 2022 17:01:36 +0200 Subject: [PATCH 2/8] Adjust license in Fedora Spec according to LICENSE --- fedora/jellyfin.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedora/jellyfin.spec b/fedora/jellyfin.spec index 56e7476d20..6ac1daee4d 100644 --- a/fedora/jellyfin.spec +++ b/fedora/jellyfin.spec @@ -10,7 +10,7 @@ Name: jellyfin Version: 10.8.0 Release: 1%{?dist} Summary: The Free Software Media System -License: GPLv3 +License: GPLv2 URL: https://jellyfin.org # Jellyfin Server tarball created by `make -f .copr/Makefile srpm`, real URL ends with `v%%{version}.tar.gz` Source0: jellyfin-server-%{version}.tar.gz From 0504ed9fe6bfd16c8cc29567557838e812ab9069 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Sat, 23 Apr 2022 12:50:36 +0200 Subject: [PATCH 3/8] Standardise and cleanup Fedora build * Remove additional dotnet-preview repo from Makefile * Repo doesn't seem maintained, and maintainers actively discourage the usage in production in its description * Considering this, we should build with stable .NET releases, which Fedora and RHEL 8+ repos already provide * Use Fedora-version-specific runtime-identifier for `dotnet publish` * This has no actual effect right now judging by the [RID catalog](https://github.com/dotnet/docs/blob/3efd59151a7421172658a6fbcf88a0bd5fa7a92d/docs/core/rid-catalog.md), so this is just future proofing. * Remove AutoReqProv * There's rarely a reason to use this feature, this is not one of them * In the [proposal of this feature](https://fedoraproject.org/wiki/AutoReqProv_(draft)#Usage) it is stated that this is not to be used on packages with binaries in /usr/bin and others, which is the case in this package. * also didn't seem to work since we were still having dependency issues with implicit dependencies (see jellyfin/jellyfin#7471 ) * Removed DOTNET_SKIP_FIRST_TIME_EXPERIENCE as it is unused in .NET SDK * see dotnet/sdk#9945 * it's already merged for removal in future versions * Move building process `dotnet publish` to %build section * Also removed `--output` from this due to an outstanding bug on SDK's side. This also separates building and installing as intended * define LICENSE as %license, which automatically puts it in a standardised directory --- fedora/Makefile | 5 ----- fedora/jellyfin.spec | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/fedora/Makefile b/fedora/Makefile index 6f9cf47190..3188cf6039 100644 --- a/fedora/Makefile +++ b/fedora/Makefile @@ -7,17 +7,12 @@ SRPM := jellyfin-$(subst -,~,$(VERSION))-$(RELEASE)$(shell rpm --eval %dist). TARBALL :=$(NAME)-$(subst -,~,$(VERSION)).tar.gz epel-7-x86_64_repos := https://packages.microsoft.com/rhel/7/prod/ -epel-8-x86_64_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/ fed_ver := $(shell rpm -E %fedora) # fallback when not running on Fedora fed_ver ?= 36 TARGET ?= fedora-$(fed_ver)-x86_64 -ifeq ($(findstring fedora,$(TARGET)),fedora) -$(TARGET)_repos := https://download.copr.fedorainfracloud.org/results/@dotnet-sig/dotnet-preview/$(TARGET)/ -endif - outdir ?= $(PWD)/$(DIR)/ srpm: $(DIR)/$(SRPM) diff --git a/fedora/jellyfin.spec b/fedora/jellyfin.spec index 6ac1daee4d..586c95c077 100644 --- a/fedora/jellyfin.spec +++ b/fedora/jellyfin.spec @@ -1,7 +1,7 @@ %global debug_package %{nil} # Set the dotnet runtime %if 0%{?fedora} -%global dotnet_runtime fedora-x64 +%global dotnet_runtime fedora.%{fedora}-x64 %else %global dotnet_runtime centos-x64 %endif @@ -25,13 +25,10 @@ Source17: jellyfin-server-lowports.conf %{?systemd_requires} BuildRequires: systemd BuildRequires: libcurl-devel, fontconfig-devel, freetype-devel, openssl-devel, glibc-devel, libicu-devel -# Requirements not packaged in main repos -# COPR @dotnet-sig/dotnet or +# Requirements not packaged in RHEL 7 main repos, added via Makefile # https://packages.microsoft.com/rhel/7/prod/ BuildRequires: dotnet-runtime-6.0, dotnet-sdk-6.0 Requires: %{name}-server = %{version}-%{release}, %{name}-web = %{version}-%{release} -# Disable Automatic Dependency Processing -AutoReqProv: no %description Jellyfin is a free software media system that puts you in control of managing and streaming your media. @@ -60,14 +57,17 @@ the Jellyfin server to bind to ports 80 and/or 443 for example. %autosetup -n jellyfin-server-%{version} -b 0 %build +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export PATH=$PATH:/usr/local/bin +# cannot use --output due to https://github.com/dotnet/sdk/issues/22220 +dotnet publish --configuration Release --self-contained --runtime %{dotnet_runtime} \ + "-p:DebugSymbols=false;DebugType=none" Jellyfin.Server + %install -export DOTNET_CLI_TELEMETRY_OPTOUT=1 -export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -export PATH=$PATH:/usr/local/bin -dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime %{dotnet_runtime} \ - "-p:DebugSymbols=false;DebugType=none" Jellyfin.Server -%{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/jellyfin/LICENSE +%{__mkdir} -p %{buildroot}%{_libdir}/%{name} %{buildroot}%{_bindir} +%{__cp} -r Jellyfin.Server/bin/Release/net6.0/%{dotnet_runtime}/publish/* %{buildroot}%{_libdir}/%{name} + %{__install} -D -m 0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/systemd/system/jellyfin.service.d/override.conf %{__install} -D -m 0644 %{SOURCE17} %{buildroot}%{_unitdir}/jellyfin.service.d/jellyfin-server-lowports.conf %{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/jellyfin/logging.json @@ -106,7 +106,7 @@ EOF %attr(750,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin %attr(-,jellyfin,jellyfin) %dir %{_var}/log/jellyfin %attr(750,jellyfin,jellyfin) %dir %{_var}/cache/jellyfin -%{_datadir}/licenses/jellyfin/LICENSE +%license LICENSE %files server-lowports %{_unitdir}/jellyfin.service.d/jellyfin-server-lowports.conf From 19ccf414acd4d7e867b4877cd6379a3fc8e725d2 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Mon, 25 Apr 2022 05:45:36 +0200 Subject: [PATCH 4/8] Fedora build: Filter dependency to fix F36 build * fixes #7471 * Filter for F36+ since we don't know when (if ever) this issue will be fixed (it's up to .NET SDK). If it's ever fixed we can adjust or remove this condition. --- fedora/jellyfin.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fedora/jellyfin.spec b/fedora/jellyfin.spec index 586c95c077..ae0c96f103 100644 --- a/fedora/jellyfin.spec +++ b/fedora/jellyfin.spec @@ -30,6 +30,12 @@ BuildRequires: libcurl-devel, fontconfig-devel, freetype-devel, openssl-devel, BuildRequires: dotnet-runtime-6.0, dotnet-sdk-6.0 Requires: %{name}-server = %{version}-%{release}, %{name}-web = %{version}-%{release} +# Temporary (hopefully?) fix for https://github.com/jellyfin/jellyfin/issues/7471 +%if 0%{?fedora} >= 36 +%global __requires_exclude ^liblttng-ust\\.so\\.0.*$ +%endif + + %description Jellyfin is a free software media system that puts you in control of managing and streaming your media. @@ -108,6 +114,7 @@ EOF %attr(750,jellyfin,jellyfin) %dir %{_var}/cache/jellyfin %license LICENSE + %files server-lowports %{_unitdir}/jellyfin.service.d/jellyfin-server-lowports.conf From 9b805c9e83f69e97fe560ae060f371b74b8ebd00 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Mon, 25 Apr 2022 08:04:31 +0200 Subject: [PATCH 5/8] Use Fedora 36 image in Fedora Docker builds * fixes #7504 --- deployment/Dockerfile.fedora.amd64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/Dockerfile.fedora.amd64 b/deployment/Dockerfile.fedora.amd64 index 4308d86b46..853a76303d 100644 --- a/deployment/Dockerfile.fedora.amd64 +++ b/deployment/Dockerfile.fedora.amd64 @@ -1,4 +1,4 @@ -FROM fedora:33 +FROM fedora:36 # Docker build arguments ARG SOURCE_DIR=/jellyfin ARG ARTIFACT_DIR=/dist From f336647d57ddb55801ab1c85c6942981ad4bc95f Mon Sep 17 00:00:00 2001 From: Tarulia Date: Mon, 25 Apr 2022 22:00:15 +0200 Subject: [PATCH 6/8] Remove env-var after moving web-files on Fedora * when running Jellyfin as a user from a terminal without passing arguments, it would not find the web-files. They were moved in the JF-web build for Fedora, so this env-var would point to an invalid location. By removing it, JF now checks the default location. * fixes jellyfin/jellyfin-web#2059 --- fedora/jellyfin.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedora/jellyfin.env b/fedora/jellyfin.env index 56b7a3558d..89cad1a2d3 100644 --- a/fedora/jellyfin.env +++ b/fedora/jellyfin.env @@ -21,7 +21,7 @@ JELLYFIN_LOG_DIR="/var/log/jellyfin" JELLYFIN_CACHE_DIR="/var/cache/jellyfin" # web client path, installed by the jellyfin-web package -JELLYFIN_WEB_OPT="--webdir=/usr/share/jellyfin-web" +# JELLYFIN_WEB_OPT="--webdir=/usr/share/jellyfin-web" # In-App service control JELLYFIN_RESTART_OPT="--restartpath=/usr/libexec/jellyfin/restart.sh" From 5912a49d1d01855be0953ee25a2eb87abf2f9157 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Tue, 26 Apr 2022 00:19:17 +0200 Subject: [PATCH 7/8] Further cleanup of Fedora spec-file * Replaced shell script used to start JF with a symlink, since it didn't do anything else. * Sorted installs by category/path to make it easier to maintain the spec. * Defined `%defattr` in file section so we don't need to set it on a by-file level. This also helps with the messed up default file permissions `dotnet publish` produces. * Removed some duplicate attribute definitions in `%install` and `%files` sections. They are now all in the `%install` section because of `%defattr` being specified and overriding them otherwise. --- fedora/jellyfin.spec | 64 +++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/fedora/jellyfin.spec b/fedora/jellyfin.spec index ae0c96f103..366cd74d4c 100644 --- a/fedora/jellyfin.spec +++ b/fedora/jellyfin.spec @@ -62,6 +62,7 @@ the Jellyfin server to bind to ports 80 and/or 443 for example. %prep %autosetup -n jellyfin-server-%{version} -b 0 + %build export DOTNET_CLI_TELEMETRY_OPTOUT=1 export PATH=$PATH:/usr/local/bin @@ -71,47 +72,62 @@ dotnet publish --configuration Release --self-contained --runtime %{dotnet_runti %install -%{__mkdir} -p %{buildroot}%{_libdir}/%{name} %{buildroot}%{_bindir} -%{__cp} -r Jellyfin.Server/bin/Release/net6.0/%{dotnet_runtime}/publish/* %{buildroot}%{_libdir}/%{name} +# Jellyfin files +%{__mkdir} -p %{buildroot}%{_libdir}/jellyfin %{buildroot}%{_bindir} +%{__cp} -r Jellyfin.Server/bin/Release/net6.0/%{dotnet_runtime}/publish/* %{buildroot}%{_libdir}/jellyfin +ln -srf %{_libdir}/jellyfin/jellyfin %{buildroot}%{_bindir}/jellyfin +%{__install} -D %{SOURCE14} %{buildroot}%{_libexecdir}/jellyfin/restart.sh -%{__install} -D -m 0644 %{SOURCE15} %{buildroot}%{_sysconfdir}/systemd/system/jellyfin.service.d/override.conf -%{__install} -D -m 0644 %{SOURCE17} %{buildroot}%{_unitdir}/jellyfin.service.d/jellyfin-server-lowports.conf -%{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/jellyfin/logging.json -%{__mkdir} -p %{buildroot}%{_bindir} -tee %{buildroot}%{_bindir}/jellyfin << EOF -#!/bin/sh -exec %{_libdir}/jellyfin/jellyfin \${@} -EOF +# Jellyfin config +%{__install} -D Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/jellyfin/logging.json +%{__install} -D %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/jellyfin + +# system config +%{__install} -D %{SOURCE16} %{buildroot}%{_prefix}/lib/firewalld/services/jellyfin.xml +%{__install} -D %{SOURCE13} %{buildroot}%{_sysconfdir}/sudoers.d/jellyfin-sudoers +%{__install} -D %{SOURCE15} %{buildroot}%{_sysconfdir}/systemd/system/jellyfin.service.d/override.conf +%{__install} -D %{SOURCE11} %{buildroot}%{_unitdir}/jellyfin.service + +# empty directories %{__mkdir} -p %{buildroot}%{_sharedstatedir}/jellyfin %{__mkdir} -p %{buildroot}%{_sysconfdir}/jellyfin -%{__mkdir} -p %{buildroot}%{_var}/log/jellyfin %{__mkdir} -p %{buildroot}%{_var}/cache/jellyfin +%{__mkdir} -p %{buildroot}%{_var}/log/jellyfin + +# jellyfin-server-lowports subpackage +%{__install} -D -m 0644 %{SOURCE17} %{buildroot}%{_unitdir}/jellyfin.service.d/jellyfin-server-lowports.conf -%{__install} -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/jellyfin.service -%{__install} -D -m 0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/jellyfin -%{__install} -D -m 0600 %{SOURCE13} %{buildroot}%{_sysconfdir}/sudoers.d/jellyfin-sudoers -%{__install} -D -m 0755 %{SOURCE14} %{buildroot}%{_libexecdir}/jellyfin/restart.sh -%{__install} -D -m 0644 %{SOURCE16} %{buildroot}%{_prefix}/lib/firewalld/services/jellyfin.xml %files # empty as this is just a meta-package %files server -%attr(755,root,root) %{_bindir}/jellyfin -%{_libdir}/jellyfin/* +%defattr(644,root,root,755) + +# Jellyfin files +%{_bindir}/jellyfin # Needs 755 else only root can run it since binary build by dotnet is 722 +%attr(755,root,root) %{_libdir}/jellyfin/createdump %attr(755,root,root) %{_libdir}/jellyfin/jellyfin -%{_unitdir}/jellyfin.service -%{_libexecdir}/jellyfin/restart.sh -%{_prefix}/lib/firewalld/services/jellyfin.xml -%attr(755,jellyfin,jellyfin) %dir %{_sysconfdir}/jellyfin +%{_libdir}/jellyfin/* +%attr(755,root,root) %{_libexecdir}/jellyfin/restart.sh + +# Jellyfin config +%config(noreplace) %attr(644,jellyfin,jellyfin) %{_sysconfdir}/jellyfin/logging.json %config %{_sysconfdir}/sysconfig/jellyfin + +# system config +%{_prefix}/lib/firewalld/services/jellyfin.xml +%{_unitdir}/jellyfin.service %config(noreplace) %attr(600,root,root) %{_sysconfdir}/sudoers.d/jellyfin-sudoers %config(noreplace) %{_sysconfdir}/systemd/system/jellyfin.service.d/override.conf -%config(noreplace) %attr(644,jellyfin,jellyfin) %{_sysconfdir}/jellyfin/logging.json + +# empty directories %attr(750,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin -%attr(-,jellyfin,jellyfin) %dir %{_var}/log/jellyfin +%attr(755,jellyfin,jellyfin) %dir %{_sysconfdir}/jellyfin %attr(750,jellyfin,jellyfin) %dir %{_var}/cache/jellyfin +%attr(-, jellyfin,jellyfin) %dir %{_var}/log/jellyfin + %license LICENSE From 6d5c697183df6bed4d2617c56de4350d00750e4d Mon Sep 17 00:00:00 2001 From: Tarulia Date: Sat, 18 Jun 2022 22:35:36 +0200 Subject: [PATCH 8/8] Add make in Fedora Docker install Fedora 36 doesn't seem to ship make, so add it manually. --- deployment/Dockerfile.fedora.amd64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/Dockerfile.fedora.amd64 b/deployment/Dockerfile.fedora.amd64 index 853a76303d..0833cccc8f 100644 --- a/deployment/Dockerfile.fedora.amd64 +++ b/deployment/Dockerfile.fedora.amd64 @@ -9,7 +9,7 @@ ENV IS_DOCKER=YES # Prepare Fedora environment RUN dnf update -yq \ - && dnf install -yq @buildsys-build rpmdevtools git dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel systemd wget + && dnf install -yq @buildsys-build rpmdevtools git dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel systemd wget make # Install DotNET SDK RUN wget -q https://download.visualstudio.microsoft.com/download/pr/dc930bff-ef3d-4f6f-8799-6eb60390f5b4/1efee2a8ea0180c94aff8f15eb3af981/dotnet-sdk-6.0.300-linux-x64.tar.gz -O dotnet-sdk.tar.gz \