From e81d11a8c1494318c3401d2736232b1027acb441d5c4e7c39cd3840600fa591c Mon Sep 17 00:00:00 2001
From: Denisart Benjamin
Date: Mon, 27 Feb 2017 14:12:27 +0000
Subject: [PATCH] Accepting request 460709 from
home:sleep_walker:branches:multimedia:apps
- replace original (but long-time broken) package with the working one
living in PackMan build service (and adopt their changelog)
- keep tvheadend-fix-daemon-user-group.patch
- remove pre-systemd stuff and init scripts
- move "homedir" of the user to /var/lib/tvheadend
process spec file with spec-cleaner
OBS-URL: https://build.opensuse.org/request/show/460709
OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/tvheadend?expand=0&rev=5
---
tvheadend-4.0.8.tar.gz | 3 --
tvheadend-4.0.9.tar.gz | 3 ++
tvheadend-4.0_no-werror.patch | 13 +++++
tvheadend-fix-misleading-indent.patch | 21 ++++++++
tvheadend.changes | 78 +++++++++++++++++++++++----
tvheadend.rpmlintrc | 2 +
tvheadend.spec | 62 ++++++++++++++-------
tvheadend_super | 66 +++++++++++++++++++++++
8 files changed, 217 insertions(+), 31 deletions(-)
delete mode 100644 tvheadend-4.0.8.tar.gz
create mode 100644 tvheadend-4.0.9.tar.gz
create mode 100644 tvheadend-4.0_no-werror.patch
create mode 100644 tvheadend-fix-misleading-indent.patch
create mode 100644 tvheadend.rpmlintrc
create mode 100644 tvheadend_super
diff --git a/tvheadend-4.0.8.tar.gz b/tvheadend-4.0.8.tar.gz
deleted file mode 100644
index f53bf2c..0000000
--- a/tvheadend-4.0.8.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:04f485c25fcca604165622679e9e7be7aee7575d67f326f5ed8b4ceff63d8f4c
-size 15826229
diff --git a/tvheadend-4.0.9.tar.gz b/tvheadend-4.0.9.tar.gz
new file mode 100644
index 0000000..c26d90e
--- /dev/null
+++ b/tvheadend-4.0.9.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cea1106f45e286e8c25e6b2f0a581c28bd85e93ce3801ecaac7041568a214977
+size 15825419
diff --git a/tvheadend-4.0_no-werror.patch b/tvheadend-4.0_no-werror.patch
new file mode 100644
index 0000000..9fdce7a
--- /dev/null
+++ b/tvheadend-4.0_no-werror.patch
@@ -0,0 +1,13 @@
+--- Makefile.orig 2015-06-27 14:15:57.523222561 +0200
++++ Makefile 2015-06-27 14:16:38.689192884 +0200
+@@ -27,8 +27,8 @@ PROG := $(BUILDDIR)/tvheadend
+ # Common compiler flags
+ #
+
+-CFLAGS += -g -O2 -Wunused-result
+-CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations
++CFLAGS += -g -O2
++CFLAGS += -Wall -Wwrite-strings -Wno-deprecated-declarations
+ CFLAGS += -Wmissing-prototypes
+ CFLAGS += -fms-extensions -funsigned-char -fno-strict-aliasing
+ CFLAGS += -D_FILE_OFFSET_BITS=64
diff --git a/tvheadend-fix-misleading-indent.patch b/tvheadend-fix-misleading-indent.patch
new file mode 100644
index 0000000..5584bc5
--- /dev/null
+++ b/tvheadend-fix-misleading-indent.patch
@@ -0,0 +1,21 @@
+diff -Naur a/src/htsmsg.c b/src/htsmsg.c
+--- a/src/htsmsg.c 2016-03-14 04:10:57.000000000 -0500
++++ b/src/htsmsg.c 2016-09-26 16:51:51.367645274 -0500
+@@ -760,13 +760,15 @@
+ case HMF_MAP:
+ printf("MAP) = {\n");
+ htsmsg_print0(&f->hmf_msg, indent + 1);
+- for(i = 0; i < indent; i++) printf("\t"); printf("}\n");
++ for(i = 0; i < indent; i++) printf("\t");
++ printf("}\n");
+ break;
+
+ case HMF_LIST:
+ printf("LIST) = {\n");
+ htsmsg_print0(&f->hmf_msg, indent + 1);
+- for(i = 0; i < indent; i++) printf("\t"); printf("}\n");
++ for(i = 0; i < indent; i++) printf("\t");
++ printf("}\n");
+ break;
+
+ case HMF_STR:
diff --git a/tvheadend.changes b/tvheadend.changes
index 4f5fecd..ebf1928 100644
--- a/tvheadend.changes
+++ b/tvheadend.changes
@@ -1,18 +1,78 @@
-------------------------------------------------------------------
-Wed Jan 6 17:41:30 UTC 2016 - p.drouand@gmail.com
+Tue Feb 14 12:44:57 UTC 2017 - sleep_walker@opensuse.org
-- Update to version 4.0.8
- * No changelog available
-- Add libhdhomerun-devel and ccache build dependencies
+- replace original (but long-time broken) package with the working one
+ living in PackMan build service (and adopt their changelog)
+- keep tvheadend-fix-daemon-user-group.patch
+- remove pre-systemd stuff and init scripts
+- move "homedir" of the user to /var/lib/tvheadend
-------------------------------------------------------------------
-Wed Dec 9 16:33:11 UTC 2015 - p.drouand@gmail.com
+Mon Sep 26 21:55:00 UTC 2016 - malcolmlewis@opensuse.org
-- Remove prefixed UID
+- Add tvheadend-fix-misleading-indent.patch: Fix warning/error
+ produced with gcc-6.
-------------------------------------------------------------------
-Sun Dec 6 12:44:48 UTC 2015 - p.drouand@gmail.com
+Sat Apr 9 14:06:31 UTC 2016 - malcolmlewis@opensuse.org
-- Initial release (version 4.0.7)
-- Add tvheadend-fix-daemon-user-group.patch
+- Update to version 4.0.9:
+ + https://github.com/tvheadend/tvheadend/compare/v4.0.8...v4.0.9.
+- Disable hdhomerun client and static build.
+
+-------------------------------------------------------------------
+Sun Feb 7 21:56:31 UTC 2016 - malcolmlewis@opensuse.org
+
+- Update to version 4.0.8:
+ + Changelog on
+ https://github.com/tvheadend/tvheadend/compare/v4.0.7...v4.0.8.
+- Fix incorrect sed command in spec file to add user hts and video
+ group to /etc/sysconfig/tvheadend file.
+- Add %%doc files.
+- Delete source file not bzipped from rpmlintrc file.
+- Add helper script to add/update superuser file.
+- Update post install message to include post install steps.
+
+-------------------------------------------------------------------
+Tue Oct 27 21:58:38 UTC 2015 - malcolmlewis@opensuse.org
+
+- Update to version 4.0.7:
+ + Changelog on
+ https://tvheadend.org/projects/tvheadend/wiki/Tvheadend-40.
+
+-------------------------------------------------------------------
+Fri Jun 26 17:40:22 UTC 2015 - aloisio@gmx.com
+
+- Update to version 4.0.5
+ * changelog on https://tvheadend.org/projects/tvheadend/wiki/Tvheadend-40
+- Added init support for 11.4/SLE_11
+- spec cleanup
+
+-------------------------------------------------------------------
+Sat Jun 8 14:11:55 UTC 2013 - p.drouand@gmail.com
+
+- Update to version 3.4
+- Clean and rebase specfile
+- Add systemd service file to start automatically tvheadend daemon
+ and add tvheadend to video group to get it usable by user
+- Remove dvb-scan tables archive and pass --disable-dvbscan;
+ It doesn't work correctly and is actually obsolete
+- Remove tvheadend-3.2.18-dvbscan_data.patch; it's not needed anymore
+- Fix executable manpage
+
+-------------------------------------------------------------------
+Sat Feb 2 13:31:36 UTC 2013 - hvogel@opensuse.org
+
+- Update to version 3.2.18
+
+-------------------------------------------------------------------
+Tue Mar 27 17:20:28 UTC 2012 - hvogel@opensuse.org
+
+- Don't build with Werror
+- Add summary/description
+
+-------------------------------------------------------------------
+Fri Apr 22 09:03:35 UTC 2011 - hvogel@opensuse.org
+
+- Initial package, version 2.12
diff --git a/tvheadend.rpmlintrc b/tvheadend.rpmlintrc
new file mode 100644
index 0000000..061564e
--- /dev/null
+++ b/tvheadend.rpmlintrc
@@ -0,0 +1,2 @@
+# this file is supposed to be empty
+addFilter("W: zero-length .*empty.css")
diff --git a/tvheadend.spec b/tvheadend.spec
index 23df506..f6667b9 100644
--- a/tvheadend.spec
+++ b/tvheadend.spec
@@ -1,7 +1,8 @@
#
# spec file for package tvheadend
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 Packman Team
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,30 +19,35 @@
%define htsgroup video
%define htsuser hts
+%define homedir %{_localstatedir}/lib/tvheadend
Name: tvheadend
-Version: 4.0.8
+Version: 4.0.9
Release: 0
Summary: A TV Streaming Server
License: GPL-3.0
Group: Productivity/Multimedia/Other
Url: https://tvheadend.org/
Source0: http://github.com/%{name}/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
-Patch: tvheadend-fix-daemon-user-group.patch
-BuildRequires: ccache
+Source2: %{name}.rpmlintrc
+Source3: %{name}_super
+# PATCH-FIX-OPENSUSE tvheadend-4.0_no-werror.patch -- Do not treat warnings as errors.
+Patch0: %{name}-4.0_no-werror.patch
+# PATCH-FIX-OPENSUSE tvheadend-fix-misleading-indent.patch malcolmlewis@opensuse.org -- Fix warning/error produced with gcc-6.
+Patch1: %{name}-fix-misleading-indent.patch
BuildRequires: fdupes
-BuildRequires: libhdhomerun-devel
+BuildRequires: pkgconfig
+BuildRequires: python-devel
BuildRequires: pkgconfig(avahi-client)
BuildRequires: pkgconfig(dbus-1)
-BuildRequires: pkgconfig(libavcodec)
-BuildRequires: pkgconfig(libavformat)
-BuildRequires: pkgconfig(libavresample)
-BuildRequires: pkgconfig(libavutil)
+BuildRequires: pkgconfig(libavcodec) = 56.60.100
+BuildRequires: pkgconfig(libavformat) = 56.40.101
+BuildRequires: pkgconfig(libavresample) = 2.1.0
+BuildRequires: pkgconfig(libavutil) = 54.31.100
BuildRequires: pkgconfig(libssl)
-BuildRequires: pkgconfig(libswscale)
+BuildRequires: pkgconfig(libswscale) = 3.1.101
BuildRequires: pkgconfig(liburiparser)
BuildRequires: pkgconfig(zlib)
-BuildRequires: pkg-config
-BuildRequires: python-devel
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%description
@@ -54,12 +60,20 @@ scheduling recordings.
%prep
%setup -q
-%patch -p1
+%patch0
+%if 0%{?suse_version} >= 1320
+%patch1 -p1
+%endif
+
+sed -e "s/-u \([^ ]*\) -g \([^ ]*\)/-u %{htsuser} -g %{htsgroup}/" -i rpm/%{name}.sysconfig
sed -e '/^TVH_ARGS/cTVH_ARGS="-C"' -i debian/%{name}.default
echo %{version} > rpm/version
%build
-%configure --disable-dvbscan --disable-libffmpeg_static --disable-libffmpeg_static_x264
+%configure --disable-dvbscan \
+ --disable-libffmpeg_static \
+ --disable-libffmpeg_static_x264 \
+ --disable-hdhomerun_static
make V=1 %{?_smp_mflags}
%install
@@ -67,8 +81,12 @@ make V=1 %{?_smp_mflags}
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates/
mkdir -p %{buildroot}%{_sbindir}
install -D -m 644 rpm/%{name}.service %{buildroot}/%{_unitdir}/%{name}.service
+sed -i 's@/home/tvheadend@%{homedir}@' rpm/%{name}.sysconfig
install -m 644 rpm/%{name}.sysconfig %{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
+# Install superuser helper script
+sed -i 's@/home/tvheadend@%{homedir}@' %{SOURCE3}
+install -Dm0755 %{SOURCE3} %{buildroot}%{_sbindir}/%{name}_super
%fdupes -s %{buildroot}%{_datadir}
chmod -x %{buildroot}%{_mandir}/man1/tvheadend.1
@@ -76,16 +94,21 @@ chmod -x %{buildroot}%{_mandir}/man1/tvheadend.1
%fillup_only %{name}
%service_add_post %{name}.service
cat << 'EOM'
- ==> All configuration is maintained through the web interface:
+ ==> IMPORTANT: Post configuration tasks;
+ ==> 1. Start the tvheadend service (to create home directory).
+ ==> 2. Run tvheadend_super to set default username and password.
+ ==> 3. Restart tvheadend service.
+ ==>
+ ==>
+ ==> All further configuration is maintained through the web interface:
==>
==> http://localhost:9981/
==>
- ==> Default login without username/password.
EOM
%pre
%service_add_pre %{name}.service
-%{_sbindir}/useradd -g %{htsgroup} -m -s /bin/false %{htsuser} -c "Tvheadend TV server" &> /dev/null || :
+%{_sbindir}/useradd -u 1337 -g %{htsgroup} -m -d %{homedir} -r -s /bin/false %{htsuser} -c "Tvheadend TV server" &> /dev/null || :
%{_sbindir}/passwd -l %{htsuser} &> /dev/null || :
%preun
@@ -96,12 +119,13 @@ EOM
%files
%defattr(-,root,root)
+%doc CONTRIBUTING.md LICENSE.md
%{_bindir}/tvheadend
%{_datadir}/tvheadend
-%{_mandir}/man1/tvheadend.1.gz
+%{_mandir}/man1/tvheadend.1%{?ext_man}
%{_unitdir}/%{name}.service
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
+%{_sbindir}/%{name}_super
%{_sbindir}/rc%{name}
%changelog
-
diff --git a/tvheadend_super b/tvheadend_super
new file mode 100644
index 0000000..847f593
--- /dev/null
+++ b/tvheadend_super
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3.0 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# Copyright (C) 2016 Malcolm Lewis
+
+
+echo "Superuser setup for tvheadend"
+
+# Make sure only root can run
+if [[ $EUID -ne 0 ]]; then
+ echo "This script must be run as root, exiting..." 1>&2
+ exit 1
+fi
+
+if (( $# != 2 )); then
+ echo "Usage: $0 " >&2
+ exit 1
+fi
+
+# The superuser file location and name
+SUPERUSER_FILE_LOCATION="/home/tvheadend/config"
+
+# Test to see if file exists and if exists ask to overwrite
+[ -f $SUPERUSER_FILE_LOCATION/superuser ] && { echo "Superuser file exists at '$SUPERUSER_FILE_LOCATION'.";
+read -p "Overwrite existing superuser file [yes]/[no]? "
+if [ "$REPLY" != "yes" ]; then
+ echo "Exiting, superuser file unchanged"
+ exit 1
+ else
+ echo "Updating superuser file"
+fi
+}
+
+# If new file, advise user it's being created
+[ ! -f $SUPERUSER_FILE_LOCATION/superuser ] && { echo "Creating new superuser file at '$SUPERUSER_FILE_LOCATION'."; }
+
+# Read in the username and password for superuser file
+TVHEADEND_SUPERUSER_NAME="$1"
+TVHEADEND_SUPERUSER_PASS="$2"
+
+# Create directory if it doesn't exist
+mkdir -p $SUPERUSER_FILE_LOCATION
+
+# Create superuser file with username and password
+cat << EOF > $SUPERUSER_FILE_LOCATION/superuser
+{
+"username": "$TVHEADEND_SUPERUSER_NAME",
+"password": "$TVHEADEND_SUPERUSER_PASS"
+}
+EOF
+
+#Set permissions and ownership
+chmod 0600 $SUPERUSER_FILE_LOCATION/superuser
+chown hts:video $SUPERUSER_FILE_LOCATION/superuser
+
+echo "Finished, superuser file updated, please logout of the"
+echo "Web UI and restart tvheadend service to apply changes!"