mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-20 05:04:18 +01:00
Clean up and fix Fedora/CentOS builds
This performs a lot of bugfixing and general cleanup to the Fedora/CentOS builds, including moving the create_tarball into the docker-build.sh script, remove some old long versions from the spec file, correcting several bugs with the Docker environment including splitting them into more discrete layers, and finally making sure jellyfin-web is included properly in the RPM.
This commit is contained in:
@@ -8,22 +8,29 @@ ARG SDK_VERSION=2.2
|
||||
ENV SOURCE_DIR=/jellyfin
|
||||
ENV ARTIFACT_DIR=/dist
|
||||
|
||||
# Prepare CentOS build environment
|
||||
# Prepare CentOS environment
|
||||
RUN yum update -y \
|
||||
&& yum install -y @buildsys-build rpmdevtools yum-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel nodejs \
|
||||
&& rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm \
|
||||
&& yum install -y epel-release
|
||||
|
||||
# Install build dependencies
|
||||
RUN yum install -y @buildsys-build rpmdevtools yum-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel nodejs wget git
|
||||
|
||||
# Install DotNET SDK
|
||||
RUN rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm \
|
||||
&& rpmdev-setuptree \
|
||||
&& yum install -y dotnet-sdk-${SDK_VERSION} \
|
||||
&& ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
|
||||
&& yum install -y dotnet-sdk-${SDK_VERSION}
|
||||
|
||||
# Install yarn package manager
|
||||
RUN wget -q -O /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \
|
||||
&& yum install -y yarn
|
||||
|
||||
# Create symlinks and directories
|
||||
RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \
|
||||
&& mkdir -p ${SOURCE_DIR}/SPECS \
|
||||
&& ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec \
|
||||
&& mkdir -p ${SOURCE_DIR}/SOURCES \
|
||||
&& ln -s ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/SOURCES
|
||||
|
||||
# Install yarn package manager
|
||||
RUN wget -q -O- https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo \
|
||||
&& yum install -y yarn
|
||||
|
||||
VOLUME ${ARTIFACT_DIR}/
|
||||
|
||||
COPY . ${SOURCE_DIR}/
|
||||
|
||||
@@ -8,6 +8,8 @@ set -o xtrace
|
||||
# Move to source directory
|
||||
pushd ${SOURCE_DIR}
|
||||
|
||||
VERSION="$( grep '^Version:' ${SOURCE_DIR}/SOURCES/pkg-src/jellyfin.spec | awk '{ print $NF }' )"
|
||||
|
||||
# Clone down and build Web frontend
|
||||
web_build_dir="$( mktemp -d )"
|
||||
web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web"
|
||||
@@ -23,6 +25,54 @@ mv dist/* ${web_target}/
|
||||
popd
|
||||
rm -rf ${web_build_dir}
|
||||
|
||||
# Create RPM source archive
|
||||
GNU_TAR=1
|
||||
echo "Bundling all sources for RPM build."
|
||||
tar \
|
||||
--transform "s,^\.,jellyfin-${VERSION}," \
|
||||
--exclude='.git*' \
|
||||
--exclude='**/.git' \
|
||||
--exclude='**/.hg' \
|
||||
--exclude='**/.vs' \
|
||||
--exclude='**/.vscode' \
|
||||
--exclude='deployment' \
|
||||
--exclude='**/bin' \
|
||||
--exclude='**/obj' \
|
||||
--exclude='**/.nuget' \
|
||||
--exclude='*.deb' \
|
||||
--exclude='*.rpm' \
|
||||
-czf "${SOURCE_DIR}/SOURCES/pkg-src/jellyfin-${VERSION}.tar.gz" \
|
||||
-C ${SOURCE_DIR} ./ || GNU_TAR=0
|
||||
|
||||
if [ $GNU_TAR -eq 0 ]; then
|
||||
echo "The installed tar binary did not support --transform. Using workaround."
|
||||
package_temporary_dir="$( mktemp -d )"
|
||||
mkdir -p "${package_temporary_dir}/jellyfin"
|
||||
# Not GNU tar
|
||||
tar \
|
||||
--exclude='.git*' \
|
||||
--exclude='**/.git' \
|
||||
--exclude='**/.hg' \
|
||||
--exclude='**/.vs' \
|
||||
--exclude='**/.vscode' \
|
||||
--exclude='deployment' \
|
||||
--exclude='**/bin' \
|
||||
--exclude='**/obj' \
|
||||
--exclude='**/.nuget' \
|
||||
--exclude='*.deb' \
|
||||
--exclude='*.rpm' \
|
||||
-czf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \
|
||||
-C ${SOURCE_DIR} ./
|
||||
echo "Extracting filtered package."
|
||||
mkdir -p "${package_temporary_dir}/jellyfin-${VERSION}"
|
||||
tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}"
|
||||
echo "Removing filtered package."
|
||||
rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz"
|
||||
echo "Repackaging package into final tarball."
|
||||
tar -czf "${SOURCE_DIR}/SOURCES/pkg-src/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}"
|
||||
rm -rf ${package_temporary_dir}
|
||||
fi
|
||||
|
||||
# Build RPM
|
||||
spectool -g -R SPECS/jellyfin.spec
|
||||
rpmbuild -bs SPECS/jellyfin.spec --define "_sourcedir ${SOURCE_DIR}/SOURCES/pkg-src/"
|
||||
|
||||
@@ -7,11 +7,9 @@ for arg in ${args}; do
|
||||
done
|
||||
|
||||
WORKDIR="$( pwd )"
|
||||
VERSION="$( grep '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )"
|
||||
|
||||
package_temporary_dir="${WORKDIR}/pkg-dist-tmp"
|
||||
output_dir="${WORKDIR}/pkg-dist"
|
||||
pkg_src_dir="${WORKDIR}/pkg-src"
|
||||
current_user="$( whoami )"
|
||||
image_name="jellyfin-centos-build"
|
||||
|
||||
@@ -25,53 +23,8 @@ else
|
||||
docker_sudo=""
|
||||
fi
|
||||
|
||||
# Create RPM source archive
|
||||
GNU_TAR=1
|
||||
# Prepare temporary package dir
|
||||
mkdir -p "${package_temporary_dir}"
|
||||
echo "Bundling all sources for RPM build."
|
||||
tar \
|
||||
--transform "s,^\.,jellyfin-${VERSION}," \
|
||||
--exclude='.git*' \
|
||||
--exclude='**/.git' \
|
||||
--exclude='**/.hg' \
|
||||
--exclude='**/.vs' \
|
||||
--exclude='**/.vscode' \
|
||||
--exclude='deployment' \
|
||||
--exclude='**/bin' \
|
||||
--exclude='**/obj' \
|
||||
--exclude='**/.nuget' \
|
||||
--exclude='*.deb' \
|
||||
--exclude='*.rpm' \
|
||||
-czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" \
|
||||
-C "../.." ./ || GNU_TAR=0
|
||||
|
||||
if [ $GNU_TAR -eq 0 ]; then
|
||||
echo "The installed tar binary did not support --transform. Using workaround."
|
||||
mkdir -p "${package_temporary_dir}/jellyfin"
|
||||
# Not GNU tar
|
||||
tar \
|
||||
--exclude='.git*' \
|
||||
--exclude='**/.git' \
|
||||
--exclude='**/.hg' \
|
||||
--exclude='**/.vs' \
|
||||
--exclude='**/.vscode' \
|
||||
--exclude='deployment' \
|
||||
--exclude='**/bin' \
|
||||
--exclude='**/obj' \
|
||||
--exclude='**/.nuget' \
|
||||
--exclude='*.deb' \
|
||||
--exclude='*.rpm' \
|
||||
-zcf \
|
||||
"${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \
|
||||
-C "../.." ./
|
||||
echo "Extracting filtered package."
|
||||
tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}"
|
||||
echo "Removing filtered package."
|
||||
rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz"
|
||||
echo "Repackaging package into final tarball."
|
||||
tar -czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}"
|
||||
fi
|
||||
|
||||
# Set up the build environment Docker image
|
||||
${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile
|
||||
# Build the RPMs and copy out to ${package_temporary_dir}
|
||||
|
||||
Reference in New Issue
Block a user