1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

update build script

This commit is contained in:
Lu Wang 2013-05-30 00:52:20 +08:00
parent f655a8af42
commit 3fd823e082
2 changed files with 28 additions and 16 deletions

38
build_for_ppa.py Normal file → Executable file
View File

@ -7,6 +7,9 @@ by WangLu
modified for pdf2htmlEX modified for pdf2htmlEX
2012.08.28 2012.08.28
modified for general git repo
2013.05.30
""" """
@ -16,10 +19,18 @@ import re
import time import time
package='pdf2htmlex' package='pdf2htmlex'
SUPPORTED_DIST=('precise', 'quantal', 'raring') ppa_name='pdf2htmlex'
dist_pattern=re.compile('|'.join(['\\) '+i for i in SUPPORTED_DIST])) supported_distributions=('precise', 'quantal', 'raring')
dist_pattern=re.compile('|'.join(['\\) '+i for i in supported_distributions]))
archive_cmd='(rm CMakeCache.txt || true) && cmake . && make dist'
archive_suffix='.tar.bz2'
print 'Generating version...' print 'Generating version...'
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)
try: try:
rev = open('.git/refs/heads/master').read()[:5] rev = open('.git/refs/heads/master').read()[:5]
@ -27,14 +38,8 @@ except:
print 'Cannot get revision number' print 'Cannot get revision number'
sys.exit(-1) sys.exit(-1)
today_timestr = time.strftime('%Y%m%d%H%M')
projectdir=os.getcwd() projectdir=os.getcwd()
try: today_timestr = time.strftime('%Y%m%d%H%M')
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 deb_version = version+'-1~git'+today_timestr+'r'+rev
full_deb_version = deb_version+'-0ubuntu1' full_deb_version = deb_version+'-0ubuntu1'
@ -50,7 +55,8 @@ with open('debian/changelog') as f:
print 'Failed when updating debian/changelog' print 'Failed when updating debian/changelog'
sys.exit(-1) sys.exit(-1)
f.seek(0) # changelog may have been updated, reopen it
with open('debian/changelog') as f:
#check dist mark of changelog #check dist mark of changelog
changelog = f.read() changelog = f.read()
m = dist_pattern.search(changelog) m = dist_pattern.search(changelog)
@ -61,16 +67,16 @@ with open('debian/changelog') as f:
print print
print 'Preparing build ...' print 'Preparing build ...'
# handling files # handling files
if os.system('(rm CMakeCache.txt || true) && cmake . && make dist') != 0: if os.system(archive_cmd) != 0:
print 'Failed in creating tarball' print 'Failed in creating tarball'
sys.exit(-1) sys.exit(-1)
orig_tar_filename = package+'-'+version+'.tar.bz2' orig_tar_filename = package+'-'+version+archive_suffix
if os.system('test -e %s && cp %s ../build-area' % (orig_tar_filename, orig_tar_filename)) != 0: 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' print 'Cannot copy tarball file to build area'
sys.exit(-1) sys.exit(-1)
deb_orig_tar_filename = package+'_'+deb_version+'.orig.tar.bz2' deb_orig_tar_filename = package+'_'+deb_version+'.orig'+archive_suffix
try: try:
os.chdir('../build-area') os.chdir('../build-area')
@ -93,7 +99,7 @@ except:
os.system('cp -r %s/debian .' % (projectdir,)) os.system('cp -r %s/debian .' % (projectdir,))
for cur_dist in SUPPORTED_DIST: for cur_dist in supported_distributions:
print print
print 'Building for ' + cur_dist + ' ...' print 'Building for ' + cur_dist + ' ...'
# substitute distribution name # substitute distribution name
@ -120,7 +126,7 @@ for cur_dist in SUPPORTED_DIST:
""" """
print 'Uploading' print 'Uploading'
if os.system('dput ppa:coolwanglu/%s ../%s' % (package, package+'_'+full_deb_version+'~'+cur_dist+'1_source.changes')) != 0: if os.system('dput %s ../%s' % (ppa_name, package+'_'+full_deb_version+'~'+cur_dist+'1_source.changes')) != 0:
print 'Failed in uploading by dput' print 'Failed in uploading by dput'
sys.exit(-1) sys.exit(-1)

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
pdf2htmlex (0.9-1~git201305291247rf655a-0ubuntu1) raring; urgency=low
* Regular upload
-- WANG Lu <coolwanglu@gmail.com> Wed, 29 May 2013 12:47:16 +0800
pdf2htmlex (0.8-1~git201305051429r92eab-0ubuntu1) raring; urgency=low pdf2htmlex (0.8-1~git201305051429r92eab-0ubuntu1) raring; urgency=low
* v0.8 released, see Changelog * v0.8 released, see Changelog