1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-06-26 06:09:21 +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 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!'

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
* HTML optimization

View File

@ -1,13 +1,12 @@
# pdf2htmlEX manifest
# by WangLu
# 2012.09.12
# Copyright (C) 2012,2013 Lu Wang <coolwanglu@gmail.com>
#
# 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