Run bump_version in make srpm
Also add an "rpms" target that builds the RPMs using mock in a target environment. Fix BuildRequires: for RH platforms. Fixes: #3221 Signed-off-by: Brian J. Murrell <brian@interlinx.bc.ca>
This commit is contained in:
parent
31d02d804a
commit
b907d08b86
7 changed files with 81 additions and 33 deletions
|
@ -17,6 +17,14 @@ jobs:
|
||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- script: echo "##vso[task.setvariable variable=JellyfinVersion]$( awk -F '/' '{ print $NF }' <<<'$(Build.SourceBranch)' | sed 's/^v//' )"
|
||||||
|
displayName: Set release version (stable)
|
||||||
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
||||||
|
|
||||||
|
- script: './bump-version $(JellyfinVersion)'
|
||||||
|
displayName: Bump internal version (stable)
|
||||||
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
||||||
|
|
||||||
- script: 'docker build -f deployment/Dockerfile.$(BuildConfiguration) -t jellyfin-web-$(BuildConfiguration) deployment'
|
- script: 'docker build -f deployment/Dockerfile.$(BuildConfiguration) -t jellyfin-web-$(BuildConfiguration) deployment'
|
||||||
displayName: 'Build Dockerfile'
|
displayName: 'Build Dockerfile'
|
||||||
condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master'))
|
condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master'))
|
||||||
|
@ -68,6 +76,10 @@ jobs:
|
||||||
displayName: Set release version (stable)
|
displayName: Set release version (stable)
|
||||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
|
||||||
|
|
||||||
|
- script: './bump-version $(JellyfinVersion)'
|
||||||
|
displayName: Bump internal version (stable)
|
||||||
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
|
||||||
|
|
||||||
- task: Docker@2
|
- task: Docker@2
|
||||||
displayName: 'Push Unstable Image'
|
displayName: 'Push Unstable Image'
|
||||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
||||||
|
|
1
.copr
Symbolic link
1
.copr
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
fedora/
|
|
@ -1 +0,0 @@
|
||||||
../fedora/Makefile
|
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -12,3 +12,10 @@ config.json
|
||||||
|
|
||||||
# log
|
# log
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
|
||||||
|
# vim
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
# build artifacts
|
||||||
|
fedora/jellyfin-web-*.src.rpm
|
||||||
|
fedora/jellyfin-web-*.tar.gz
|
||||||
|
|
27
bump_version
27
bump_version
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo -e "bump_version - increase the shared version and generate changelogs"
|
echo -e "bump_version - increase the shared version and generate changelogs"
|
||||||
|
@ -22,8 +23,10 @@ package_file="./package*.json"
|
||||||
|
|
||||||
new_version="$1"
|
new_version="$1"
|
||||||
|
|
||||||
# Parse the version from build.yaml
|
old_version="$(
|
||||||
old_version="$( grep "version:" ${build_file} | sed -E 's/version: "([0-9\.]+[-a-z0-9]*)"/\1/' )"
|
grep "version:" ${build_file} \
|
||||||
|
| sed -E 's/version: "([0-9\.]+[-a-z0-9]*)"/\1/'
|
||||||
|
)"
|
||||||
echo "Old version: ${old_version}"
|
echo "Old version: ${old_version}"
|
||||||
|
|
||||||
# Bump the NPM version
|
# Bump the NPM version
|
||||||
|
@ -32,19 +35,22 @@ npm --no-git-tag-version --allow-same-version version v${new_version_sed}
|
||||||
|
|
||||||
# Set the build.yaml version to the specified new_version
|
# Set the build.yaml version to the specified new_version
|
||||||
old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' chars
|
old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' chars
|
||||||
sed -i "s/${old_version_sed}/${new_version}/g" ${build_file}
|
sed -i "s/${old_version_sed}/${new_version_sed}/g" ${build_file}
|
||||||
|
|
||||||
|
|
||||||
if [[ ${new_version} == *"-"* ]]; then
|
if [[ ${new_version} == *"-"* ]]; then
|
||||||
new_version_deb="$( sed 's/-/~/g' <<<"${new_version}" )"
|
new_version_pkg="$( sed 's/-/~/g' <<<"${new_version}" )"
|
||||||
|
new_version_deb_sup=""
|
||||||
else
|
else
|
||||||
new_version_deb="${new_version}-1"
|
new_version_pkg="${new_version}"
|
||||||
|
new_version_deb_sup="-1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Write out a temporary Debian changelog with our new stuff appended and some templated formatting
|
# Write out a temporary Debian changelog with our new stuff appended and some templated formatting
|
||||||
debian_changelog_file="debian/changelog"
|
debian_changelog_file="debian/changelog"
|
||||||
debian_changelog_temp="$( mktemp )"
|
debian_changelog_temp="$( mktemp )"
|
||||||
# Create new temp file with our changelog
|
# Create new temp file with our changelog
|
||||||
echo -e "jellyfin-web (${new_version_deb}) unstable; urgency=medium
|
echo -e "jellyfin-web (${new_version_pkg}${new_version_deb_sup}) unstable; urgency=medium
|
||||||
|
|
||||||
* New upstream version ${new_version}; release changelog at https://github.com/jellyfin/jellyfin-web/releases/tag/v${new_version}
|
* New upstream version ${new_version}; release changelog at https://github.com/jellyfin/jellyfin-web/releases/tag/v${new_version}
|
||||||
|
|
||||||
|
@ -65,8 +71,7 @@ pushd ${fedora_spec_temp_dir}
|
||||||
# Split out the stuff before and after changelog
|
# Split out the stuff before and after changelog
|
||||||
csplit jellyfin-web.spec "/^%changelog/" # produces xx00 xx01
|
csplit jellyfin-web.spec "/^%changelog/" # produces xx00 xx01
|
||||||
# Update the version in xx00
|
# Update the version in xx00
|
||||||
new_version_sed="$( sed 's/\./\\./g' <<<"${new_version}" )" # Escape the '.' chars
|
sed -i "s/${old_version_sed}/${new_version_pkg}/g" xx00
|
||||||
sed -i "s/${old_version_sed}/${new_version_sed}/g" xx00
|
|
||||||
# Remove the header from xx01
|
# Remove the header from xx01
|
||||||
sed -i '/^%changelog/d' xx01
|
sed -i '/^%changelog/d' xx01
|
||||||
# Create new temp file with our changelog
|
# Create new temp file with our changelog
|
||||||
|
@ -80,8 +85,8 @@ popd
|
||||||
# Move into place
|
# Move into place
|
||||||
mv ${fedora_spec_temp} ${fedora_spec_file}
|
mv ${fedora_spec_temp} ${fedora_spec_file}
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -rf ${fedora_changelog_temp} ${fedora_spec_temp_dir}
|
rm -rf ${fedora_spec_temp_dir}
|
||||||
|
|
||||||
# Stage the changed files for commit
|
# Stage the changed files for commit
|
||||||
git add ${build_file} ${debian_changelog_file} ${fedora_spec_file} ${package_file}
|
git add .
|
||||||
git status
|
git status -v
|
||||||
|
|
|
@ -1,21 +1,46 @@
|
||||||
VERSION := $(shell sed -ne '/^Version:/s/.* *//p' fedora/jellyfin-web.spec)
|
DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
|
# install git and npm
|
||||||
|
$(info $(shell set -x; if [ "$$(id -u)" = "0" ]; then echo "Installing git"; dnf -y install git npm; fi))
|
||||||
|
NAME := jellyfin-web
|
||||||
|
VERSION := $(shell set -x; sed -ne '/^Version:/s/.* *//p' $(DIR)/$(NAME).spec)
|
||||||
|
RELEASE := $(shell set -x; sed -ne '/^Release:/s/.* *\(.*\)%{.*}.*/\1/p' $(DIR)/$(NAME).spec)
|
||||||
|
GIT_VER := $(shell set -x; git describe --tags | sed -e 's/^v//' -e 's/-[0-9]*-g.*$$//')
|
||||||
|
SRPM := jellyfin-web-$(subst -,~,$(GIT_VER))-$(RELEASE)$(shell rpm --eval %dist).src.rpm
|
||||||
|
TARBALL :=$(NAME)-$(subst -,~,$(GIT_VER)).tar.gz
|
||||||
|
|
||||||
srpm:
|
epel-8-x86_64_repos := https://rpm.nodesource.com/pub_16.x/el/\$$releasever/\$$basearch/
|
||||||
cd fedora/; \
|
|
||||||
SOURCE_DIR=.. \
|
outdir ?= $(PWD)/$(DIR)/
|
||||||
WORKDIR="$${PWD}"; \
|
TARGET ?= fedora-35-x86_64
|
||||||
tar \
|
|
||||||
--transform "s,^\.,jellyfin-web-$(VERSION)," \
|
srpm: $(DIR)/$(SRPM)
|
||||||
--exclude='.git*' \
|
tarball: $(DIR)/$(TARBALL)
|
||||||
--exclude='**/.git' \
|
|
||||||
--exclude='**/.hg' \
|
$(DIR)/$(TARBALL):
|
||||||
--exclude='deployment' \
|
cd $(DIR)/; \
|
||||||
--exclude='*.deb' \
|
SOURCE_DIR=.. \
|
||||||
--exclude='*.rpm' \
|
WORKDIR="$${PWD}"; \
|
||||||
--exclude='jellyfin-web-$(VERSION).tar.gz' \
|
version=$(GIT_VER); \
|
||||||
-czf "jellyfin-web-$(VERSION).tar.gz" \
|
tar \
|
||||||
|
--transform "s,^\.,$(NAME)-$(subst -,~,$(GIT_VER))," \
|
||||||
|
--exclude='.git*' \
|
||||||
|
--exclude='**/.git' \
|
||||||
|
--exclude='**/.hg' \
|
||||||
|
--exclude=deployment \
|
||||||
|
--exclude='*.deb' \
|
||||||
|
--exclude='*.rpm' \
|
||||||
|
--exclude=$(notdir $@) \
|
||||||
|
-czf $(notdir $@) \
|
||||||
-C $${SOURCE_DIR} ./
|
-C $${SOURCE_DIR} ./
|
||||||
cd fedora/; \
|
|
||||||
rpmbuild -bs jellyfin-web.spec \
|
$(DIR)/$(SRPM): $(DIR)/$(TARBALL) $(DIR)/jellyfin-web.spec
|
||||||
--define "_sourcedir $$PWD/" \
|
./bump_version $(GIT_VER)
|
||||||
|
cd $(DIR)/; \
|
||||||
|
rpmbuild -bs $(NAME).spec \
|
||||||
|
--define "_sourcedir $$PWD/" \
|
||||||
--define "_srcrpmdir $(outdir)"
|
--define "_srcrpmdir $(outdir)"
|
||||||
|
|
||||||
|
rpms: $(DIR)/$(SRPM)
|
||||||
|
mock $(addprefix --addrepo=, $($(TARGET)_repos)) \
|
||||||
|
--enable-network \
|
||||||
|
-r $(TARGET) $<
|
||||||
|
|
|
@ -10,9 +10,8 @@ URL: https://jellyfin.org
|
||||||
Source0: jellyfin-web-%{version}.tar.gz
|
Source0: jellyfin-web-%{version}.tar.gz
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%if 0%{?fedora} >= 33
|
BuildRequires: git
|
||||||
BuildRequires: nodejs
|
BuildRequires: npm
|
||||||
%endif
|
|
||||||
|
|
||||||
# Disable Automatic Dependency Processing
|
# Disable Automatic Dependency Processing
|
||||||
AutoReqProv: no
|
AutoReqProv: no
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue