commit f9563ecbda4fdf21a771e1ddf60d66596349cf20
Author: Mohamed El Morabity <melmorabity(a)fedoraproject.org>
Date: Wed Nov 21 09:54:50 2018 +0100
- Use system versions of rcssmin and rjsmin during build
- Install Python bindings
tvheadend-4.2.7-python3.patch | 91 ++++++++++++++++++++++++
tvheadend.spec | 160 ++++++++++++++++++------------------------
2 files changed, 160 insertions(+), 91 deletions(-)
---
diff --git a/tvheadend-4.2.7-python3.patch b/tvheadend-4.2.7-python3.patch
new file mode 100644
index 0000000..752b17b
--- /dev/null
+++ b/tvheadend-4.2.7-python3.patch
@@ -0,0 +1,91 @@
+diff -up ./lib/py/tvh/tsreader.py.orig ./lib/py/tvh/tsreader.py
+--- ./lib/py/tvh/tsreader.py.orig 2018-10-08 14:37:05.000000000 +0200
++++ ./lib/py/tvh/tsreader.py 2018-10-15 11:53:53.766850060 +0200
+@@ -31,7 +31,7 @@ def encode_utf8(c):
+
+ def conv_8859(tnum, data):
+ r = u''
+- print 'TBL %d' % tnum
++ print('TBL %d' % tnum)
+ tbl = conv_8859_table[tnum]
+ for c in data:
+ if ord(c) <= 0x7f:
+@@ -46,8 +46,8 @@ def conv_8859(tnum, data):
+
+
+ def dvb_convert_string(data, conv):
+- print 'convert(%d)' % conv
+- print repr(data)
++ print('convert(%d)' % conv)
++ print(repr(data))
+ if not conv:
+ return data
+ return conv_8859(conv, data)
+@@ -83,8 +83,8 @@ class TsSection(object):
+ # print self.tid, self.len, len(data)
+
+ def process(self):
+- print 'TS Section:'
+- print self.tid, self.len, len(self.data)
++ print('TS Section:')
++ print(self.tid, self.len, len(self.data))
+ # print str2hex(self.data, 16)
+ # print self.data
+
+@@ -112,7 +112,7 @@ class TsSection(object):
+ if l + 1 > dlen:
+ return (None, -1)
+ c = ord(data[1])
+- print c
++ print(c)
+ conv = None
+ if c == 0:
+ return (None, -1)
+@@ -162,14 +162,14 @@ class TsSection(object):
+ eid = (hdr[0] << 8) + hdr[1]
+ start = dvb_convert_date(hdr[2:])
+
+- print 'process event (%d):' % dllen
+- print ' EID : %d' % eid
+- print ' START : %d' % start
++ print('process event (%d):' % dllen)
++ print(' EID : %d' % eid)
++ print(' START : %d' % start)
+
+ while dllen > 2:
+ dtag = ord(data[0])
+ dlen = ord(data[1])
+- print 'dtag = 0x%02x, dlen = %d' % (dtag, dlen)
++ print('dtag = 0x%02x, dlen = %d' % (dtag, dlen))
+
+ dllen = dllen - 2
+ data = data[2:]
+@@ -178,8 +178,8 @@ class TsSection(object):
+
+ if dtag == 0x4d:
+ (title, summary) = self.short_event(data, dlen)
+- print ' TITLE : %s' % title
+- print ' SUMMARY : %s' % summary
++ print(' TITLE : %s' % title)
++ print(' SUMMARY : %s' % summary)
+
+ dllen = dllen - dlen
+ data = data[dlen:]
+@@ -216,7 +216,7 @@ if __name__ == '__main__':
+ # Complete?
+ if cur:
+ if len(cur.data) >= cur.len:
+- print 'Process Section:'
++ print('Process Section:')
+ # try:
+ cur.process()
+ # except: pass
+@@ -224,7 +224,7 @@ if __name__ == '__main__':
+ print
+ sys.exit(0)
+ else:
+- print 'waiting for %d bytes' % (cur.len - len(cur.data))
++ print('waiting for %d bytes' % (cur.len - len(cur.data)))
+
+ # Next
+ if nxt:
diff --git a/tvheadend.spec b/tvheadend.spec
index 7e4057b..326f644 100644
--- a/tvheadend.spec
+++ b/tvheadend.spec
@@ -3,7 +3,7 @@
Name: tvheadend
Version: 4.2.7
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: TV streaming server and digital video recorder
License: GPLv3+
@@ -22,6 +22,8 @@ Patch3: %{name}-4.2.2-dtv_scan_tables.patch
# Enforcing system crypto policies, see
#
https://fedoraproject.org/wiki/Packaging:CryptoPolicies
Patch4: %{name}-4.2.1-crypto_policies.patch
+# Python 3 fixes for Python bindings
+Patch5: %{name}-4.2.7-python3.patch
BuildRequires: bzip2
BuildRequires: gcc
@@ -42,7 +44,12 @@ BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(liburiparser)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
+%if 0%{?fedora} < 30
+BuildRequires: python2-devel
+%endif
BuildRequires: python3-devel
+BuildRequires: python3-rcssmin
+BuildRequires: python3-rjsmin
BuildRequires: systemd
Requires: bzip2
Requires: dtv-scan-tables
@@ -65,17 +72,40 @@ version, the pipe:// source (in IPTV network) might be used to obtain
the
MPEG-TS stream generated by ffmpeg/libav from a V4L device.
+%if 0%{?fedora} < 30
+%package -n python2-tvh
+Summary: HTSP client for Python
+BuildArch: noarch
+
+%description -n python2-tvh
+%{summary}.
+%endif
+
+
+%package -n python3-tvh
+Summary: HTSP client for Python
+BuildArch: noarch
+
+%description -n python3-tvh
+%{summary}.
+
+
%prep
-%autosetup -p 0
+%autosetup -p0
+
+# Delete bundled system headers and tools
+rm -r vendor/{dvb-api,include,rcssmin-*,rjsmin-*}/
-# Delete bundled system headers
-rm -r vendor/{dvb-api,include}/
+# Remove shebang
+for i in lib/py/tvh/*.py; do
+ sed '1{\@^#!/usr/bin/env python@d}' $i >$i.new && \
+ touch -r $i $i.new && \
+ mv $i.new $i
+done
%build
-# Use touch to be sure that configure, after being patched, is still older than
-# generated .config.mk file (otherwise the build fails)
-# touch -r Makefile configure
+echo "%{version}-%{release}" >rpm/version
# Note: --disable-lib* correspond to options to build bundled FFmpeg
%configure \
--disable-dvbscan \
@@ -95,8 +125,12 @@ rm -r vendor/{dvb-api,include}/
--disable-libx265_static \
--enable-dvbcsa \
--enable-hdhomerun_client \
- --enable-libsystemd_daemon
-%make_build V=1 PYTHON=%{__python3}
+ --enable-libsystemd_daemon \
+ --python=%{__python3}
+%make_build \
+ V=1 \
+ RUN_CSS="%{__python3} %{python3_sitearch}/rcssmin.py" \
+ RUN_JS="%{__python3} %{python3_sitearch}/rjsmin.py"
%install
@@ -107,20 +141,21 @@ install -Dpm 0644 rpm/%{name}.sysconfig
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
install -dm 0755 $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/
+# Install Python bindings
+%if 0%{?fedora} < 30
+install -dm 0755 $RPM_BUILD_ROOT%{python2_sitelib}/
+cp -a lib/py/tvh/ $RPM_BUILD_ROOT%{python2_sitelib}/
+%endif
+install -dm 0755 $RPM_BUILD_ROOT%{python3_sitelib}/
+cp -a lib/py/tvh/ $RPM_BUILD_ROOT%{python3_sitelib}/
+
# Fix permissions
chmod 0644 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
-# Drop bundled Ext JS resources not required by Tvheadend UI
-pushd $RPM_BUILD_ROOT%{_datadir}/%{name}/src/webui/static/extjs/
-mv examples/ux/images/ examples_ux_images
-rm -r *.js adapter/ examples/ resources/images/{vista,yourtheme}/
-install -dm 0755 examples/ux/
-mv examples_ux_images/ examples/ux/images
-popd
-
%pre
-getent passwd %{tvheadend_user} >/dev/null || useradd -r -g %{tvheadend_group} -d
%{_sharedstatedir}/%{name}/ -s /sbin/nologin -c "%{name} daemon account"
%{name}
+getent passwd %{tvheadend_user} >/dev/null || \
+ useradd -r -g %{tvheadend_group} -d %{_sharedstatedir}/%{name}/ -s /sbin/nologin -c
"%{name} daemon account" %{name}
exit 0
@@ -147,81 +182,24 @@ exit 0
%{_mandir}/man1/*.1.*
-%changelog
-* Tue Oct 09 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.7-1
-- Update to 4.2.7
-- Remove patches merges upstream
-- Use Python 3 for build
-
-* Sun Aug 19 2018 Leigh Scott <leigh123linux(a)googlemail.com> - 4.2.6-3
-- Rebuilt for Fedora 29 Mass Rebuild binutils issue
-
-* Fri Jul 27 2018 RPM Fusion Release Engineering <leigh123linux(a)gmail.com> -
4.2.6-2
-- Rebuilt for
https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
-
-* Tue Mar 27 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.6-1
-- Update to 4.2.6
-
-* Sat Mar 17 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.5-7
-- Add explicite Requires on tar and bzip2 (required by Tvheadend for
- configuration backups)
-
-* Thu Mar 08 2018 RPM Fusion Release Engineering <leigh123linux(a)googlemail.com> -
4.2.5-6
-- Rebuilt for new ffmpeg snapshot
-
-* Thu Mar 08 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.5-5
-- Fix build with GCC >= 8
-- Call python2 instead of python during build
-
-* Thu Mar 01 2018 RPM Fusion Release Engineering <leigh123linux(a)googlemail.com> -
4.2.5-4
-- Rebuilt for
https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
-
-* Tue Jan 23 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.5-3
-- Fix build with FFmpeg 3.5
-
-* Thu Jan 18 2018 Leigh Scott <leigh123linux(a)googlemail.com> - 4.2.5-2
-- Rebuilt for ffmpeg-3.5 git
-
-* Sun Jan 07 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.5-1
-- Update to 4.2.5
-
-* Thu Oct 19 2017 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.4-1
-- Update to 4.2.4
-
-* Thu Aug 31 2017 RPM Fusion Release Engineering <kwizart(a)rpmfusion.org> - 4.2.3-2
-- Rebuilt for
https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
-
-* Mon Jul 03 2017 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.3-1
-- Update to 4.2.3
-
-* Thu Jun 01 2017 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.2-2
-- Fix system DTV scan tables path
-
-* Tue May 23 2017 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.2-1
-- Update to 4.2.2
-- Drop patch for GCC7 (merged upstream)
-
-* Sun Apr 30 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 4.2.1-2
-- Rebuild for ffmpeg update
-
-* Sun Apr 23 2017 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.1-1
-- Update to 4.2.1
-
-* Wed Apr 12 2017 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.0.10-1
-- Update to 4.0.10
+%if 0%{?fedora} < 30
+%files -n python2-tvh
+%license LICENSE.md licenses/gpl-3.0.txt
+%{python2_sitelib}/tvh/
+%endif
-* Sat Mar 25 2017 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.0.9-5
-- Fix build with GCC 7
-- Enable DVBCSA support
-* Mon Mar 20 2017 RPM Fusion Release Engineering <kwizart(a)rpmfusion.org> - 4.0.9-4
-- Rebuilt for
https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+%files -n python3-tvh
+%license LICENSE.md licenses/gpl-3.0.txt
+%{python3_sitelib}/tvh/
-* Tue Aug 09 2016 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.0.9-3
-- Merge all FFmpeg patches into a single one
-* Tue Aug 09 2016 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.0.9-2
-- Fix build with FFmpeg 3.1
+%changelog
+* Sat Nov 17 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.7-2
+- Use system versions of rcssmin and rjsmin during build
+- Install Python bindings
-* Thu Jul 28 2016 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.0.9-1
-- Initial RPM release
+* Tue Oct 09 2018 Mohamed El Morabity <melmorabity(a)fedoraproject.org> - 4.2.7-1
+- Update to 4.2.7
+- Remove patches merges upstream
+- Use Python 3 for build