~ubuntu-branches/ubuntu/oneiric/python-distutils-extra/oneiric

« back to all changes in this revision

Viewing changes to debian/local/python-mkdebian

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-06-16 13:39:30 UTC
  • mfrom: (18.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110616133930-4sbgmwocxiw0i9c7
Tags: 2.28-1
* Urgency medium as this fixes a nasty regression from 2.27 which causes
  some packages to FTBFS.
* debian/local/python-mkdebian{,.1}: Change --force-control from a binary to
  a ternary option with modes "none" (don't touch it at all), "deps" (only
  update dependencies; old and new default behaviour), and "full" (always
  regenerate it). Update the manpage accordingly. Thanks to Jordan Mantha
  for the patch!
* test/auto.py: Add test for a local module which raises an exception
  (replicates the current xdiagnose FTBFS), and a local module which runs
  optparse on import (replicates the current onboard bzr head FTBFS).
* auto.py, __external_mod(): Put back the early decision for locally
  provided modules based on their name, without importing them. Running
  __import__ is dangerous in some cases like the above two, but
  unfortunately necessary to fully determine relative imports. This is still
  not quite perfect, as it will fail the same way if externally provided
  modules do dangerous things on mere imports, but at least fixes the
  regression from r248 (release 2.27). (See LP #746565)

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
 
78
78
    if not os.path.exists('debian/copyright') or force_copyright:
79
79
        make_copyright(egg)
80
 
 
81
 
    make_control(egg, force_control, additional_dependencies)
 
80
    if force_control not in ('none', 'deps', 'full'):
 
81
        print >> sys.stderr, 'ERROR: --force-control takes one of the following options:\n' \
 
82
            '"none", "deps", or "full"'
 
83
        sys.exit(0)
 
84
    if force_control != 'none':
 
85
        make_control(egg, force_control, additional_dependencies)
82
86
    make_changelog(egg, changelog, distribution, use_old_changelog)
83
87
 
84
88
def make_copyright(egg):
143
147
 ${python:Depends}%s''' % ',\n '.join(['',] + list(deps) + additional_dependencies)
144
148
    }
145
149
    # add additional fields (even when updating if user chooses them)
146
 
    if not os.path.exists('debian/control') or force_control:
 
150
    if not os.path.exists('debian/control') or force_control == 'full':
147
151
        control_content.update({
148
152
        'Source': egg['Name'],
149
153
        'Build-Depends': '''cdbs (>= 0.4.43),
310
314
#
311
315
usage = "usage: %prog [options]"
312
316
parser = OptionParser(prog='python_mkdebian', usage=usage, version=pkgversion)
313
 
parser.add_option('', '--force-control', dest='force_control', action='store_true',
314
 
                  help='Force whole control file to be recreated')
 
317
parser.add_option('', '--force-control', dest='force_control', action='store',
 
318
                  help='Force control file behaviour. Can be one of "none" (keep unchanged), "deps" (only update dependencies), or "full" (recreate whole file). By default only dependencies will be updated ("deps").')
315
319
parser.add_option('', '--force-copyright', dest='force_copyright', action='store_true',
316
320
                  help='Force the copyright file to be recreated')
317
321
parser.add_option('', '--force-rules', dest='force_rules', action='store_true',
326
330
                  help='Don\'t create a new changelog entry')
327
331
parser.add_option('', '--prefix', dest='prefix', action='store',
328
332
                  help='Ask to install into a dedicated prefix')
329
 
parser.set_defaults(changelog=None, dependencies=[], distribution=None, use_old_changelog=False, prefix=None)
 
333
parser.set_defaults(changelog=None, dependencies=[], force_control="deps", distribution=None, use_old_changelog=False, prefix=None)
330
334
options, args = parser.parse_args()
331
335
 
332
336
# switch stdout to line buffering, for scripts reading our output on the fly