From 74507099ad2239e33e22486d392167eada57624f Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sat, 12 Jan 2019 01:49:46 +0100 Subject: [PATCH] Added git submodules command. Converted RPM to build from local tree. Added all the execution bits to the build scripts. --- .gitignore | 1 + deployment/build.sh | 13 ++++- deployment/clean.sh | 0 deployment/collect_all.sh | 2 +- deployment/common.build.sh | 0 deployment/debian-package-x64/clean.sh | 0 deployment/debian-package-x64/package.sh | 0 deployment/debian-x64/build.sh | 0 deployment/debian-x64/clean.sh | 0 deployment/debian-x64/package.sh | 0 deployment/docker/build.sh | 0 deployment/fedora-package-x64/Dockerfile | 2 +- deployment/fedora-package-x64/clean.sh | 7 +++ deployment/fedora-package-x64/package.sh | 57 +++++++++++++++++-- .../fedora-package-x64/pkg-src/jellyfin.spec | 27 +++------ deployment/framework/build.sh | 0 deployment/framework/clean.sh | 0 deployment/framework/package.sh | 0 deployment/linux-x64/build.sh | 0 deployment/linux-x64/clean.sh | 0 deployment/linux-x64/package.sh | 0 deployment/osx-x64/build.sh | 0 deployment/osx-x64/clean.sh | 0 deployment/osx-x64/package.sh | 0 deployment/ubuntu-x64/build.sh | 0 deployment/ubuntu-x64/clean.sh | 0 deployment/ubuntu-x64/package.sh | 0 deployment/win-x64/build.sh | 0 deployment/win-x64/clean.sh | 0 deployment/win-x64/package.sh | 0 deployment/win-x86/build.sh | 0 deployment/win-x86/clean.sh | 0 deployment/win-x86/package.sh | 0 33 files changed, 82 insertions(+), 27 deletions(-) mode change 100644 => 100755 deployment/build.sh mode change 100644 => 100755 deployment/clean.sh mode change 100644 => 100755 deployment/collect_all.sh mode change 100644 => 100755 deployment/common.build.sh mode change 100644 => 100755 deployment/debian-package-x64/clean.sh mode change 100644 => 100755 deployment/debian-package-x64/package.sh mode change 100644 => 100755 deployment/debian-x64/build.sh mode change 100644 => 100755 deployment/debian-x64/clean.sh mode change 100644 => 100755 deployment/debian-x64/package.sh mode change 100644 => 100755 deployment/docker/build.sh create mode 100755 deployment/fedora-package-x64/clean.sh mode change 100644 => 100755 deployment/fedora-package-x64/package.sh mode change 100644 => 100755 deployment/framework/build.sh mode change 100644 => 100755 deployment/framework/clean.sh mode change 100644 => 100755 deployment/framework/package.sh mode change 100644 => 100755 deployment/linux-x64/build.sh mode change 100644 => 100755 deployment/linux-x64/clean.sh mode change 100644 => 100755 deployment/linux-x64/package.sh mode change 100644 => 100755 deployment/osx-x64/build.sh mode change 100644 => 100755 deployment/osx-x64/clean.sh mode change 100644 => 100755 deployment/osx-x64/package.sh mode change 100644 => 100755 deployment/ubuntu-x64/build.sh mode change 100644 => 100755 deployment/ubuntu-x64/clean.sh mode change 100644 => 100755 deployment/ubuntu-x64/package.sh mode change 100644 => 100755 deployment/win-x64/build.sh mode change 100644 => 100755 deployment/win-x64/clean.sh mode change 100644 => 100755 deployment/win-x64/package.sh mode change 100644 => 100755 deployment/win-x86/build.sh mode change 100644 => 100755 deployment/win-x86/clean.sh mode change 100644 => 100755 deployment/win-x86/package.sh diff --git a/.gitignore b/.gitignore index a719ec32b..ec683f38f 100644 --- a/.gitignore +++ b/.gitignore @@ -260,5 +260,6 @@ deployment/debian-package-x64/pkg-src/jellyfin/ deployment/**/dist/ deployment/**/pkg-dist/ +deployment/**/pkg-dist-tmp/ deployment/collect-dist/ diff --git a/deployment/build.sh b/deployment/build.sh old mode 100644 new mode 100755 index 0b5dae84a..5628d3ad5 --- a/deployment/build.sh +++ b/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 diff --git a/deployment/clean.sh b/deployment/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/collect_all.sh b/deployment/collect_all.sh old mode 100644 new mode 100755 index d625002db..69babe55e --- a/deployment/collect_all.sh +++ b/deployment/collect_all.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}" diff --git a/deployment/common.build.sh b/deployment/common.build.sh old mode 100644 new mode 100755 diff --git a/deployment/debian-package-x64/clean.sh b/deployment/debian-package-x64/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/debian-package-x64/package.sh b/deployment/debian-package-x64/package.sh old mode 100644 new mode 100755 diff --git a/deployment/debian-x64/build.sh b/deployment/debian-x64/build.sh old mode 100644 new mode 100755 diff --git a/deployment/debian-x64/clean.sh b/deployment/debian-x64/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/debian-x64/package.sh b/deployment/debian-x64/package.sh old mode 100644 new mode 100755 diff --git a/deployment/docker/build.sh b/deployment/docker/build.sh old mode 100644 new mode 100755 diff --git a/deployment/fedora-package-x64/Dockerfile b/deployment/fedora-package-x64/Dockerfile index 64367d127..e5deac29f 100644 --- a/deployment/fedora-package-x64/Dockerfile +++ b/deployment/fedora-package-x64/Dockerfile @@ -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 && \ diff --git a/deployment/fedora-package-x64/clean.sh b/deployment/fedora-package-x64/clean.sh new file mode 100755 index 000000000..3df2d7796 --- /dev/null +++ b/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} diff --git a/deployment/fedora-package-x64/package.sh b/deployment/fedora-package-x64/package.sh old mode 100644 new mode 100755 index 6f18b8cc3..56a120844 --- a/deployment/fedora-package-x64/package.sh +++ b/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" diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.spec b/deployment/fedora-package-x64/pkg-src/jellyfin.spec index b008ec834..406dc399d 100644 --- a/deployment/fedora-package-x64/pkg-src/jellyfin.spec +++ b/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 diff --git a/deployment/framework/build.sh b/deployment/framework/build.sh old mode 100644 new mode 100755 diff --git a/deployment/framework/clean.sh b/deployment/framework/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/framework/package.sh b/deployment/framework/package.sh old mode 100644 new mode 100755 diff --git a/deployment/linux-x64/build.sh b/deployment/linux-x64/build.sh old mode 100644 new mode 100755 diff --git a/deployment/linux-x64/clean.sh b/deployment/linux-x64/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/linux-x64/package.sh b/deployment/linux-x64/package.sh old mode 100644 new mode 100755 diff --git a/deployment/osx-x64/build.sh b/deployment/osx-x64/build.sh old mode 100644 new mode 100755 diff --git a/deployment/osx-x64/clean.sh b/deployment/osx-x64/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/osx-x64/package.sh b/deployment/osx-x64/package.sh old mode 100644 new mode 100755 diff --git a/deployment/ubuntu-x64/build.sh b/deployment/ubuntu-x64/build.sh old mode 100644 new mode 100755 diff --git a/deployment/ubuntu-x64/clean.sh b/deployment/ubuntu-x64/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/ubuntu-x64/package.sh b/deployment/ubuntu-x64/package.sh old mode 100644 new mode 100755 diff --git a/deployment/win-x64/build.sh b/deployment/win-x64/build.sh old mode 100644 new mode 100755 diff --git a/deployment/win-x64/clean.sh b/deployment/win-x64/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/win-x64/package.sh b/deployment/win-x64/package.sh old mode 100644 new mode 100755 diff --git a/deployment/win-x86/build.sh b/deployment/win-x86/build.sh old mode 100644 new mode 100755 diff --git a/deployment/win-x86/clean.sh b/deployment/win-x86/clean.sh old mode 100644 new mode 100755 diff --git a/deployment/win-x86/package.sh b/deployment/win-x86/package.sh old mode 100644 new mode 100755