converted steps to functions for easier step selection

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4783 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2006-10-20 14:18:37 +00:00
parent 36dfefcf4b
commit 869fdd42f8

View file

@ -91,7 +91,7 @@ CVS_TAG = 'v' + ''.join(VERSION.split('.'))
newverdir = 'nsis-%s-src' % VERSION newverdir = 'nsis-%s-src' % VERSION
### some useful functions ### utility functions
def log(msg, log_dir = '.'): def log(msg, log_dir = '.'):
open('%s\\release-%s.log' % (log_dir, VERSION), 'a').write(msg + '\n') open('%s\\release-%s.log' % (log_dir, VERSION), 'a').write(msg + '\n')
@ -125,129 +125,122 @@ def confirm(question):
if raw_input() != 'y': if raw_input() != 'y':
sys.exit(2) sys.exit(2)
### confirm ### process functions
confirm('are you sure you want to release version %s?' % VERSION) def Confirm():
confirm('did you update history.but?') confirm('are you sure you want to release version %s?' % VERSION)
confirm('did you update history.but?')
### start log def StartLog():
open('release-%s.log' % VERSION, 'w').write('releasing version %s at %s\n\n' % (VERSION, time.ctime()))
open('release-%s.log' % VERSION, 'w').write('releasing version %s at %s\n\n' % (VERSION, time.ctime())) def RunTests():
print 'running tests...'
### test run(
print 'running tests...'
run(
'scons -C .. test', 'scons -C .. test',
'test', 'test',
'tests failed - see test.log for details' 'tests failed - see test.log for details'
) )
### create images def CreateMenuImage():
print 'creating images...'
print 'creating images...' ## create new header.gif for menu
## create new header.gif for menu im = Image.new('RGB', (598, 45), '#000000')
im = Image.new('RGB', (598, 45), '#000000') # copy background from header-notext.gif
# copy background from header-notext.gif bim = Image.open(r'..\Menu\images\header-notext.gif')
im.paste(bim)
bim = Image.open(r'..\Menu\images\header-notext.gif') # draw new version number
im.paste(bim)
# draw new version number draw = ImageDraw.Draw(im)
font = ImageFont.truetype('trebuc.ttf', 24)
text = 'nullsoft scriptable install system %s' % VERSION
draw.text((85, 7), text, font = font, fill = 'white')
draw = ImageDraw.Draw(im) # save
font = ImageFont.truetype('trebuc.ttf', 24)
text = 'nullsoft scriptable install system %s' % VERSION
draw.text((85, 7), text, font = font, fill = 'white')
# save im = im.convert('P', palette = Image.ADAPTIVE)
im.save(r'..\Menu\images\header.gif')
im = im.convert('P', palette = Image.ADAPTIVE) def CommitMenuImage():
im.save(r'..\Menu\images\header.gif') print 'committing header.gif...'
# commit header.gif run(
print 'committing header.gif...'
run(
'%s commit -m %s ..\\Menu\\images\\header.gif' % (CVS, VERSION), '%s commit -m %s ..\\Menu\\images\\header.gif' % (CVS, VERSION),
'header.gif.commit', 'header.gif.commit',
'failed committing header.gif' 'failed committing header.gif'
) )
### test installer def TestInstaller():
print 'testing installer...'
print 'testing installer...' os.mkdir('insttestscons')
os.mkdir('insttestscons') run(
run(
'scons -C .. VERSION=test PREFIX=%s\\insttestscons install dist-installer' % os.getcwd(), 'scons -C .. VERSION=test PREFIX=%s\\insttestscons install dist-installer' % os.getcwd(),
'inst', 'inst',
'installer creation failed' 'installer creation failed'
) )
run( run(
'..\\nsis-test-setup.exe /S /D=%s\\insttest' % os.getcwd(), '..\\nsis-test-setup.exe /S /D=%s\\insttest' % os.getcwd(),
None, None,
'installer failed' 'installer failed'
) )
run( run(
'diff -r insttest insttestscons | grep -v uninst-nsis.exe', 'diff -r insttest insttestscons | grep -v uninst-nsis.exe',
'diff', 'diff',
'scons and installer installations differ', 'scons and installer installations differ',
1 1
) )
### tag def Tag():
print 'tagging...'
print 'tagging...' run(
run(
'%s -z3 tag -R %s ..' % (CVS, CVS_TAG), '%s -z3 tag -R %s ..' % (CVS, CVS_TAG),
'tag', 'tag',
'failed creating tag %s' % CVS_TAG 'failed creating tag %s' % CVS_TAG
) )
### export def Export():
print 'exporting a fresh copy...'
print 'exporting a fresh copy...' run(
run(
'%s -z3 export -r %s -d %s NSIS' % (CVS, CVS_TAG, newverdir), '%s -z3 export -r %s -d %s NSIS' % (CVS, CVS_TAG, newverdir),
'export', 'export',
'export failed' 'export failed'
) )
### create source tarball def CreateSourceTarball():
print 'creating source tarball...'
print 'creating source tarball...' run(
run(
TAR_BZ2 % (newverdir + '.tar.bz2', newverdir), TAR_BZ2 % (newverdir + '.tar.bz2', newverdir),
'tarball', 'tarball',
'source tarball creation failed' 'source tarball creation failed'
) )
### build release files def BuildRelease():
scons_line = 'scons -C %s VERSION=%s VER_MAJOR=%s VER_MINOR=%s VER_REVISION=%s VER_BUILD=%s ' \
scons_line = 'scons -C %s VERSION=%s VER_MAJOR=%s VER_MINOR=%s VER_REVISION=%s VER_BUILD=%s ' \
% (newverdir, VERSION, VER_MAJOR, VER_MINOR, VER_REVISION, VER_BUILD) % (newverdir, VERSION, VER_MAJOR, VER_MINOR, VER_REVISION, VER_BUILD)
print 'creating distribution files...' print 'creating distribution files...'
run( run(
scons_line + 'dist', scons_line + 'dist',
'dist', 'dist',
'creation of distribution files failed' 'creation of distribution files failed'
) )
def create_special_build(name, option): def CreateSpecialBuilds():
def create_special_build(name, option):
print 'creating %s special build...' % name print 'creating %s special build...' % name
os.mkdir(name) os.mkdir(name)
@ -267,44 +260,41 @@ def create_special_build(name, option):
) )
os.chdir('..') os.chdir('..')
create_special_build('strlen_8192', 'NSIS_MAX_STRLEN=8192') create_special_build('strlen_8192', 'NSIS_MAX_STRLEN=8192')
create_special_build('log', 'NSIS_CONFIG_LOG=yes') create_special_build('log', 'NSIS_CONFIG_LOG=yes')
### upload files to SourceForge def UploadFiles():
print 'uploading files to SourceForge...'
print 'uploading files to SourceForge...' def upload(ftp, file):
def upload(ftp, file):
print ' uploading %s...' % file print ' uploading %s...' % file
ftp.storbinary('STOR /incoming/%s' % file.split('\\')[-1], open(file, 'rb')) ftp.storbinary('STOR /incoming/%s' % file.split('\\')[-1], open(file, 'rb'))
ftp = FTP('upload.sourceforge.net') ftp = FTP('upload.sourceforge.net')
ftp.login() ftp.login()
upload(ftp, newverdir + '.tar.bz2') upload(ftp, newverdir + '.tar.bz2')
upload(ftp, newverdir + '\\nsis-%s-setup.exe' % VERSION) upload(ftp, newverdir + '\\nsis-%s-setup.exe' % VERSION)
upload(ftp, newverdir + '\\nsis-%s.zip' % VERSION) upload(ftp, newverdir + '\\nsis-%s.zip' % VERSION)
upload(ftp, 'nsis-%s-log.zip' % VERSION) upload(ftp, 'nsis-%s-log.zip' % VERSION)
upload(ftp, 'nsis-%s-strlen_8192.zip' % VERSION) upload(ftp, 'nsis-%s-strlen_8192.zip' % VERSION)
ftp.quit() ftp.quit()
### update some websites... def ManualRelease():
print 'release url:'
print ' http://sourceforge.net/project/admin/qrs.php?package_id=0&group_id=22049'
print
# manual release sys.stdout.write('What\'s the SF release id of the new version? ')
release_id = raw_input()
print 'release url:' return release_id
print ' http://sourceforge.net/project/admin/qrs.php?package_id=0&group_id=22049'
print
sys.stdout.write('What\'s the SF release id of the new version? ') def UpdateWiki(release_id):
release_id = raw_input() print 'updating wiki...'
# update wiki def update_wiki_page(page, data, summary):
print 'updating wiki...'
def update_wiki_page(page, data, summary):
print ' updating `%s` to `%s`' % (page, data) print ' updating `%s` to `%s`' % (page, data)
import urllib import urllib
@ -319,28 +309,46 @@ def update_wiki_page(page, data, summary):
log('*** failed updating `%s` wiki page' % page) log('*** failed updating `%s` wiki page' % page)
print ' *** failed updating `%s` wiki page' % page print ' *** failed updating `%s` wiki page' % page
update_wiki_page('Template:NSISVersion', VERSION, 'new version') update_wiki_page('Template:NSISVersion', VERSION, 'new version')
update_wiki_page('Template:NSISReleaseDate', time.strftime('%B %d, %Y'), 'new version') update_wiki_page('Template:NSISReleaseDate', time.strftime('%B %d, %Y'), 'new version')
update_wiki_page('Template:NSISReleaseID', release_id, 'new version') update_wiki_page('Template:NSISReleaseID', release_id, 'new version')
# update changelog start time def UpdateChangeLog():
run(
run(
'%s touch /home/groups/n/ns/nsis/bin/cl.timestamp' % RSH, '%s touch /home/groups/n/ns/nsis/bin/cl.timestamp' % RSH,
'cl-timestamp', 'cl-timestamp',
'change log start time modification failed' 'change log start time modification failed'
) )
### still left to do def ToDo():
print 'automatic phase done\n'
print 'automatic phase done\n' print """
print """
* Edit update.php * Edit update.php
* Post news item
* http://en.wikipedia.org/w/index.php?title=Nullsoft_Scriptable_Install_System&action=edit * http://en.wikipedia.org/w/index.php?title=Nullsoft_Scriptable_Install_System&action=edit
* Update Freshmeat * Update Freshmeat
* Update BetaNews * Update BetaNews
""" """
### all done def CloseLog():
log('done')
log('done') ### ok, let's go!
Confirm()
StartLog()
RunTests()
CreateMenuImage()
CommitMenuImage()
TestInstaller()
Tag()
Export()
CreateSourceTarball()
BuildRelease()
CreateSpecialBuilds()
UploadFiles()
release_id = ManualRelease()
UpdateWiki(release_id)
UpdateChangeLog()
ToDo()
CloseLog()