328
331
if distribution is None:
329
332
distribution = "jaunty"
330
# FIXME: should pick this up from the environment in the same way
331
# as dch. (Should probably be in python-debian)
332
author = "bzr-builder <jamesw@ubuntu.com>"
333
# Use debian packaging environment variables
334
# or default values if they don't exist
335
author = "%s <%s>" % self._get_maintainer()
333
337
date = utils.formatdate(localtime=True)
334
338
cl.new_block(package=package, version=base_branch.deb_version,
335
339
distributions=distribution, urgency="low",
349
def _get_maintainer(self):
351
Create maintainer string using the same algorithm as in dch
354
regex = re.compile(r"^(.*)\s+<(.*)>$")
356
# Split email and name
357
if 'DEBEMAIL' in env:
358
match_obj = regex.match(env['DEBEMAIL'])
360
if not 'DEBFULLNAME' in env:
361
env['DEBFULLNAME'] = match_obj.group(1)
362
env['DEBEMAIL'] = match_obj.group(2)
363
if 'DEBEMAIL' not in env or 'DEBFULLNAME' not in env:
365
match_obj = regex.match(env('EMAIL'))
367
if not 'DEBFULLNAME' in env:
368
env['DEBFULLNAME'] = match_obj.group(1)
369
env['EMAIL'] = match_obj.group(2)
371
# Get maintainer's name
372
if 'DEBFULLNAME' in env:
373
maintainer = env['DEBFULLNAME']
375
maintainer = env['NAME']
377
# Use password database if no data in environment variables
379
maintainer = re.sub(r',.*', '', pwd.getpwuid(os.getuid()).pw_gecos)
380
except KeyError, AttributeError:
381
# TBD: Use last changelog entry value
382
maintainer = "bzr-builder"
384
# Get maintainer's mail address
385
if 'DEBEMAIL' in env:
386
email = env['DEBEMAIL']
391
if os.path.exists('/etc/mailname'):
392
f = open('/etc/mailname')
394
addr = f.readline().strip()
398
addr = socket.getfqdn()
400
user = pwd.getpwuid(os.getuid()).pw_name
404
addr = "%s@%s" % (user, addr)
409
# TBD: Use last changelog entry value
410
email = "none@example.org"
412
return (maintainer, email)
344
415
def _build_source_package(self, basedir):
345
416
trace.note("Building the source package")
346
417
command = ["/usr/bin/debuild", "--no-tgz-check", "-i", "-I", "-S",