diff --git a/build_for_ppa.py b/build_for_ppa.py index 250f085..17f6fd1 100755 --- a/build_for_ppa.py +++ b/build_for_ppa.py @@ -15,6 +15,10 @@ import sys import re import time +package='pdf2htmlex' +SUPPORTED_DIST=('precise', 'quantal', 'raring') +dist_pattern=re.compile('|'.join(['\\) '+i for i in SUPPORTED_DIST])) + print 'Generating version...' try: @@ -24,8 +28,7 @@ except: sys.exit(-1) today_timestr = time.strftime('%Y%m%d%H%M') -package='pdf2htmlex' -projectname='pdf2htmlEX' +projectdir=os.getcwd() try: version = re.findall(r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', open('CMakeLists.txt').read())[0] except: @@ -36,18 +39,27 @@ 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' +with open('debian/changelog') as f: + if re.findall(r'\(([^)]+)\)', f.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) + + f.seek(0) + #check dist mark of changelog + changelog = f.read() + m = dist_pattern.search(changelog) + if m is None or m.pos >= changelog.find('\n'): + print 'Cannot locate the dist name in the first line of changelog' sys.exit(-1) print -print 'Building...' +print 'Preparing build ...' # handling files if os.system('(rm CMakeCache.txt || true) && cmake . && make dist') != 0: print 'Failed in creating tarball' @@ -79,28 +91,38 @@ except: print 'Cannot enter project dir' sys.exit(-1) -os.system('cp -r ../../%s/debian .' % (projectname,)) +os.system('cp -r %s/debian .' % (projectdir,)) -# building -if os.system('debuild -S -sa') != 0: - print 'Failed in debuild' - sys.exit(-1) +for cur_dist in SUPPORTED_DIST: + print + print 'Building for ' + cur_dist + ' ...' + # substitute distribution name + with open('debian/changelog', 'w') as f: + f.write(dist_pattern.sub('~%s1) %s' % (cur_dist, cur_dist), changelog, 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\':') + # 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) + if ans == 'n': + print 'Skipped.' + sys.exit(0) + """ + + print 'Uploading' + if os.system('dput ppa:coolwanglu/%s ../%s' % (package, package+'_'+full_deb_version+'~'+cur_dist+'1_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 index af6f239..a882abe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +pdf2htmlex (0.8-1~git201304281550rd5f9c-0ubuntu1) raring; urgency=low + + * Test packaging for multiple distributions + * Fix crashing with --split-pages + + -- WANG Lu Sun, 28 Apr 2013 15:39:34 +0800 + pdf2htmlex (0.8-1~git201304151420r1da9b-0ubuntu1) quantal; urgency=low * HTML optimization diff --git a/share/manifest b/share/manifest index 8478bc2..0be2144 100644 --- a/share/manifest +++ b/share/manifest @@ -1,13 +1,12 @@ # pdf2htmlEX manifest -# by WangLu -# 2012.09.12 +# Copyright (C) 2012,2013 Lu Wang # # Syntax # The first char of each line is the command # Empty lines are ignored # # # - comment -# @ - include a file from data dir +# @ - embed or link to a file from data dir, depending on the value of --single-html # $ - special use for pdf2htmlEX # # Special