~ubuntu-branches/ubuntu/utopic/devscripts/utopic

« back to all changes in this revision

Viewing changes to scripts/wrap-and-sort

  • Committer: Package Import Robot
  • Author(s): James McCoy, Benjamin Drung, Guillem Jover, Paul Wise, James McCoy, Christoph Berg, Ron Lee, David Prévot
  • Date: 2014-08-04 22:34:17 UTC
  • mfrom: (10.10.12 sid)
  • Revision ID: package-import@ubuntu.com-20140804223417-jzo8pb55dujbihud
Tags: 2.14.6
[ Benjamin Drung ]
* suspicious-source: Add image/tiff, application/pgp-keys, and image/x-icon
  to whitelisted mime-types. Add .gmo to whitelisted file extensions.
* wrap-and-sort: Add --max-line-length option with a default of 79 characters
  (it was previously hard-coded to 80 characters).  (Closes: #756067)

[ Guillem Jover ]
* nmudiff: Send control messages inline.  (Closes: #752152)

[ Paul Wise ]
* rmadison: bpo madison is dead, remove it
* rmadison: add new to the defaults for Debian
* rmadison: document the defaults in the manual page

[ James McCoy ]
* namecheck: Remove berlios, since it no longer hosts code.  (Closes:
  #752382)
* mk-build-deps:
  + Provide the package name, not file name, to “dpkg --remove” when package
    install fails.
  + Read all of the output from “apt-cache showsrc” to ensure mk-build-deps
    doesn't get stuck waiting for apt-cache to exit.
  + Pass the name of the .deb file out of build_equiv to ensure the correct
    .deb is installed.  (Closes: #753657)

[ Christoph Berg ]
* Update all qa.debian.org URLs to https://.

[ Ron Lee ]
* cowpoke:
  + Allow more flexibility for specialised build chroots.
    It's now possible to specify arbitrary 'dist' names, with arbitrary
    special configurations on top of the real BASE_DIST suite.  This means
    it's easy to have things like a chroot for wheezy-backports which will
    be able to pull other deps from the backports repo, while still having
    a pristine wheezy build chroot on the same build host.  Or to have a
    staging chroot for unstable, with extra build deps pulled in from a
    local repository, or installed manually, while still having a pristine
    sid chroot for building other packages to upload.  And it all works the
    same as normal, you just pass --dist=wheezy_bpo to select the chroot.
  + Allow SIGN_KEYID and UPLOAD_QUEUE to be overridden per arch/dist.
    This makes a lot more sense now that the above is easily possible.
    People can use that for private or work (in progress) builds too, and
    this can reduce the chance of accidentally uploading to the wrong place,
    or signing some package not intended for upload with a key that would
    would let it be accepted by dak.
  + Better handling of --debbuildopts.  There were some corner cases for
    this where the required quoting of options could be rather weird in the
    intersection of all the layers it might get passed through. This should
    make it more forgiving and better able to always DTRT.

[ David Prévot ]
* uscan.1: Use +dfsg suffix in examples

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
 
52
52
class WrapAndSortControl(Control):
 
53
    def __init__(self, filename, max_line_length):
 
54
        super().__init__(filename)
 
55
        self.max_line_length = max_line_length
 
56
 
53
57
    def wrap_and_sort(self, wrap_always, short_indent, sort_paragraphs,
54
58
                      keep_first, trailing_comma):
55
59
        for paragraph in self.paragraphs:
88
92
            packages = sort_list(packages)
89
93
 
90
94
        length = len(entry) + sum([2 + len(package) for package in packages])
91
 
        if wrap_always or length > 80:
 
95
        if wrap_always or length > self.max_line_length:
92
96
            indentation = " "
93
97
            if not short_indent:
94
98
                indentation *= len(entry) + 2
148
152
    for control_file in control_files:
149
153
        if options.verbose:
150
154
            print(control_file)
151
 
        control = WrapAndSortControl(control_file)
 
155
        control = WrapAndSortControl(control_file, options.max_line_length)
152
156
        if options.cleanup:
153
157
            control.strip_trailing_spaces()
154
158
        control.wrap_and_sort(options.wrap_always, options.short_indent,
188
192
    epilog = "See %s(1) for more info." % (script_name)
189
193
    parser = optparse.OptionParser(usage=usage, epilog=epilog)
190
194
 
191
 
    parser.add_option("-a", "--wrap-always", dest="wrap_always",
192
 
                      help="wrap lists even if they fit into one 80 character "
193
 
                           "long line", action="store_true", default=False)
 
195
    parser.add_option("-a", "--wrap-always", action="store_true", default=False,
 
196
                      help="wrap lists even if they do not exceed the line length limit")
194
197
    parser.add_option("-s", "--short-indent", dest="short_indent",
195
198
                      help="only indent wrapped lines by one space (default is "
196
199
                           "in-line with the field name)",
219
222
    parser.add_option("-v", "--verbose",
220
223
                      help="print all files that are touched",
221
224
                      dest="verbose", action="store_true", default=False)
 
225
    parser.add_option("--max-line-length", type='int', default=79,
 
226
                      help="set maximum allowed line length before wrapping (default: %default)")
222
227
 
223
228
    (options, args) = parser.parse_args()
224
229