summaryrefslogtreecommitdiff
path: root/scripts/unreleased-projects
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/unreleased-projects')
-rwxr-xr-xscripts/unreleased-projects98
1 files changed, 0 insertions, 98 deletions
diff --git a/scripts/unreleased-projects b/scripts/unreleased-projects
deleted file mode 100755
index 7639780..0000000
--- a/scripts/unreleased-projects
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/python
-# Copyright 2011 Lars Wirzenius
-#
-# 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 3 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 <http://www.gnu.org/licenses/>.
-
-
-import cliapp
-import logging
-import os
-import re
-
-
-class UnreleasedProjects(cliapp.Application):
-
- conf_file = os.path.expanduser('~/.sd-publish-all.conf')
-
- def add_settings(self):
- self.settings.boolean(['verbose'], 'be verbose')
-
- def process_args(self, args):
- for project_dir in self.project_dirs():
- logging.debug('examining project dir %s' % project_dir)
- project_name = os.path.basename(os.path.dirname(project_dir))
- logging.debug('project name is %s' % project_name)
- if self.is_released(project_name, project_dir):
- if self.settings['verbose']:
- self.output.write('released: %s\n' % project_dir)
- else:
- self.output.write('UNRELEASED: %s\n' % project_dir)
-
- def is_released(self, project_name, project_dir):
- logging.debug('is_released: project_name=%s project_dir=%s' %
- (project_name, project_dir))
-
- revno = self.bzr_revno(project_dir)
- logging.debug('revno = %s' % repr(revno))
- if revno is None:
- logging.debug('no revno, so not released')
- return False
-
- tags = self.bzr_tags(project_dir)
- logging.debug('found tags: %s' % repr(tags))
-
- pat = r'^%s-\d+(\.\d+)*(_debian-[0-9.-]+)?$' % project_name
- logging.debug('tag pattern = %s' % repr(pat))
-
- for tag_revno, tag in tags:
- logging.debug('tag_revno=%s' % repr(tag_revno))
- logging.debug('tag=%s' % repr(tag))
- if re.match(pat, tag):
- release_tag_is_current = tag_revno == [revno]
- logging.debug('return: %s' % release_tag_is_current)
- return release_tag_is_current
- logging.debug('returning default result of False')
- return False
-
- def bzr_revno(self, project_dir):
- return int(self.runcmd(['bzr', 'revno'], cwd=project_dir).strip())
-
- def bzr_tags(self, project_dir):
- out = self.runcmd(['bzr', 'tags'], cwd=project_dir)
- pairs = [line.split() for line in out.splitlines()]
- pairs2 = [(self.revno_key(revno), tag) for tag, revno in pairs]
- return list(reversed(sorted(pairs2)))
-
- def revno_key(self, revno_string):
- return [int(x) for x in revno_string.split('.')]
-
- def project_dirs(self):
- homedir = os.path.expanduser('~')
- return [os.path.join(homedir, os.path.dirname(x), 'trunk')
- for x in self.bug_dirs()]
-
- def bug_dirs(self):
- return [line.split()[0]
- for line in self.cat(self.conf_file).splitlines()
- if line.strip()]
-
- def cat(self, filename):
- with open(filename) as f:
- return f.read()
-
-
-
-
-if __name__ == '__main__':
- UnreleasedProjects().run()