From d42ef36bf9957d95e0594b5fdc843ead6ea54433 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 01:21:14 -0500 Subject: [PATCH 01/13] Correct invalid changelog entry --- deployment/debian-package-x64/pkg-src/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deployment/debian-package-x64/pkg-src/changelog b/deployment/debian-package-x64/pkg-src/changelog index f7a1994b76..825412d893 100644 --- a/deployment/debian-package-x64/pkg-src/changelog +++ b/deployment/debian-package-x64/pkg-src/changelog @@ -6,6 +6,8 @@ jellyfin (10.0.2-1) unstable; urgency=medium * #541: Change ItemId to Guid in ProviderManager * #566: Avoid printing stacktrace when bind to port 1900 fails + -- Joshua Boniface Sat, 19 Jan 2019 01:19:59 -0500 + jellyfin (10.0.1-1) unstable; urgency=medium * Hotfix release, corrects several small bugs from 10.0.0 From f952988fb34a266b64953b23db6c76ad2777dc4a Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 01:22:41 -0500 Subject: [PATCH 02/13] Add new centralized build script and README --- build | 199 +++++++++++++++++++++++++++++++++++++ deployment/README.md | 107 +++++++++++++++++++- deployment/clean.sh | 21 ---- deployment/collect_all.sh | 20 ---- deployment/common.build.sh | 18 ++-- deployment/make.sh | 34 ------- 6 files changed, 312 insertions(+), 87 deletions(-) create mode 100755 build delete mode 100755 deployment/clean.sh delete mode 100755 deployment/collect_all.sh delete mode 100755 deployment/make.sh diff --git a/build b/build new file mode 100755 index 0000000000..e9c288ff53 --- /dev/null +++ b/build @@ -0,0 +1,199 @@ +#!/usr/bin/env bash + +# build - build Jellyfin binaries or packages + +set -o errexit +set -o pipefail + +# The list of possible package actions (except 'clean') +declare -a actions=( 'build' 'package' 'sign' 'publish' ) + +# The list of possible platforms, based on directories under 'deployment/' +declare -a platforms=( $( + find deployment/ -maxdepth 1 -mindepth 1 -type d | sed 's/deployment\///' | sort +) ) + +# The list of standard dependencies required by all build scripts; individual +# action scripts may specify their own dependencies +declare -a dependencies +dependencies=( 'tar' 'zip' 'dotnet' ) + +usage() { + echo -e "build - build Jellyfin binaries or packages" + echo -e "" + echo -e "Usage:" + echo -e " $ build --list-platforms" + echo -e " $ build --list-actions " + echo -e " $ build [-b/--web-branch ] " + echo -e "" + echo -e "The web_branch defaults to 'master'." + echo -e "To build all platforms, use 'all'." + echo -e "To perform all build actions, use 'all'." + echo -e "Build output files are collected at '../jellyfin-build/'." +} + +if [[ -z $1 ]]; then + usage + exit 0 +fi + +# List all available platforms then exit +if [[ $1 == '--list-platforms' ]]; then + echo -e "Available platforms:" + for platform in ${platforms[@]}; do + echo -e " ${platform}" + done + exit 0 +fi + +# List all available actions for a given platform then exit +if [[ $1 == '--list-actions' ]]; then + platform="$2" + if [[ ! " ${platforms[@]} " =~ " ${platform} " ]]; then + echo "ERROR: Platform $platform does not exist." + exit 1 + fi + echo -e "Available actions for platform ${platform}:" + for action in ${actions[@]}; do + if [[ -f deployment/${platform}/${action}.sh ]]; then + echo -e " ${action}" + fi + done + exit 0 +fi + +# Parse branch option +if [[ $1 == '-b' || $1 == '--web-branch' ]]; then + web_branch="$2" + shift 2 +else + web_branch="master" +fi + +# Parse platform option +if [[ -n $1 ]]; then + cli_platform="$1" + shift +else + echo "ERROR: A platform must be specified. Use 'all' to specify all platforms." + exit 1 +fi +if [[ $cli_platform == 'all' ]]; then + declare -a platform=( ${platforms[@]} ) +else + if [[ ! " ${platforms[@]} " =~ " ${cli_platform} " ]]; then + echo "ERROR: Platform $cli_platform is invalid. Use the '--list-platforms' option to list available platforms." + exit 1 + else + declare -a platform=( "${cli_platform}" ) + fi +fi + +# Parse action option +if [[ -n $1 ]]; then + cli_action="$1" + shift +else + echo "ERROR: An action must be specified. Use 'all' to specify all actions." + exit 1 +fi +if [[ $cli_action == 'all' ]]; then + declare -a action=( ${actions[@]} ) +else + if [[ ! " ${actions[@]} " =~ " ${cli_action} " ]]; then + echo "ERROR: Action $cli_action is invalid. Use the '--list-actions ' option to list available actions." + exit 1 + else + declare -a action=( "${cli_action}" ) + fi +fi + +# Verify required utilities are installed +missing_deps=() +for utility in ${dependencies[@]}; do + if ! which ${utility} &>/dev/null; then + missing_deps+=( ${utility} ) + fi +done + +# Error if we're missing anything +if [[ ${#missing_deps[@]} -gt 0 ]]; then + echo -e "ERROR: This script requires the following missing utilities:" + for utility in ${missing_deps[@]}; do + echo -e " ${utility}" + done + exit 1 +fi + +# Parse platform-specific dependencies +for target_platform in ${platform[@]}; do + # Read platform-specific dependencies + if [[ -f deployment/${target_platform}/dependencies.txt ]]; then + platform_dependencies="$( grep -v '^#' deployment/${target_platform}/dependencies.txt )" + + # Verify required utilities are installed + missing_deps=() + for utility in ${platform_dependencies[@]}; do + if ! which ${utility} &>/dev/null; then + missing_deps+=( ${utility} ) + fi + done + + # Error if we're missing anything + if [[ ${#missing_deps[@]} -gt 0 ]]; then + echo -e "ERROR: The ${target_platform} platform requires the following utilities:" + for utility in ${missing_deps[@]}; do + echo -e " ${utility}" + done + exit 1 + fi + fi +done + +# Initialize submodules +git submodule update --init --recursive + +# configure branch +pushd MediaBrowser.WebDashboard/jellyfin-web + +if ! git diff-index --quiet HEAD --; then + popd + echo + echo "ERROR: Your 'jellyfin-web' submodule working directory is not clean!" + echo "This script will overwrite your unstaged and unpushed changes." + echo "Please do development on 'jellyfin-web' outside of the submodule." + exit 1 +fi + +git fetch --all +git checkout origin/${web_branch} || { + echo "Error: 'jellyfin-web' branch ${web_branch} is invalid." + exit 1 +} +popd + +# Execute each platform and action in order, if said action is enabled +pushd deployment/ +for target_platform in ${platform[@]}; do + echo -e "> Processing platform ${target_platform}" + pushd ${target_platform} + for target_action in ${action[@]}; do + echo -e ">> Processing action ${target_action}" + if [[ -f ${target_action}.sh && -x ${target_action}.sh ]]; then + ./${target_action}.sh + fi + done + if [[ -d pkg-dist/ ]]; then + echo -e ">> Collecting build artifacts" + target_dir="../../../jellyfin-build/${target_platform}" + mkdir -p ${target_dir} + mv pkg-dist/* ${target_dir}/ + + echo -e ">> Processing action clean" + if [[ -f clean.sh && -x clean.sh ]]; then + ./clean.sh + fi + fi + popd +done +popd diff --git a/deployment/README.md b/deployment/README.md index 3400fd8400..f598028eb1 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -1,8 +1,105 @@ -# Build scripts +# Jellyfin Packaging -All `build.sh` and `package.sh` scripts are for *nix platforms (or WSL on Windows 10). +This directory contains the packaging configuration of Jellyfin for multiple platforms. The specification is below; all package platforms must follow the specification to be compatable with the central `build` script. -After running both, check the `*/pkg-dist/` folders for the archives and packages. +## Package List + +### Operating System Packages + +* `debian-package-x64`: Package for Debian and Ubuntu amd64 systems. +* `fedora-package-x64`: Package for Fedora, CentOS, and Red Hat Enterprise Linux amd64 systems. + +### Portable Builds (archives) + +* `debian-x64`: Portable binary archive for Debian amd64 systems. +* `ubuntu-x64`: Portable binary archive for Ubuntu amd64 systems. +* `linux-x64`: Portable binary archive for generic Linux amd64 systems. +* `osx-x64`: Portable binary archive for MacOS amd64 systems. +* `win-x64`: Portable binary archive for Windows amd64 systems. +* `win-x86`: Portable binary archive for Windows i386 systems. + +### Other Builds + +These builds are not necessarily run from the `build` script, but are present for other platforms. + +* `framework`: Compiled `.dll` for use with .NET Core runtime on any system. +* `docker`: Docker manifests for auto-publishing. +* `unraid`: unRaid Docker template; not built by `build` but imported into unRaid directly. +* `win-generic`: Portable binary for generic Windows systems. + +## Package Specification + +### Action Scripts + +* Actions are defined in BASH scripts with the name `.sh` within the framework directory. + +* The list of valid actions are: + + 1. `build`: Builds a set of binaries. + 2. `package`: Assembles the compiled binaries into a package. + 3. `sign`: Performs signing actions on a package. + 4. `publish`: Performs a publishing action for a package. + 5. `clean`: Cleans up any artifacts from the previous actions. + +* All package actions are optional, however at least one should generate output files, and any that do should contain a `clean` action. + +* Actions are executed in the order specified above, and later actions may depend on former actions. + +* Actions except for `clean` should `set -o errexit` to terminate on failed actions. + +* The `clean` action should always `exit 0` even if no work is done or it fails. + +### Output Files + +* Upon completion of the defined actions, at least one output file must be created in the `/pkg-dist` directory. + +* Output files will be moved to the directory `jellyfin-build/` one directory above the repository root upon completion. + +### Common Functions + +* A number of common functions are defined in `deployment/common.build.sh` for use by platform scripts. + +* Each action script should import the common functions to define a number of standard variables. + +* The common variables are: + + * `ROOT`: The Jellyfin repostiory root, usually `../..`. + * `CONFIG`: The .NET config, usually `Release`. + * `DOTNETRUNTIME`: The .NET `--runtime` value, platform-dependent. + * `OUTPUT_DIR`: The intermediate output dir, usually `./dist/jellyfin_${VERSION}`. + * `BUILD_CONTEXT`: The Docker build context, usually `../..`. + * `DOCKERFILE`: The Dockerfile, usually `Dockerfile` in the platform directory. + * `IMAGE_TAG`: A tag for the built Docker image. + * `PKG_DIR`: The final binary output directory for collection, invariably `pkg-dist`. + * `ARCHIVE_CMD`: The compression/archive command for release archives, usually `tar -xvzf` or `zip`. + +#### `get_version` + +Reads the version information from `SharedVersion.cs`. + +**Arguments:** `ROOT` + +#### `build_jellyfin` + +Build a standard self-contained binary in the current OS context. + +**Arguments:** `ROOT` `CONFIG` `DOTNETRUNTIME` `OUTPUT_DIR` + +#### `build_jellyfin_docker` + +Build a standard self-contained binary in a Docker image. + +**Arguments:** `BUILD_CONTEXT` `DOCKERFILE` `IMAGE_TAG` + +#### `clean_jellyfin` + +Clean up a build for housekeeping. + +**Arguments:** `ROOT` `CONFIG` `OUTPUT_DIR` `PKG_DIR` + +#### `package_portable` + +Produce a compressed archive. + +**Arguments:** `ROOT` `OUTPUT_DIR` `PKG_DIR` `ARCHIVE_CMD` -`build_all.sh` will invoke every build and package script. -Use `collect_all.sh` to copy all artifact to one directory for easy uploading. diff --git a/deployment/clean.sh b/deployment/clean.sh deleted file mode 100755 index 7517cf8493..0000000000 --- a/deployment/clean.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Execute every clean.sh scripts in every folder. -echo "Running for platforms '$@'." -for directory in */ ; do - platform=`basename "${directory}"` - if [[ $@ == *"$platform"* || $@ = *"all"* ]]; then - echo "Processing ${platform}" - pushd "$platform" - if [ -f clean.sh ]; then - echo ./clean.sh - fi - popd - else - echo "Skipping $platform." - fi -done - -rm -rf ./collect-dist diff --git a/deployment/collect_all.sh b/deployment/collect_all.sh deleted file mode 100755 index 69babe55e1..0000000000 --- a/deployment/collect_all.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -source common.build.sh - -VERSION=`get_version ..` - -COLLECT_DIR="./collect-dist" - -mkdir -p ./collect-dist - -DIRS=`find . -type d -name "pkg-dist"` - -while read directory -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}"' _ {} \; - -done <<< "${DIRS}" diff --git a/deployment/common.build.sh b/deployment/common.build.sh index a368928bab..7392fd4015 100755 --- a/deployment/common.build.sh +++ b/deployment/common.build.sh @@ -16,6 +16,16 @@ DEFAULT_OUTPUT_DIR="dist/jellyfin-git" DEFAULT_PKG_DIR="pkg-dist" DEFAULT_DOCKERFILE="Dockerfile" DEFAULT_IMAGE_TAG="jellyfin:"`git rev-parse --abbrev-ref HEAD` +DEFAULT_ARCHIVE_CMD="tar -xvzf" + +# Parse the version from the AssemblyVersion +get_version() +( + local ROOT=${1-$DEFAULT_ROOT} + grep "AssemblyVersion" ${ROOT}/SharedVersion.cs \ + | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/' \ + | sed -E 's/.0$//' +) # Run a build build_jellyfin() @@ -77,19 +87,13 @@ clean_jellyfin() fi ) -# Parse the version from the AssemblyVersion -get_version() -( - local ROOT=${1-$DEFAULT_ROOT} - grep "AssemblyVersion" ${ROOT}/SharedVersion.cs | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/' | sed -E 's/.0$//' -) - # Packages the output folder into an archive. package_portable() ( local ROOT=${1-$DEFAULT_ROOT} local OUTPUT_DIR=${2-$DEFAULT_OUTPUT_DIR} local PKG_DIR=${3-$DEFAULT_PKG_DIR} + local ARCHIVE_CMD=${4-$DEFAULT_ARCHIVE_CMD} # Package portable build result if [ -d ${OUTPUT_DIR} ]; then echo -e "${CYAN}Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}'.${NC}" diff --git a/deployment/make.sh b/deployment/make.sh deleted file mode 100755 index 6b8d8de083..0000000000 --- a/deployment/make.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -git submodule update --init --recursive - -pushd ../Jellyfin.Versioning -./update-version -popd - -#TODO enabled proper flag parsing for enabling and disabling building, signing, packaging and publishing - -# Execute all build.sh, package.sh, sign.sh and publish.sh scripts in every folder. In that order. Script should check for artifacts themselves. -echo "Running for platforms '$@'." -for directory in */ ; do - platform=`basename "${directory}"` - if [[ $@ == *"$platform"* || $@ = *"all"* ]]; then - echo "Processing ${platform}" - pushd "$platform" - if [ -f build.sh ]; then - ./build.sh - fi - if [ -f package.sh ]; then - ./package.sh - fi - if [ -f sign.sh ]; then - ./sign.sh - fi - if [ -f publish.sh ]; then - ./publish.sh - fi - popd - else - echo "Skipping $platform." - fi -done From edfd950aad5f79d0cfabacf79674a323f1d93520 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 18:11:01 -0500 Subject: [PATCH 03/13] Add bump_version script --- bump_version | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100755 bump_version diff --git a/bump_version b/bump_version new file mode 100755 index 0000000000..0e849c4678 --- /dev/null +++ b/bump_version @@ -0,0 +1,189 @@ +#!/usr/bin/env bash + +# bump_version - increase the shared version and generate changelogs + +set -o errexit +set -o pipefail + +usage() { + echo -e "bump_version - increase the shared version and generate changelogs" + echo -e "" + echo -e "Usage:" + echo -e " $ bump_version [-b/--web-branch ] " + echo -e "" + echo -e "The web_branch defaults to the same branch name as the current main branch." + echo -e "This helps facilitate releases where both branches would be called release-X.Y.Z" + echo -e "and would already be created before running this script." +} + +if [[ -z $1 ]]; then + usage + exit 1 +fi + +shared_version_file="./SharedVersion.cs" + +# Parse branch option +if [[ $1 == '-b' || $1 == '--web-branch' ]]; then + web_branch="$2" + shift 2 +else + web_branch="$( git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' )" +fi + +# Initialize submodules +git submodule update --init --recursive + +# configure branch +pushd MediaBrowser.WebDashboard/jellyfin-web +git fetch --all +git checkout origin/${web_branch} || { + echo "jellyfin-web branch ${web_branch} is invalid." + exit 1 +} +popd + +new_version="$1" + +# Parse the version from the AssemblyVersion +old_version="$( + grep "AssemblyVersion" ${shared_version_file} \ + | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/' \ + | sed -E 's/.0$//' +)" + +# Set the shared version to the specified new_version +old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' chars +sed -i "s/${old_version_sed}/${new_version}/g" ${shared_version_file} + +declare -a pr_merges_since_last_master +declare changelog_string_github +declare changelog_string_deb +declare changelog_string_yum + +# Build up a changelog from merge commits +for repo in ./ MediaBrowser.WebDashboard/jellyfin-web/; do + last_master_merge_commit="" + pr_merges_since_last_master=() + git_show_details="" + pull_request_id="" + pull_request_description="" + changelog_strings_repo_github="" + changelog_strings_repo_deb="" + changelog_strings_repo_yum="" + + case $repo in + *jellyfin-web*) + repo_name="jellyfin-web" + ;; + *) + repo_name="jellyfin" + ;; + esac + + pushd ${repo} + + # Find the last release commit, so we know what's happened since + last_master_branch="master-${old_version}" # TODO: Set to `release-` for next release, so we can properly parse both repos with the new branch standard + last_master_merge_commit="$( + git log --merges --pretty=oneline \ + | grep -F "${last_master_branch}" \ + | awk '{ print $1 }' \ + || true # Don't die here with errexit + )" + if [[ -z ${last_master_merge_commit} ]]; then + # This repo has no last proper commit, so just skip it + popd + continue + fi + # Get all the PR merge commits since the last master merge commit in `jellyfin` + pr_merges_since_last_master+=( $( + git log --merges --pretty=oneline ${last_master_merge_commit}..HEAD \ + | grep -F "Merge pull request" \ + | awk '{ print $1 }' + ) ) + + for commit_hash in ${pr_merges_since_last_master[@]}; do + git_show_details="$( git show ${commit_hash} )" + pull_request_id="$( + awk ' + /Merge pull request/{ print $4 } + { next } + ' <<<"${git_show_details}" + )" + pull_request_description="$( + awk ' + /^[a-zA-Z]/{ next } + /^ Merge/{ next } + /^$/{ next } + { print $0 } + ' <<<"${git_show_details}" + )" + pull_request_description="$( sed ':a;N;$!ba;s/\n//g; s/ \+//g' <<<"${pull_request_description}" )" + changelog_strings_repo_github="${changelog_strings_repo_github}\n* ${pull_request_id}: ${pull_request_description}" + changelog_strings_repo_deb="${changelog_strings_repo_deb}\n * $( sed 's/#/PR/' <<<"${pull_request_id}" ) ${pull_request_description}" + changelog_strings_repo_yum="${changelog_strings_repo_yum}\n- $( sed 's/#/PR/' <<<"${pull_request_id}" ) ${pull_request_description}" + done + + changelog_string_github="${changelog_string_github}\n#### ${repo_name}:\n$( echo -e "${changelog_strings_repo_github}" | sort -nk2 )\n" + changelog_string_deb="${changelog_string_deb}\n * ${repo_name}:$( echo -e "${changelog_strings_repo_deb}" | sort -nk2 )" + changelog_string_yum="${changelog_string_yum}\n- ${repo_name}:$( echo -e "${changelog_strings_repo_yum}" | sort -nk2 )" + + popd +done + +# Write out a temporary Debian changelog with our new stuff appended and some templated formatting +debian_changelog_file="deployment/debian-package-x64/pkg-src/changelog" +debian_changelog_temp="$( mktemp )" +# Create new temp file with our changelog +echo -e "### DEBIAN PACKAGE CHANGELOG: Verify this file looks correct or edit accordingly, then delete this line, write, and exit. +jellyfin (${new_version}-1) unstable; urgency=medium +${changelog_string_deb} + +-- Jellyfin Packaging Team $( date --rfc-2822 ) +" >> ${debian_changelog_temp} +cat ${debian_changelog_file} >> ${debian_changelog_temp} +# Edit the file to verify +$EDITOR ${debian_changelog_temp} +# Move into place +mv ${debian_changelog_temp} ${debian_changelog_file} +# Clean up +rm -f ${debian_changelog_temp} + +# Write out a temporary Yum changelog with our new stuff prepended and some templated formatting +fedora_spec_file="deployment/fedora-package-x64/pkg-src/jellyfin.spec" +fedora_changelog_temp="$( mktemp )" +fedora_spec_temp_dir="$( mktemp -d )" +fedora_spec_temp="${fedora_spec_temp_dir}/jellyfin.spec.tmp" +# Make a copy of our spec file for hacking +cp ${fedora_spec_file} ${fedora_spec_temp_dir}/ +pushd ${fedora_spec_temp_dir} +# Split out the stuff before and after changelog +csplit jellyfin.spec "/^%changelog/" # produces xx00 xx01 +# Update the version in xx00 +sed -i "s/${old_version_sed}/${new_version}/g" xx00 +# Remove the header from xx01 +sed -i '/^%changelog/d' xx01 +# Create new temp file with our changelog +echo -e "### YUM SPEC CHANGELOG: Verify this file looks correct or edit accordingly, then delete this line, write, and exit. +%changelog +* $( date '+%a %b %d %Y' ) Jellyfin Packaging Team ${changelog_string_yum}" >> ${fedora_changelog_temp} +cat xx01 >> ${fedora_changelog_temp} +# Edit the file to verify +$EDITOR ${fedora_changelog_temp} +# Reassembble +cat xx00 ${fedora_changelog_temp} > ${fedora_spec_temp} +popd +# Move into place +mv ${fedora_spec_temp} ${fedora_spec_file} +# Clean up +rm -rf ${fedora_changelog_temp} ${fedora_spec_temp_dir} + +# Stage the changed files for commit +git add ${shared_version_file} ${debian_changelog_file} ${fedora_spec_file} +git status + +# Write out the GitHub-formatted changelog for the merge request/release pages +echo "" +echo "=== The GitHub-formatted changelog follows ===" +echo -e "${changelog_string_github}" From 9f8b716f4000a68c1661e481144f5fba538f2a74 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 18:43:19 -0500 Subject: [PATCH 04/13] Add dependencies.txt entries for Docker builds --- deployment/debian-package-x64/dependencies.txt | 1 + deployment/docker/dependencies.txt | 1 + deployment/fedora-package-x64/dependencies.txt | 1 + 3 files changed, 3 insertions(+) create mode 100644 deployment/debian-package-x64/dependencies.txt create mode 100644 deployment/docker/dependencies.txt create mode 100644 deployment/fedora-package-x64/dependencies.txt diff --git a/deployment/debian-package-x64/dependencies.txt b/deployment/debian-package-x64/dependencies.txt new file mode 100644 index 0000000000..bdb9670965 --- /dev/null +++ b/deployment/debian-package-x64/dependencies.txt @@ -0,0 +1 @@ +docker diff --git a/deployment/docker/dependencies.txt b/deployment/docker/dependencies.txt new file mode 100644 index 0000000000..bdb9670965 --- /dev/null +++ b/deployment/docker/dependencies.txt @@ -0,0 +1 @@ +docker diff --git a/deployment/fedora-package-x64/dependencies.txt b/deployment/fedora-package-x64/dependencies.txt new file mode 100644 index 0000000000..bdb9670965 --- /dev/null +++ b/deployment/fedora-package-x64/dependencies.txt @@ -0,0 +1 @@ +docker From 0addc9ef464be3a1e2c1a2912efedf0ded74ca48 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 18:48:48 -0500 Subject: [PATCH 05/13] Add mention of dependencies file per platform --- deployment/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deployment/README.md b/deployment/README.md index f598028eb1..05b4ed51e9 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -29,9 +29,15 @@ These builds are not necessarily run from the `build` script, but are present fo ## Package Specification +### Dependencies + +* If a platform requires additional build dependencies, the required binary names, i.e. to validate `which `, should be specified in a `dependencies.txt` file inside the platform directory. + +* Each dependency should be present on its own line. + ### Action Scripts -* Actions are defined in BASH scripts with the name `.sh` within the framework directory. +* Actions are defined in BASH scripts with the name `.sh` within the platform directory. * The list of valid actions are: From daaa007fea32cf8b12ec947ccd5f0fd5f2b402d4 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 18:57:14 -0500 Subject: [PATCH 06/13] Update YUM spec version --- deployment/fedora-package-x64/pkg-src/jellyfin.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.spec b/deployment/fedora-package-x64/pkg-src/jellyfin.spec index acab6b13bd..e304fe4420 100644 --- a/deployment/fedora-package-x64/pkg-src/jellyfin.spec +++ b/deployment/fedora-package-x64/pkg-src/jellyfin.spec @@ -1,13 +1,13 @@ %global debug_package %{nil} # jellyfin tag to package -%global gittag v10.0.1 +%global gittag v10.0.2 # 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}) AutoReq: no Name: jellyfin -Version: 10.0.1 +Version: 10.0.2 Release: 1%{?dist} Summary: The Free Software Media Browser License: GPLv2 From 85966b54fb6305402deef05fde2289a3e2568a6a Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 21:19:42 -0500 Subject: [PATCH 07/13] Small formatting consistency tweak --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index e9c288ff53..98f2e622a4 100755 --- a/build +++ b/build @@ -167,7 +167,7 @@ fi git fetch --all git checkout origin/${web_branch} || { - echo "Error: 'jellyfin-web' branch ${web_branch} is invalid." + echo "ERROR: 'jellyfin-web' branch ${web_branch} is invalid." exit 1 } popd From 4f14b479bb04cb73b6adc3b186b07650a1a34db3 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 21:56:00 -0500 Subject: [PATCH 08/13] Bashify all variable references --- build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build b/build index 98f2e622a4..fc021397cc 100755 --- a/build +++ b/build @@ -50,7 +50,7 @@ fi if [[ $1 == '--list-actions' ]]; then platform="$2" if [[ ! " ${platforms[@]} " =~ " ${platform} " ]]; then - echo "ERROR: Platform $platform does not exist." + echo "ERROR: Platform ${platform} does not exist." exit 1 fi echo -e "Available actions for platform ${platform}:" @@ -78,11 +78,11 @@ else echo "ERROR: A platform must be specified. Use 'all' to specify all platforms." exit 1 fi -if [[ $cli_platform == 'all' ]]; then +if [[ ${cli_platform} == 'all' ]]; then declare -a platform=( ${platforms[@]} ) else if [[ ! " ${platforms[@]} " =~ " ${cli_platform} " ]]; then - echo "ERROR: Platform $cli_platform is invalid. Use the '--list-platforms' option to list available platforms." + echo "ERROR: Platform ${cli_platform} is invalid. Use the '--list-platforms' option to list available platforms." exit 1 else declare -a platform=( "${cli_platform}" ) @@ -97,11 +97,11 @@ else echo "ERROR: An action must be specified. Use 'all' to specify all actions." exit 1 fi -if [[ $cli_action == 'all' ]]; then +if [[ ${cli_action} == 'all' ]]; then declare -a action=( ${actions[@]} ) else if [[ ! " ${actions[@]} " =~ " ${cli_action} " ]]; then - echo "ERROR: Action $cli_action is invalid. Use the '--list-actions ' option to list available actions." + echo "ERROR: Action ${cli_action} is invalid. Use the '--list-actions ' option to list available actions." exit 1 else declare -a action=( "${cli_action}" ) From 99dfb8549f3c2a633e15efc64c51cb8a7b78bd86 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 21:57:29 -0500 Subject: [PATCH 09/13] Use the same branch for web by default --- build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build b/build index fc021397cc..f50311d0a2 100755 --- a/build +++ b/build @@ -26,7 +26,7 @@ usage() { echo -e " $ build --list-actions " echo -e " $ build [-b/--web-branch ] " echo -e "" - echo -e "The web_branch defaults to 'master'." + echo -e "The web_branch defaults to the same branch name as the current main branch." echo -e "To build all platforms, use 'all'." echo -e "To perform all build actions, use 'all'." echo -e "Build output files are collected at '../jellyfin-build/'." @@ -67,7 +67,7 @@ if [[ $1 == '-b' || $1 == '--web-branch' ]]; then web_branch="$2" shift 2 else - web_branch="master" + web_branch="$( git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' )" fi # Parse platform option From bc18d5341c09bb3e5c122b0e447bb134ce62d81e Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 19 Jan 2019 22:02:19 -0500 Subject: [PATCH 10/13] Make help and usage setup standards-compliant --- build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build b/build index f50311d0a2..9047dd816b 100755 --- a/build +++ b/build @@ -32,7 +32,13 @@ usage() { echo -e "Build output files are collected at '../jellyfin-build/'." } +# Show usage on stderr with exit 1 on argless if [[ -z $1 ]]; then + usage >&2 + exit 1 +fi +# Show usage if -h or --help are specified in the args +if [[ $@ =~ '-h' || $@ =~ '--help' ]]; then usage exit 0 fi From 90b9a9561900d4e59531c9e15749b76728c09f6b Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 20 Jan 2019 12:23:36 -0500 Subject: [PATCH 11/13] Use LANG=C for date in Yum changelog --- bump_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bump_version b/bump_version index 0e849c4678..3f75a93cb6 100755 --- a/bump_version +++ b/bump_version @@ -167,7 +167,7 @@ sed -i '/^%changelog/d' xx01 # Create new temp file with our changelog echo -e "### YUM SPEC CHANGELOG: Verify this file looks correct or edit accordingly, then delete this line, write, and exit. %changelog -* $( date '+%a %b %d %Y' ) Jellyfin Packaging Team ${changelog_string_yum}" >> ${fedora_changelog_temp} +* $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team ${changelog_string_yum}" >> ${fedora_changelog_temp} cat xx01 >> ${fedora_changelog_temp} # Edit the file to verify $EDITOR ${fedora_changelog_temp} From 3320d4feeb22b2015c26a17309818465cf7272b0 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 20 Jan 2019 12:33:15 -0500 Subject: [PATCH 12/13] Move dotnet to a per-platform dependency --- build | 3 +-- deployment/debian-x64/dependencies.txt | 1 + deployment/linux-x64/dependencies.txt | 1 + deployment/osx-x64/dependencies.txt | 1 + deployment/ubuntu-x64/dependencies.txt | 1 + deployment/win-generic/dependencies.txt | 1 + deployment/win-x64/dependencies.txt | 1 + deployment/win-x86/dependencies.txt | 1 + 8 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 deployment/debian-x64/dependencies.txt create mode 100644 deployment/linux-x64/dependencies.txt create mode 100644 deployment/osx-x64/dependencies.txt create mode 100644 deployment/ubuntu-x64/dependencies.txt create mode 100644 deployment/win-generic/dependencies.txt create mode 100644 deployment/win-x64/dependencies.txt create mode 100644 deployment/win-x86/dependencies.txt diff --git a/build b/build index 9047dd816b..c2daddd84a 100755 --- a/build +++ b/build @@ -15,8 +15,7 @@ declare -a platforms=( $( # The list of standard dependencies required by all build scripts; individual # action scripts may specify their own dependencies -declare -a dependencies -dependencies=( 'tar' 'zip' 'dotnet' ) +declare -a dependencies=( 'tar' 'zip' ) usage() { echo -e "build - build Jellyfin binaries or packages" diff --git a/deployment/debian-x64/dependencies.txt b/deployment/debian-x64/dependencies.txt new file mode 100644 index 0000000000..3d25d1bdf4 --- /dev/null +++ b/deployment/debian-x64/dependencies.txt @@ -0,0 +1 @@ +dotnet diff --git a/deployment/linux-x64/dependencies.txt b/deployment/linux-x64/dependencies.txt new file mode 100644 index 0000000000..3d25d1bdf4 --- /dev/null +++ b/deployment/linux-x64/dependencies.txt @@ -0,0 +1 @@ +dotnet diff --git a/deployment/osx-x64/dependencies.txt b/deployment/osx-x64/dependencies.txt new file mode 100644 index 0000000000..3d25d1bdf4 --- /dev/null +++ b/deployment/osx-x64/dependencies.txt @@ -0,0 +1 @@ +dotnet diff --git a/deployment/ubuntu-x64/dependencies.txt b/deployment/ubuntu-x64/dependencies.txt new file mode 100644 index 0000000000..3d25d1bdf4 --- /dev/null +++ b/deployment/ubuntu-x64/dependencies.txt @@ -0,0 +1 @@ +dotnet diff --git a/deployment/win-generic/dependencies.txt b/deployment/win-generic/dependencies.txt new file mode 100644 index 0000000000..3d25d1bdf4 --- /dev/null +++ b/deployment/win-generic/dependencies.txt @@ -0,0 +1 @@ +dotnet diff --git a/deployment/win-x64/dependencies.txt b/deployment/win-x64/dependencies.txt new file mode 100644 index 0000000000..3d25d1bdf4 --- /dev/null +++ b/deployment/win-x64/dependencies.txt @@ -0,0 +1 @@ +dotnet diff --git a/deployment/win-x86/dependencies.txt b/deployment/win-x86/dependencies.txt new file mode 100644 index 0000000000..3d25d1bdf4 --- /dev/null +++ b/deployment/win-x86/dependencies.txt @@ -0,0 +1 @@ +dotnet From 56365e923730e9aa9a4cbf6085877d0b4f6a027d Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sun, 20 Jan 2019 13:19:50 -0500 Subject: [PATCH 13/13] Bail out if web branch is unclean like build does --- bump_version | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bump_version b/bump_version index 3f75a93cb6..06a690e195 100755 --- a/bump_version +++ b/bump_version @@ -36,9 +36,19 @@ git submodule update --init --recursive # configure branch pushd MediaBrowser.WebDashboard/jellyfin-web + +if ! git diff-index --quiet HEAD --; then + popd + echo + echo "ERROR: Your 'jellyfin-web' submodule working directory is not clean!" + echo "This script will overwrite your unstaged and unpushed changes." + echo "Please do development on 'jellyfin-web' outside of the submodule." + exit 1 +fi + git fetch --all git checkout origin/${web_branch} || { - echo "jellyfin-web branch ${web_branch} is invalid." + echo "ERROR: 'jellyfin-web' branch ${web_branch} is invalid." exit 1 } popd