From 4f5f23a6d75943189f99fa1ef2c9a9b6c8389eaa Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Mon, 3 Sep 2012 11:33:03 +0100 Subject: [PATCH] Change getmuxlist back to bash script and make python soft dep. Also some minor improvements to bundle code. --- Makefile | 9 ++++++++- configure | 16 ++++++---------- src/filebundle.c | 2 +- support/getmuxlist | 36 ++++++++++++++++-------------------- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 5621d870..6cd41af5 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,13 @@ CFLAGS += -D_FILE_OFFSET_BITS=64 CFLAGS += -I${BUILDDIR} -I${CURDIR}/src -I${CURDIR} LDFLAGS += -lrt -ldl -lpthread +# +# Other config +# + +BUNDLE_FLAGS-${CONFIG_ZLIB} = -z +BUNDLE_FLAGS = ${BUNDLE_FLAGS-yes} + # # Binaries/Scripts # @@ -243,4 +250,4 @@ $(BUILDDIR)/bundle.o: $(BUILDDIR)/bundle.c $(BUILDDIR)/bundle.c: @mkdir -p $(dir $@) - $(MKBUNDLE) -o $@ -d ${BUILDDIR}/bundle.d -z $(BUNDLES) + $(MKBUNDLE) -o $@ -d ${BUILDDIR}/bundle.d $(BUNDLE_FLAGS) $(BUNDLES) diff --git a/configure b/configure index 140ff8f4..7c807f5e 100755 --- a/configure +++ b/configure @@ -47,10 +47,8 @@ check_cc_option sse2 # # Python # -check_py || die 'No PYTHON binary found' -check_py_import zlib pyzlib || die "Python module missing: zlib" -check_py_import tarfile pytar || die "Python module missing: tarfile" -# Note: the above could/should be made optional +check_py || echo 'WARN: no python binary found' +check_py_import gzip pygzip # # SSL @@ -75,11 +73,9 @@ fi # # Bundling # -if enabled_or_auto bundle; then - if enabled zlib; then - enable bundle - elif enabled bundle; then - die "Zlib development support not found (use --disable-bundle)" +if enabled bundle; then + if enabled zlib && ! enabled pygzip; then + die "Python gzip module not found (use --disable-zlib or --disable-bundle)" fi fi @@ -100,7 +96,7 @@ fi if enabled linuxdvb && enabled dvbscan; then if [ ! -d ${ROOTDIR}/data/dvb-scan ]; then echo -n "Fetching dvb-scan files... " - ${PYTHON} ${ROOTDIR}/support/getmuxlist &> /dev/null || die "Failed to fetch dvb-scan files (use --disable-dvbscan to skip)" + ${ROOTDIR}/support/getmuxlist &> /dev/null || die "Failed to fetch dvb-scan files (use --disable-dvbscan to skip)" echo "done" fi fi diff --git a/src/filebundle.c b/src/filebundle.c index e75b5b82..82450a37 100644 --- a/src/filebundle.c +++ b/src/filebundle.c @@ -364,7 +364,7 @@ fb_file *fb_open2 /* Inflate the file */ if (fb->f.orig != -1 && decompress) { -#if ENABLE_BUNDLE +#if (ENABLE_ZLIB && ENABLE_BUNDLE) ret->gzip = 0; ret->size = fb->f.orig; ret->buf = _fb_inflate(fb->f.data, fb->f.size, fb->f.orig); diff --git a/support/getmuxlist b/support/getmuxlist index 6d8d354f..dae32eb1 100755 --- a/support/getmuxlist +++ b/support/getmuxlist @@ -1,30 +1,26 @@ -#!/usr/bin/env python +#!/bin/bash # # Retrieve the latest dvb-apps scan files # -import os, sys, shutil, glob, urllib2, tarfile - -url = 'http://linuxtv.org/hg/dvb-apps/archive/tip.tar.bz2' -tmp = '/tmp/getmuxlist.%d' % os.getpid() -out = os.path.abspath(os.path.dirname(sys.argv[0]) + '/../data/dvb-scan') +URL=http://linuxtv.org/hg/dvb-apps/archive/tip.tar.bz2 +TMP=/tmp/getmuxlist.$$ +TVH=$(cd $(dirname $0)/..; pwd)/data/dvb-scan # Get files -if os.path.exists(tmp): - shutil.rmtree(tmp) -os.makedirs(tmp) -tbz = tmp + '/dvb-apps.tar.bz2' -open(tbz, 'w').write(urllib2.urlopen(url).read()) -tp = tarfile.open(tbz) -tp.extractall(tmp) +rm -rf $TMP +mkdir -p $TMP +cd $TMP +(wget -O - -q $URL | tar xj) || (curl $URL | tar xj) +cd dvb-apps* # Copy to TVH -if os.path.exists(out): - shutil.rmtree(out) -os.makedirs(out) -for d in glob.glob('%s/dvb-apps*/util/scan/*' % tmp): - if os.path.isdir(d): - shutil.move(d, out) +rm -rf $TVH +mkdir -p $TVH +mv ./util/scan/* $TVH # Cleanup -shutil.rmtree(tmp) +for f in $TVH/*; do + [ -f $f ] && rm -f $f +done +rm -rf $TMP