浏览代码

Added git submodules command. Converted RPM to build from local tree. Added all the execution bits to the build scripts.

Erwin de Haan 6 年之前
父节点
当前提交
74507099ad

+ 1 - 0
.gitignore

@@ -260,5 +260,6 @@ deployment/debian-package-x64/pkg-src/jellyfin/
 
 deployment/**/dist/
 deployment/**/pkg-dist/
+deployment/**/pkg-dist-tmp/
 deployment/collect-dist/
 

+ 10 - 3
deployment/build.sh

@@ -1,5 +1,12 @@
 #!/usr/bin/env bash
 
+git submodule update --init --recursive
+
+pushd ../Jellyfin.Versioning
+#TODO Uncomment the next line with PR is merged.
+#./update-version
+popd
+
 # Execute all build.sh and package.sh and sign.sh scripts in every folder. In that order. Script should check for artifacts themselves.
 echo "Running for platforms '$@'."
 for directory in */ ; do
@@ -8,13 +15,13 @@ for directory in */ ; do
         echo "Processing ${platform}"
         pushd "$platform"
         if [ -f build.sh ]; then
-            echo ./build.sh 
+            ./build.sh 
         fi  
         if [ -f package.sh ]; then
-            echo ./package.sh
+            ./package.sh
         fi
         if [ -f sign.sh ]; then
-            echo ./sign.sh
+            ./sign.sh
         fi
         popd
     else

+ 1 - 1
deployment/clean.sh

@@ -15,6 +15,6 @@ do
     echo "Collecting everything from '$directory'.."
     PLATFORM=$(basename "$(dirname "$directory")")
     # Copy all artifacts with extensions tar.gz, deb, exe, zip, rpm and add the platform name to resolve any duplicates.
-    find $directory \( -name "jellyfin*.tar.gz" -o -name "jellyfin*.deb" -o -name "jellyfin*.rpm" -o -name "jellyfin*.zip" -o -name "jellyfin*.exe" \) -exec sh -c 'cp "$1" "'${COLLECT_DIR}'/jellyfin_'${PLATFORM}'_${1#*jellyfin_}"' _ {} \;
+    find $directory \( -name "jellyfin*.tar.gz" -o -name "jellyfin*.deb" -o -name "jellyfin*.rpm" -o -name "jellyfin*.zip" -o -name "jellyfin*.exe" \) -exec sh -c 'cp "$1" "'${COLLECT_DIR}'/jellyfin_'${PLATFORM}'_${1#*jellyfin}"' _ {} \;
 
 done <<< "${DIRS}"

+ 1 - 1
deployment/common.build.sh

@@ -7,7 +7,7 @@ RUN mkdir /build && \
 
 WORKDIR /build/rpmbuild
 COPY ./deployment/fedora-package-x64/pkg-src/jellyfin.spec SPECS
-COPY . SOURCES
+COPY ./deployment/fedora-package-x64/pkg-src/ SOURCES
 
 RUN spectool -g -R SPECS/jellyfin.spec && \
     rpmbuild -bs SPECS/jellyfin.spec && \

+ 7 - 0
deployment/fedora-package-x64/clean.sh

@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}

+ 53 - 4
deployment/fedora-package-x64/package.sh

@@ -15,6 +15,7 @@ set -o nounset
 
 package_temporary_dir="`pwd`/pkg-dist-tmp"
 output_dir="`pwd`/pkg-dist"
+pkg_src_dir="`pwd`/pkg-src"
 current_user="`whoami`"
 image_name="jellyfin-rpmbuild"
 
@@ -22,16 +23,64 @@ cleanup() {
     set +o errexit
     docker image rm $image_name --force
     rm -rf "$package_temporary_dir"
+    rm -rf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz"
 }
 trap cleanup EXIT INT
-
-docker build ../.. -t "$image_name" -f ./Dockerfile.fedora_package
+GNU_TAR=1
 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' \
+-Jcvf \
+"$package_temporary_dir/jellyfin-${VERSION}.tar.xz" \
+-C "../.." \
+./ || true && 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-${VERSION}"
+    # 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-${VERSION}/jellyfin.tar.gz" \
+    -C "../.." \
+    ./
+    echo "Extracting filtered package."
+    tar -xzf "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz" -C "$package_temporary_dir/jellyfin-${VERSION}"
+    echo "Removing filtered package."
+    rm "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz"
+    echo "Repackaging package into final tarball."
+    tar -zcf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz" -C "$package_temporary_dir" "jellyfin-${VERSION}"
+fi
+
+docker build ../.. -t "$image_name" -f ./Dockerfile
 mkdir -p "$output_dir"
-docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find / -maxdepth 1 -type f -name "jellyfin*" -exec mv {} /temp \;'
+docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find /build/rpmbuild -maxdepth 3 -type f -name "jellyfin*.rpm" -exec mv {} /temp \;'
 chown -R "$current_user" "$package_temporary_dir"
 if [ $? -ne 0 ]; then
 	# Some platforms need this to chown the file properly. (Platforms with native docker, not just the client)
     sudo chown -R "$current_user" "$package_temporary_dir"
 fi
-mv "$package_temporary_dir"/* "$output_dir"
+mv "$package_temporary_dir"/*.rpm "$output_dir"

+ 9 - 18
deployment/fedora-package-x64/pkg-src/jellyfin.spec

@@ -1,24 +1,23 @@
 %global         debug_package %{nil}
 # jellyfin tag to package
-%global         gittag v10.0.2
+%global         gittag v10.0.1
 # Taglib-sharp commit of the submodule since github archive doesn't include submodules
 %global         taglib_commit ee5ab21742b71fd1b87ee24895582327e9e04776
 %global         taglib_shortcommit %(c=%{taglib_commit}; echo ${c:0:7})
 
 Name:           jellyfin
-Version:        10.0.2
+Version:        10.0.1
 Release:        1%{?dist}
-Summary:        The Free Software Media Browser.
+Summary:        The Free Software Media Browser
 License:        GPLv2
 URL:            https://jellyfin.media
-Source0:        https://github.com/%{name}/%{name}/archive/%{gittag}.tar.gz
+Source0:        %{name}-%{version}.tar.gz
 Source1:        jellyfin.service
 Source2:        jellyfin.env
 Source3:        jellyfin.sudoers
 Source4:        restart.sh
-Source5:        https://github.com/mono/taglib-sharp/archive/%{taglib_commit}/taglib-sharp-%{taglib_shortcommit}.tar.gz
-Source6:        jellyfin.override.conf
-Source7:        jellyfin-firewalld.xml
+Source5:        jellyfin.override.conf
+Source6:        jellyfin-firewalld.xml
 
 %{?systemd_requires}
 BuildRequires:  systemd
@@ -45,23 +44,15 @@ Jellyfin is a free software media system that puts you in control of managing an
 
 %prep
 %autosetup -n %{name}-%{version}
-pushd ThirdParty
-    tar xf %{S:5}
-    rm -rf taglib-sharp
-    mv taglib-sharp-%{taglib_commit} taglib-sharp
-popd
 
 %build
-export DOTNET_CLI_TELEMETRY_OPTOUT=1
-export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-dotnet build --runtime fedora-x64 Jellyfin.Server
 
 %install
 export DOTNET_CLI_TELEMETRY_OPTOUT=1
 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
 dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime fedora-x64 Jellyfin.Server
 %{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
-%{__install} -D -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
+%{__install} -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
 %{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/%{name}/logging.json
 %{__mkdir} -p %{buildroot}%{_bindir}
 tee %{buildroot}%{_bindir}/jellyfin << EOF
@@ -76,10 +67,10 @@ EOF
 %{__install} -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
 %{__install} -D -m 0600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers.d/%{name}-sudoers
 %{__install} -D -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/%{name}/restart.sh
-%{__install} -D -m 0644 %{SOURCE7} %{buildroot}%{_prefix}/lib/firewalld/service/%{name}.xml
+%{__install} -D -m 0644 %{SOURCE6} %{buildroot}%{_prefix}/lib/firewalld/service/%{name}.xml
 
 %files
-%{_libdir}/%{name}/dashboard-ui/*
+%{_libdir}/%{name}/jellyfin-web/*
 %attr(755,root,root) %{_bindir}/%{name}
 %{_libdir}/%{name}/*.json
 %{_libdir}/%{name}/*.pdb

+ 0 - 0
deployment/framework/build.sh