1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-01 07:59:00 +00:00

support multiple distribution for PPA

This commit is contained in:
Lu Wang 2013-04-30 12:20:31 +08:00
parent d5f9c23ec1
commit 84988c7c28
3 changed files with 60 additions and 32 deletions

View File

@ -15,6 +15,10 @@ import sys
import re import re
import time import time
package='pdf2htmlex'
SUPPORTED_DIST=('precise', 'quantal', 'raring')
dist_pattern=re.compile('|'.join(['\\) '+i for i in SUPPORTED_DIST]))
print 'Generating version...' print 'Generating version...'
try: try:
@ -24,8 +28,7 @@ except:
sys.exit(-1) sys.exit(-1)
today_timestr = time.strftime('%Y%m%d%H%M') today_timestr = time.strftime('%Y%m%d%H%M')
package='pdf2htmlex' projectdir=os.getcwd()
projectname='pdf2htmlEX'
try: try:
version = re.findall(r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', open('CMakeLists.txt').read())[0] version = re.findall(r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)', open('CMakeLists.txt').read())[0]
except: except:
@ -36,18 +39,27 @@ deb_version = version+'-1~git'+today_timestr+'r'+rev
full_deb_version = deb_version+'-0ubuntu1' full_deb_version = deb_version+'-0ubuntu1'
#check if we need to update debian/changelog #check if we need to update debian/changelog
if re.findall(r'\(([^)]+)\)', open('debian/changelog').readline())[0] == full_deb_version: with open('debian/changelog') as f:
print if re.findall(r'\(([^)]+)\)', f.readline())[0] == full_deb_version:
print 'No need to update debian/changelog, skipping' print
else: print 'No need to update debian/changelog, skipping'
print else:
print 'Writing debian/changelog' print
if os.system('dch -v "%s"' % (full_deb_version,)) != 0: print 'Writing debian/changelog'
print 'Failed when updating 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) sys.exit(-1)
print print
print 'Building...' print 'Preparing build ...'
# handling files # handling files
if os.system('(rm CMakeCache.txt || true) && cmake . && make dist') != 0: if os.system('(rm CMakeCache.txt || true) && cmake . && make dist') != 0:
print 'Failed in creating tarball' print 'Failed in creating tarball'
@ -79,28 +91,38 @@ except:
print 'Cannot enter project dir' print 'Cannot enter project dir'
sys.exit(-1) sys.exit(-1)
os.system('cp -r ../../%s/debian .' % (projectname,)) os.system('cp -r %s/debian .' % (projectdir,))
# building for cur_dist in SUPPORTED_DIST:
if os.system('debuild -S -sa') != 0: print
print 'Failed in debuild' print 'Building for ' + cur_dist + ' ...'
sys.exit(-1) # substitute distribution name
with open('debian/changelog', 'w') as f:
f.write(dist_pattern.sub('~%s1) %s' % (cur_dist, cur_dist), changelog, 1))
print # building
sys.stdout.write('Everything seems to be good so far, upload?(y/n)') if os.system('debuild -S -sa') != 0:
sys.stdout.flush() print 'Failed in debuild'
ans = raw_input().lower() sys.exit(-1)
while ans not in ['y', 'n']:
sys.stdout.write('I don\'t understand, enter \'y\' or \'n\':') """
print
sys.stdout.write('Everything seems to be good so far, upload?(y/n)')
sys.stdout.flush()
ans = raw_input().lower() 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': if ans == 'n':
print 'Skipped.' print 'Skipped.'
sys.exit(0) sys.exit(0)
"""
if os.system('dput ppa:coolwanglu/%s ../%s' % (package, package+'_'+full_deb_version+'_source.changes')) != 0: print 'Uploading'
print 'Failed in uploading by dput' if os.system('dput ppa:coolwanglu/%s ../%s' % (package, package+'_'+full_deb_version+'~'+cur_dist+'1_source.changes')) != 0:
sys.exit(-1) print 'Failed in uploading by dput'
sys.exit(-1)
print 'Build area not cleaned.' print 'Build area not cleaned.'
print 'All done. Cool!' print 'All done. Cool!'

7
debian/changelog vendored
View File

@ -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 <coolwanglu@gmail.com> Sun, 28 Apr 2013 15:39:34 +0800
pdf2htmlex (0.8-1~git201304151420r1da9b-0ubuntu1) quantal; urgency=low pdf2htmlex (0.8-1~git201304151420r1da9b-0ubuntu1) quantal; urgency=low
* HTML optimization * HTML optimization

View File

@ -1,13 +1,12 @@
# pdf2htmlEX manifest # pdf2htmlEX manifest
# by WangLu # Copyright (C) 2012,2013 Lu Wang <coolwanglu@gmail.com>
# 2012.09.12
# #
# Syntax # Syntax
# The first char of each line is the command # The first char of each line is the command
# Empty lines are ignored # Empty lines are ignored
# #
# # - comment # # - 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 use for pdf2htmlEX
# #
# Special # Special