diff options
| author | Soren Hansen <soren.hansen@rackspace.com> | 2010-11-11 19:52:36 -0600 |
|---|---|---|
| committer | Soren Hansen <soren.hansen@rackspace.com> | 2010-11-11 19:52:36 -0600 |
| commit | 3b695e11da34247123ea919e71096e53393f227b (patch) | |
| tree | 2b65c9b46dde23351df58eb08fe78eef38da0e7d | |
| parent | 671b712a5ad9034fa89761018203cc7c1ea0449b (diff) | |
Added a .mailmap that maps addresses in bzr to people's real, preferred
e-mail addresses. (I made a few guesses along the way, feel free to
adjust according to what is actually the preferred e-mail)
Added a couple of methods to nova.utils to parse said .mailmap and do
the appropriate (though highly naïve) replacement.
Apply mailmap replacement in changelog generation in setup.py.
Add a unit test that checks everyone is properly listed in Authors.
Add sleepsonthefloor to Authors. If anyone knows the real name, please
add it.
| -rw-r--r-- | .mailmap | 24 | ||||
| -rw-r--r-- | Authors | 1 | ||||
| -rw-r--r-- | nova/tests/misc_unittest.py | 48 | ||||
| -rw-r--r-- | nova/utils.py | 16 | ||||
| -rw-r--r-- | run_tests.py | 5 | ||||
| -rw-r--r-- | setup.py | 10 |
6 files changed, 98 insertions, 6 deletions
diff --git a/.mailmap b/.mailmap new file mode 100644 index 000000000..cf79dc95c --- /dev/null +++ b/.mailmap @@ -0,0 +1,24 @@ +# Format is: +# <preferred e-mail> <other e-mail> +<code@term.ie> <github@anarkystic.com> +<code@term.ie> <termie@preciousroy.local> +<matt.dietz@rackspace.com> <matthewdietz@Matthew-Dietzs-MacBook-Pro.local> +<matt.dietz@rackspace.com> <mdietz@openstack> +<cbehrens@codestud.com> <chris.behrens@rackspace.com> +<devin.carlen@gmail.com> <devcamcar@illian.local> +<ewan.mellor@citrix.com> <emellor@silver> +<jaypipes@gmail.com> <jpipes@serialcoder> +<anotherjesse@gmail.com> <jesse@dancelamb> +<anotherjesse@gmail.com> <jesse@gigantor.local> +<anotherjesse@gmail.com> <jesse@ubuntu> +<jmckenty@gmail.com> <jmckenty@yyj-dhcp171.corp.flock.com> +<jmckenty@gmail.com> <jmckenty@joshua-mckentys-macbook-pro.local> +<jmckenty@gmail.com> <joshua.mckenty@nasa.gov> +<justin@fathomdb.com> <justinsb@justinsb-desktop> +<mordred@inaugust.com> <mordred@hudson> +<paul@openstack.org> <pvoccio@castor.local> +<paul@openstack.org> <paul.voccio@rackspace.com> +<todd@ansolabs.com> <todd@lapex> +<todd@ansolabs.com> <todd@rubidine.com> +<vishvananda@gmail.com> <vishvananda@yahoo.com> +<vishvananda@gmail.com> <root@mirror.nasanebula.net> @@ -19,3 +19,4 @@ Rick Clark <rick@openstack.org> Soren Hansen <soren.hansen@rackspace.com> Todd Willey <todd@ansolabs.com> Vishvananda Ishaya <vishvananda@gmail.com> +¿¿¿??? <sleepsonthefloor@gmail.com> diff --git a/nova/tests/misc_unittest.py b/nova/tests/misc_unittest.py new file mode 100644 index 000000000..856060afa --- /dev/null +++ b/nova/tests/misc_unittest.py @@ -0,0 +1,48 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2010 OpenStack LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os +import subprocess + +from nova import test +from nova.utils import parse_mailmap, str_dict_replace + + +class ProjectTestCase(test.TrialTestCase): + def test_authors_up_to_date(self): + if os.path.exists('../.bzr'): + log_cmd = subprocess.Popen(["bzr", "log", "-n0"], + stdout=subprocess.PIPE) + changelog = log_cmd.communicate()[0] + mailmap = parse_mailmap('../.mailmap') + + contributors = set() + for l in changelog.split('\n'): + l = l.strip() + if (l.startswith('author:') or l.startswith('committer:') + and not l == 'committer: Tarmac'): + email = l.split(' ')[-1] + contributors.add(str_dict_replace(email, mailmap)) + + authors_file = open('../Authors', 'r').read() + + missing = set() + for contributor in contributors: + if not contributor in authors_file: + missing.add(contributor) + + self.assertTrue(len(missing) == 0, + '%r not listed in Authors' % missing) diff --git a/nova/utils.py b/nova/utils.py index e7892a212..b63237c10 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -173,6 +173,22 @@ def isotime(at=None): def parse_isotime(timestr): return datetime.datetime.strptime(timestr, TIME_FORMAT) +def parse_mailmap(mailmap='.mailmap'): + mapping = {} + if os.path.exists(mailmap): + fp = open(mailmap, 'r') + for l in fp: + l = l.strip() + if not l.startswith('#') and ' ' in l: + canonical_email, alias = l.split(' ') + mapping[alias] = canonical_email + return mapping + +def str_dict_replace(s, mapping): + for s1, s2 in mapping.iteritems(): + s = s.replace(s1, s2) + return s + class LazyPluggable(object): """A pluggable backend loaded lazily based on some value.""" diff --git a/run_tests.py b/run_tests.py index 9a2f40dc9..3d427d8af 100644 --- a/run_tests.py +++ b/run_tests.py @@ -49,11 +49,12 @@ from nova import flags from nova import twistd from nova.tests.access_unittest import * -from nova.tests.auth_unittest import * from nova.tests.api_unittest import * +from nova.tests.auth_unittest import * from nova.tests.cloud_unittest import * from nova.tests.compute_unittest import * from nova.tests.flags_unittest import * +from nova.tests.misc_unittest import * from nova.tests.network_unittest import * from nova.tests.objectstore_unittest import * from nova.tests.process_unittest import * @@ -64,8 +65,8 @@ from nova.tests.service_unittest import * from nova.tests.twistd_unittest import * from nova.tests.validator_unittest import * from nova.tests.virt_unittest import * -from nova.tests.volume_unittest import * from nova.tests.virt_unittest import * +from nova.tests.volume_unittest import * FLAGS = flags.FLAGS @@ -16,12 +16,13 @@ # License for the specific language governing permissions and limitations # under the License. -from setuptools import setup, find_packages -from setuptools.command.sdist import sdist - import os import subprocess +from setuptools import setup, find_packages +from setuptools.command.sdist import sdist + +from nova.util import parse_mailmap, str_dict_replace class local_sdist(sdist): """Customized sdist hook - builds the ChangeLog file from VC first""" @@ -34,8 +35,9 @@ class local_sdist(sdist): log_cmd = subprocess.Popen(["bzr", "log", "--novalog"], stdout=subprocess.PIPE, env=env) changelog = log_cmd.communicate()[0] + mailmap = parse_mailmap() with open("ChangeLog", "w") as changelog_file: - changelog_file.write(changelog) + changelog_file.write(str_dict_replace(changelog, mailmap)) sdist.run(self) setup(name='nova', |
