summaryrefslogtreecommitdiff
path: root/misc/chm2pdf
diff options
context:
space:
mode:
authorJoĆ£o Felipe Santos <joao.eel[at]gmail.com>2010-05-13 00:34:06 +0200
committerDavid Somero <xgizzmo@slackbuilds.org>2010-05-13 00:34:06 +0200
commit30e2b66f688c34b4b9ae1d92dde17ab327e8e9bd (patch)
tree956986a438d30629ba0d24e176d158f85dc11005 /misc/chm2pdf
parenta92fa1c481e770e01e370f9ff48139c462b7bc00 (diff)
downloadslackbuilds-30e2b66f688c34b4b9ae1d92dde17ab327e8e9bd.tar.gz
misc/chm2pdf: Updated for version 0.9.1
Diffstat (limited to 'misc/chm2pdf')
-rw-r--r--misc/chm2pdf/README2
-rw-r--r--misc/chm2pdf/chm2pdf.SlackBuild9
-rw-r--r--misc/chm2pdf/chm2pdf.info6
-rw-r--r--misc/chm2pdf/patches/tempdir.patch71
4 files changed, 83 insertions, 5 deletions
diff --git a/misc/chm2pdf/README b/misc/chm2pdf/README
index 524e42cb27..a933c611a6 100644
--- a/misc/chm2pdf/README
+++ b/misc/chm2pdf/README
@@ -1,4 +1,4 @@
chm2pdf is a simple Python script that converts CHM files into
PDF files.
-It requires chmlib, pychm and htmldoc, all available at SlackBuilds.org.
+It requires chmlib-examples, pychm and htmldoc, all available at SlackBuilds.org.
diff --git a/misc/chm2pdf/chm2pdf.SlackBuild b/misc/chm2pdf/chm2pdf.SlackBuild
index 9411605ee0..0e60c0ea6f 100644
--- a/misc/chm2pdf/chm2pdf.SlackBuild
+++ b/misc/chm2pdf/chm2pdf.SlackBuild
@@ -27,7 +27,7 @@
PRGNAM=chm2pdf
VERSION=${VERSION:-0.9.1}
ARCH=${ARCH:-i486}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
CWD=$(pwd)
@@ -50,6 +50,11 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
+# Apply a patch againsts a security problem with temporary dirs.
+# Bug report from Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501959
+# Patch from Gentoo: http://bugs.gentoo.org/205208
+cat $CWD/patches/tempdir.patch | patch -p1
+
python setup.py build
python setup.py install --root $PKG
@@ -68,4 +73,4 @@ mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
-/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/misc/chm2pdf/chm2pdf.info b/misc/chm2pdf/chm2pdf.info
index fc0f0bc5a0..77eb312faa 100644
--- a/misc/chm2pdf/chm2pdf.info
+++ b/misc/chm2pdf/chm2pdf.info
@@ -3,6 +3,8 @@ VERSION="0.9.1"
HOMEPAGE="http://code.google.com/p/chm2pdf"
DOWNLOAD="http://chm2pdf.googlecode.com/files/chm2pdf-0.9.1.tar.gz"
MD5SUM="2d5518e3284cca496270566c2554b713"
-MAINTAINER="Joćo Felipe Santos"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="JoĆ£o Felipe Santos"
EMAIL="joao.eel[at]gmail.com"
-APPROVED="rworkman"
+APPROVED="dsomero"
diff --git a/misc/chm2pdf/patches/tempdir.patch b/misc/chm2pdf/patches/tempdir.patch
new file mode 100644
index 0000000000..6bb5fe55d0
--- /dev/null
+++ b/misc/chm2pdf/patches/tempdir.patch
@@ -0,0 +1,71 @@
+--- chm2pdf-0.9.1.orig/chm2pdf 2008-07-09 12:42:26.000000000 +0200
++++ chm2pdf-0.9.1/chm2pdf 2009-02-25 20:58:53.000000000 +0100
+@@ -27,6 +27,8 @@
+ import os, os.path
+ import re, glob
+ import getopt
++import tempfile
++import shutil
+ # from BeautifulSoup import BeautifulSoup
+
+ global version
+@@ -39,8 +41,8 @@
+ global filename #the input filename
+
+ version = '0.9.1'
+-CHM2PDF_TEMP_WORK_DIR='/tmp/chm2pdf/work'
+-CHM2PDF_TEMP_ORIG_DIR='/tmp/chm2pdf/orig'
++CHM2PDF_TEMP_WORK_DIR=tempfile.mkdtemp()
++CHM2PDF_TEMP_ORIG_DIR=tempfile.mkdtemp()
+
+
+
+@@ -299,16 +301,6 @@
+ # ########################### File extraction and correction: START ############################
+ #
+ if options['dontextract'] == '':
+-
+- try:
+- os.mkdir(CHM2PDF_TEMP_WORK_DIR)
+- except OSError: # The directory already exists.
+- pass
+-
+- try:
+- os.mkdir(CHM2PDF_TEMP_ORIG_DIR)
+- except OSError: # The directory already exists.
+- pass
+
+ try:
+ os.mkdir(CHM2PDF_ORIG_DIR)
+@@ -620,7 +612,7 @@
+ print '\t--continuous\n\t\tSpecifies that the HTML sources are unstructured (plain web pages).\n\t\tNo page breaks are inserted between each file or URL in the output.'
+ print '\t--cookies \'name="value with space"; name=value\'\n\t\t'
+ print '\t--datadir directory\n\t\tSpecifies the location of the HTMLDOC data files, usually /usr/share/htmldoc or C:\Program Files\HTMLDOC '
+- print "\t--dontextract \n\t\tIf given, %s will not extract the HTML files from the given CHM file, but will use previously extracted copies from the temporary directory " %name + '(i.e. ' + CHM2PDF_TEMP_ORIG_DIR + ' and ' + CHM2PDF_TEMP_WORK_DIR + '). Usually you will use this option after you have used the \'--extract-only\' option to extract the files in order to correct them manually (in ' + CHM2PDF_TEMP_WORK_DIR + '). After the correction, a call with \'--dontextract\' will not overwrite your changes, but will use the corrected files instead.'
++# print "\t--dontextract \n\t\tIf given, %s will not extract the HTML files from the given CHM file, but will use previously extracted copies from the temporary directory " %name + '(i.e. ' + CHM2PDF_TEMP_ORIG_DIR + ' and ' + CHM2PDF_TEMP_WORK_DIR + '). Usually you will use this option after you have used the \'--extract-only\' option to extract the files in order to correct them manually (in ' + CHM2PDF_TEMP_WORK_DIR + '). After the correction, a call with \'--dontextract\' will not overwrite your changes, but will use the corrected files instead.'
+ print '\t--duplex\n\t\tSpecifies that the output should be formatted for double-sided printing.'
+ print '\t--effectduration {0.1..10.0}\n\t\tSpecifies the duration in seconds of PDF page transition effects.'
+ print '\t--embedfonts\n\t\tSpecifies that fonts should be embedded in PDF output.'
+@@ -1084,13 +1076,6 @@
+ print 'CHM file "' + filename + '" not found!'
+ return
+
+- #remove temporary files
+- if options['dontextract'] == '':
+- if options['verbose']=='--verbose' and options['verbositylevel']=='high':
+- print 'Removing any previous temporary files...'
+- os.system('rm -r '+CHM2PDF_ORIG_DIR+'/*')
+- os.system('rm -r '+CHM2PDF_WORK_DIR+'/*')
+-
+ cfile = chm.CHMFile()
+ cfile.LoadCHM(filename)
+
+@@ -1105,6 +1090,8 @@
+ os.system('extract_chmLib ' + filename + ' ' + CHM2PDF_ORIG_DIR + '&> /dev/null')
+
+ convert_to_pdf(cfile, filename, outputfilename, options)
++ shutil.rmtree(CHM2PDF_TEMP_WORK_DIR)
++ shutil.rmtree(CHM2PDF_TEMP_ORIG_DIR)
+
+
+ if __name__ == '__main__':