From ec989f5b4fb6186b95a20734b10f7f4b6b6c9a20 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Tue, 28 Aug 2012 01:32:39 +0800 Subject: [PATCH] add file for debian/ubuntu packaging --- build_for_ppa.py | 109 ++++++++++++++++++++++++++++++++++++++ debian/changelog | 6 +++ debian/compat | 1 + debian/control | 13 +++++ debian/copyright | 10 ++++ debian/dirs | 1 + debian/docs | 3 ++ debian/pdf2htmlex.install | 5 ++ debian/rules | 4 ++ debian/source/format | 2 + 10 files changed, 154 insertions(+) create mode 100755 build_for_ppa.py create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100644 debian/pdf2htmlex.install create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/build_for_ppa.py b/build_for_ppa.py new file mode 100755 index 0000000..13688c9 --- /dev/null +++ b/build_for_ppa.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python + +""" +Dirty script for building package for PPA +by WangLu +2011.01.13 + +modified by pdf2htmlEX +2012.08.28 +""" + + +import os +import sys +import re +import time + +print 'Generating version...' + +try: + rev = open('.git/refs/heads/devv').read()[:5] +except: + print 'Cannot get revision number' + sys.exit(-1) + +today_timestr = time.strftime('%Y%m%d') +package='pdf2htmlex' +projectname='pdf2htmlEX' +try: + version = re.findall(r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', open('CMakeLists.txt').read())[0] +except: + print 'Cannot get package name and version number' + sys.exit(-1) + +deb_version = version+'-1~git'+today_timestr+'r'+rev +full_deb_version = deb_version+'-0ubuntu1' + +#check if we need to update debian/changelog +if re.findall(r'\(([^)]+)\)', open('debian/changelog').readline())[0] == full_deb_version: + print + print 'No need to update debian/changelog, skipping' +else: + print + print 'Writing debian/changelog' + if os.system('dch -v "%s"' % (full_deb_version,)) != 0: + print 'Failed when updating debian/changelog' + sys.exit(-1) + +print +print 'Building...' +# handling files +if os.system('rm CMakeCache.txt && cmake . && make dist') != 0: + print 'Failed in creating tarball' + sys.exit(-1) + +orig_tar_filename = package+'-'+version+'.tar.bz2' +if os.system('test -e %s && cp %s ../build-area' % (orig_tar_filename, orig_tar_filename)) != 0: + print 'Cannot copy tarball file to build area' + sys.exit(-1) + +deb_orig_tar_filename = package+'_'+deb_version+'.orig.tar.bz2' + +try: + os.chdir('../build-area') +except: + print 'Cannot find ../build-area' + sys.exit(-1) + +# remove old dir +os.system('rm -rf %s' % (package+'-'+version,)) + +if os.system('mv %s %s && tar -xvf %s' % (orig_tar_filename, deb_orig_tar_filename, deb_orig_tar_filename)) != 0: + print 'Cannot extract tarball' + sys.exit(-1) + +try: + os.chdir(package+'-'+version) +except: + print 'Cannot enter project dir' + sys.exit(-1) + +os.system('cp -r ../../%s/debian .' % (projectname,)) + +# building +if os.system('debuild -S -sa') != 0: + print 'Failed in debuild' + sys.exit(-1) + +print +sys.stdout.write('Everything seems to be good so far, upload?(y/n)') +sys.stdout.flush() +ans = raw_input().lower() +while ans not in ['y', 'n']: + sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') + ans = raw_input().lower() + +if ans == 'n': + print 'Skipped.' + sys.exit(0) + +if os.system('dput ppa:coolwanglu/%s ../%s' % (package, package+'_'+full_deb_version+'_source.changes')) != 0: + print 'Failed in uploading by dput' + sys.exit(-1) + +print 'Build area not cleaned.' +print 'All done. Cool!' + + + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..7e1957b --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +pdf2htmlex (0.1-1~svn20120828r99a3a-0ubuntu1) precise; urgency=low + + * Initial release. + + -- WANG Lu Tue, 28 Aug 2012 01:26:33 +0800 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..e6dd3f9 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: pdf2htmlex +Section: utils +Priority: extra +Maintainer: WANG Lu +Build-Depends: cmake (>= 2.6.0), debhelper (>= 8), libpoppler-dev (>= 0.20.3), libboost-filesystem-dev, libboost-program-options-dev +Standards-Version: 3.9.2 +Homepage: http://github.com/coolwanglu/pdf2htmlEX + +Package: pdf2htmlex +Architecture: any +Depends: libpoppler (>= 0.20.3), fontforge, libboost-filesystem1.46.1, libboost-progam-options1.46.1, +Description: Converts PDF to HTML without losing format + pdf2htmlEX converts PDF to HTML while retaining text, format & style as much as possible diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..4159e62 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,10 @@ +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=173 +Upstream-Name: pdf2htmlEX +Source: +Upstream-Contact: + WANG Lu . + +Files: * +Copyright © 2012 WANG Lu +License: GPL-3+ + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..e772481 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..5502ed8 --- /dev/null +++ b/debian/docs @@ -0,0 +1,3 @@ +NEWS +README +TODO diff --git a/debian/pdf2htmlex.install b/debian/pdf2htmlex.install new file mode 100644 index 0000000..45a6c38 --- /dev/null +++ b/debian/pdf2htmlex.install @@ -0,0 +1,5 @@ +usr/bin/scanmem +usr/share/pdf2htmlEX/all.css +usr/share/pdf2htmlEX/head.html +usr/share/pdf2htmlEX/neck.html +usr/share/pdf2htmlEX/tail.html diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..4f2c774 --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f +%: + dh $@ + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..c3d9f24 --- /dev/null +++ b/debian/source/format @@ -0,0 +1,2 @@ +3.0 (quilt) +