diff --git a/tools/announce-wrangler.py b/tools/announce-wrangler.py deleted file mode 100644 index cf9248642..000000000 --- a/tools/announce-wrangler.py +++ /dev/null @@ -1,159 +0,0 @@ -import commands -import xml.dom.minidom -import glob -import wordpresslib # http://www.blackbirdblog.it/programmazione/progetti/28 -import ConfigParser -import os -import re - -doaps = glob.glob("*.doap") - -if len(doaps)==0: - print 'Please run this from the top-level directory.' - -description=str(xml.dom.minidom.parse(doaps[0]).getElementsByTagName('shortdesc')[0].firstChild.toxml().strip()) - -program_name = doaps[0][:-5] -print program_name - -markup = { - 'text': { - 'open': ' *', - 'newline': ' ', - 'close': '', - }, - 'html': { - 'open': '
  • ', - 'newline': '', - 'close': '
  • ', - }, -} - -def text_list(list, type): - result = [] - for entry in list: - result.append(markup[type]['open']) - for word in entry.split(): - if len(result[-1]+word)>75: - result.append(markup[type]['newline']) - result[-1] = result[-1] + ' ' + word - if result[-1].strip()=='': - result = result[:-1] - result[-1] = result[-1] + markup[type]['close'] - return '\n'.join(result) - -news = file('NEWS') -news_entry = [] -header_count = 0 - -while header_count<2: - line = news.readline().replace('\n', '') - news_entry.append(line) - if line.startswith('='): - header_count = header_count + 1 - -news.close() - -version = news_entry[0] -news_entry = news_entry[2:-2] - -print version -majorminor = '.'.join(version.split('.')[:2]) -md5s = commands.getoutput('ssh master.gnome.org md5sum /ftp/pub/GNOME/sources/metacity/%s/%s-%s.tar*' % (majorminor, program_name, version)).split() -if len(md5s)!=4: - print 'WARNING: There were not two known tarballs' - -md5_values = {} - -for i in range(0, len(md5s), 2): - a = md5s[i+1] - md5_values[a[a.rindex('.'):]] = md5s[i] - -print md5_values - -changes = [] -translations = '' - -reading_changes = False -reading_translations = False -for line in news_entry: - line = line.replace('(#', '(GNOME bug ').strip() - if line.startswith('-'): - changes.append(line[2:]) - reading_changes = True - elif reading_changes: - if line=='': - reading_changes = False - else: - changes[-1] = changes[-1] + ' ' + line - elif line=='Translations': - reading_translations = True - elif reading_translations: - translations = translations + ' ' + line - -translations = translations[1:] - -text_links = [] -for i in ('.bz2', '.gz'): - text_links.append('%s http://download.gnome.org/sources/metacity/%s/%s-%s.tar%s' % ( - md5_values[i], majorminor, program_name, version, i)) - -text_version = """\ -What is it ? -============ -%s - -What's changed ? -================ -%s - -Translations: -%s - -Where can I get it ? -==================== -%s""" % (text_list([description], 'text'), - text_list(changes, 'text'), - text_list([translations], 'text'), - text_list(text_links, 'text')) - -print "============ x8 x8 x8 ===== SEND THIS TO gnome-announce-list" -print text_version -print "============ x8 x8 x8 ===== ENDS" - -translations = re.sub('\((.*)\)', - '(\\1)', - translations) - -html_version = """\ -What is it ?
    - - -What's changed ?
    - - -Translations:
    - - -Where can I get it ?
    -""" % (text_list([description], 'html'), - text_list(changes, 'html'), - text_list([translations], 'html'), - text_list(text_links, 'html')) - -cp = ConfigParser.ConfigParser() -cp.read(os.environ['HOME']+'/.config/metacity/tools.ini') - -wp = wordpresslib.WordPressClient( - cp.get('release-wrangler', 'blogurl'), - cp.get('release-wrangler', 'bloguser'), - cp.get('release-wrangler', 'blogpass')) -wp.selectBlog(cp.getint('release-wrangler', 'blognumber')) -post = wordpresslib.WordPressPost() -post.title = '%s %s released' % (program_name, version) -post.description = html_version -# appears to have been turned off-- ask jdub -#idPost = wp.newPost(post, False) - -print html_version - diff --git a/tools/commit-wrangler.py b/tools/commit-wrangler.py deleted file mode 100644 index 0ec68b71d..000000000 --- a/tools/commit-wrangler.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/python -# -# commit-wrangler.py - basic script to commit patches, primarily for -# Metacity, might be useful for others. In early stages of -# development. -# -# Copyright (C) 2008 Thomas Thurman -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . - -import time -import commands -import sys -import os -import posixpath -import ConfigParser -import re - -# FIXME: Needs tidying into separate functions. - -# FIXME: Some of this is duplicated from release-wrangler. -# This should go in a common library when the dust has settled. - -# FIXME: Some way of updating Bugzilla when we mention a bug, -# and including the revision number, would be really useful. - -# FIXME: This should co-operate with patch-wrangler in that -# p-w should find out the name of a patch's submitter from bugzilla -# and store it in a dotfile, and then we can use it here. -# Also, it should find out and store the bug number, so we can -# write it as "(Bug #nnn)", which will make the previous paragraph's -# idea even more useful. - -def get_up_to_date(): - "First step is always to get up to date." - os.system("svn up") - -def report_error(message): - print message - sys.exit(255) - -def favourite_editor(): - e = os.environ - if e.has_key('VISUAL'): return e['VISUAL'] - if e.has_key('EDITOR'): return e['EDITOR'] - if os.access('/usr/bin/nano', os.F_OK): - return '/usr/bin/nano' - report_error("I can't find an editor for you!") - -def wordwrap(str, prefix=''): - "Really simple wordwrap" - - # Ugly hack: - # We know that all open brackets are preceded by spaces. - # We don't want to split on these spaces. Therefore: - str = str.replace(' (','(') - - result = [''] - for word in str.split(): - - if result[-1]=='': - candidate = prefix + word - else: - candidate = '%s %s' % (result[-1], word) - - if len(candidate)>80: - result.append(prefix+word) - else: - result[-1] = candidate - - return '\n'.join(result).replace('(',' (') - -##################### - -change_filename = 'ChangeLog' - -get_up_to_date() - -cp = ConfigParser.ConfigParser() -cp.read(os.environ['HOME']+'/.config/metacity/tools.ini') - -os.environ['CHANGE_LOG_NAME'] = cp.get('commit-wrangler', 'name') -os.environ['CHANGE_LOG_EMAIL_ADDRESS'] = cp.get('commit-wrangler', 'address') - -print commands.getoutput('moap cl prep') - -time_before = os.stat(change_filename)[8] -os.system(favourite_editor()+' +6 %s ' % (change_filename)) - -if os.stat(change_filename)[8] == time_before: - print 'No change; aborting:' - print commands.getoutput('svn revert '+change_filename) - sys.exit(0) - -# Update the changelog - -checkin = commands.getoutput("moap cl ci") - -print re.sub(".*Committed revision (\\d+).*", 'http://svn.gnome.org/viewvc/metacity?rev=\\1&view=rev', checkin) - diff --git a/tools/patch-wrangler.py b/tools/patch-wrangler.py deleted file mode 100644 index c5e80c62f..000000000 --- a/tools/patch-wrangler.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/python - -# Little script to grab a patch, compile it, and make it. - -# Copyright (C) 2008 Thomas Thurman -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . - - -import os -import sys -import posixpath - -# FIXME: What would be lovely is an Epiphany extension to call this from Bugzilla pages - -# FIXME: Should be possible (but currently isn't) to get this from the patch number -program = 'metacity' - -if len(sys.argv)<2: - print 'Specify patch number' - sys.exit(255) - -patchnum = sys.argv[1] - -patchdir = posixpath.expanduser('~/patch/%s/%s' % (program, patchnum)) - -os.makedirs(patchdir) -os.chdir(patchdir) - -if os.system("svn co svn+ssh://svn.gnome.org/svn/%s/trunk ." % (program))!=0: - print "Checkout failed." - sys.exit(255) - -if os.system("wget http://bugzilla.gnome.org/attachment.cgi?id=%s -O - -q|patch -p 0" % (patchnum))!=0: - print "Patch failed." - sys.exit(255) - -if os.system("./autogen.sh")!=0: - print "Autogen failed." - sys.exit(255) - -if os.system("make")!=0: - print "Make failed." - sys.exit(255) - -print -print "It all seems to have worked. Don't look so surprised." -print "Dropping you into a new shell now so you're in the right" -print "directory; this does mean you'll have to exit twice when" -print "you're finished." -print - -shell = '/bin/sh' -if os.environ.has_key('SHELL'): - shell = os.environ['SHELL'] - -if os.system(shell): - print "Couldn't launch the shell, though." - sys.exit(255) diff --git a/tools/release-wrangler.py b/tools/release-wrangler.py deleted file mode 100644 index 1dcd5fe33..000000000 --- a/tools/release-wrangler.py +++ /dev/null @@ -1,375 +0,0 @@ -#!/usr/bin/python -# -# release-wrangler.py - very basic release system, primarily for -# Metacity, might be useful for others. In very early stages of -# development. -# -# Copyright (C) 2008 Thomas Thurman -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . - -import os -import posixpath -import re -import sys -import commands -import time -import commands - -def report_error(message): - print message - sys.exit(255) - -def get_up_to_date(): - "First step is always to get up to date." - os.system("svn up") - -# yes, I know this is MY username. I will come back and fix it -# later, but for now there is a lot else to do. FIXME -your_username = 'Thomas Thurman ' - -def changelog_and_checkin(filename, message): - changelog = open('ChangeLog.tmp', 'w') - changelog.write('%s %s\n\n * %s: %s\n\n' % ( - time.strftime('%Y-%m-%d',time.gmtime()), - your_username, - filename, - message)) - - for line in open('ChangeLog').readlines(): - changelog.write(line) - - changelog.close() - os.rename('ChangeLog.tmp', 'ChangeLog') - - if os.system('svn commit -m "%s"' % (message.replace('"','\\"')))!=0: - report_error("Could not commit; bailing.") - -def check_we_are_up_to_date(): - changed = [] - for line in commands.getoutput('/usr/bin/svn status').split('\n'): - if line!='' and (line[0]=='C' or line[0]=='M'): - if line.find('release-wrangler.py')==-1 and line.find('ChangeLog')==-1: - # we should be insensitive to changes in this script itself - # to avoid chicken-and-egg problems - changed.append(line[1:].lstrip()) - - if changed: - report_error('These files are out of date; I can\'t continue until you fix them: ' + \ - ', '.join(changed)) - -def version_numbers(): - # FIXME: This is all very metacity-specific. Compare fusa, etc - """Okay, read through configure.in and find who and where we are. - - We also try to figure out where the next micro version number - will be; some programs (e.g. Metacity) use a custom numbering - scheme, and if they have a list of numbers on the line before the - micro version then that will be used. Otherwise we will just - increment.""" - - version = {} - previous_line = '' - for line in file("configure.in").readlines(): - product_name = re.search("^AC_INIT\(\[([^\]]*)\]", line) - if product_name: - version['name'] = product_name.group(1) - - version_number = re.search("^m4_define\(\[.*_(.*)_version\], \[(\d+)\]", line) - - if version_number: - version_type = version_number.group(1) - version_value = int(version_number.group(2)) - - version[version_type] = version_value - - if version_type == 'micro': - group_of_digits = re.search("^\#\s*([0-9, ]+)\n$", previous_line) - if group_of_digits: - versions = [int(x) for x in group_of_digits.group(1).split(',')] - - if version_value in versions: - try: - version_index = versions.index(version_value)+1 - - if versions[version_index] == version['micro']: - # work around metacity giving "1" twice - version_index += 1 - - version['micro_next'] = versions[version_index] - except: - report_error("You gave a list of micro version numbers, but we've used them up!") - else: - report_error("You gave a list of micro version numbers, but the current one wasn't in it! Current is %s and your list is %s" % ( - `version_value`, `versions`)) - - previous_line = line - - if not 'micro_next' in version: - version['micro_next'] = version['micro']+1 - - version['string'] = '%(major)s.%(minor)s.%(micro)s' % (version) - version['filename'] = '%(name)s-%(string)s.tar.gz' % (version) - - return version - -def check_file_does_not_exist(version): - if os.access(version['filename'], os.F_OK): - report_error("Sorry, you already have a file called %s! Please delete it or move it first." % (version['filename'])) - -def is_date(str): - return len(str)>4 and str[4]=='-' - -def scan_changelog(version): - changelog = file("ChangeLog").readlines() - - # Find the most recent release. - - release_date = None - - for line in changelog: - if is_date(line): - release_date = line[:10] - - if "Post-release bump to" in line: - changelog = changelog[:changelog.index(line)+1] - break - - contributors = {} - thanks = '' - entries = [] - - def assumed_surname(name): - if name=='': return '' - # might get more complicated later, but for now... - return name.split()[-1] - - def assumed_forename(name): - if name=='': return '' - return name.split()[0] - - bug_re = re.compile('bug \#?(\d+)', re.IGNORECASE) - hash_re = re.compile('\#(\d+)') - - for line in changelog: - if is_date(line): - line = line[10:].lstrip() - line = line[:line.find('<')].rstrip() - contributors[assumed_surname(line)] = line - entries.append('(%s)' % (assumed_forename(line))) - else: - match = bug_re.search(line) - if not match: match = hash_re.search(line) - if match: - entries[-1] += ' (#%s)' % (match.group(1)) - - # FIXME: getting complex enough we should be returning a dictionary - return (contributors, changelog, entries, release_date) - -def wordwrap(str, prefix=''): - "Really simple wordwrap" - - # Ugly hack: - # We know that all open brackets are preceded by spaces. - # We don't want to split on these spaces. Therefore: - str = str.replace(' (','(') - - result = [''] - for word in str.split(): - - if result[-1]=='': - candidate = prefix + word - else: - candidate = '%s %s' % (result[-1], word) - - if len(candidate)>80: - result.append(prefix+word) - else: - result[-1] = candidate - - return '\n'.join(result).replace('(',' (') - -def favourite_editor(): - e = os.environ - if e.has_key('VISUAL'): return e['VISUAL'] - if e.has_key('EDITOR'): return e['EDITOR'] - if os.access('/usr/bin/nano', os.F_OK): - return '/usr/bin/nano' - report_error("I can't find an editor for you!") - -def edit_news_entry(version): - - # FIXME: still needs a lot of tidying up. Translator stuff especially needs to be - # factored out into a separate function. - - (contributors, changelog, entries, release_date) = scan_changelog(version) - - contributors_list = contributors.keys() - contributors_list.sort() - thanksline = ', '.join([contributors[x] for x in contributors_list]) - thanksline = thanksline.replace(contributors[contributors_list[-1]], 'and '+contributors[contributors_list[-1]]) - - thanks = '%s\n%s\n\n' % (version['string'], '='*len(version['string'])) - thanks += wordwrap('Thanks to %s for improvements in this version.' % (thanksline)) - thanks += '\n\n' - for line in entries: - thanks += ' - xxx %s\n' % (line) - - # and now pick up the translations. - - translations = {} - language_re = re.compile('\*\s*(.+)\.po') - - for line in file("po/ChangeLog").readlines(): - match = language_re.search(line) - if match: - translations[match.group(1)] = 1 - if is_date(line) and line[:10]