mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-16 09:31:08 +00:00
Add --sort-binary-packages (LP: #681119)
This commit is contained in:
parent
2fc7208333
commit
76f7079cb1
3
debian/changelog
vendored
3
debian/changelog
vendored
@ -10,6 +10,7 @@ ubuntu-dev-tools (0.107) UNRELEASED; urgency=low
|
|||||||
- Remove null-entry from trailing comma in sorted lists
|
- Remove null-entry from trailing comma in sorted lists
|
||||||
- Add configurable debian directory location
|
- Add configurable debian directory location
|
||||||
- Sort Architecture (LP: #681131)
|
- Sort Architecture (LP: #681131)
|
||||||
|
- Add --sort-binary-packages (LP: #681119)
|
||||||
* dgetlp, grab-merge, pull-lp-source, syncpackage: Export DEB_VENDOR=Ubuntu
|
* dgetlp, grab-merge, pull-lp-source, syncpackage: Export DEB_VENDOR=Ubuntu
|
||||||
when unpacking source packages. 3.0 (quilt) has optional per-vendor patch
|
when unpacking source packages. 3.0 (quilt) has optional per-vendor patch
|
||||||
series.
|
series.
|
||||||
@ -18,7 +19,7 @@ ubuntu-dev-tools (0.107) UNRELEASED; urgency=low
|
|||||||
* wrap-and-sort: Remove duplicate items from sorted lists.
|
* wrap-and-sort: Remove duplicate items from sorted lists.
|
||||||
* syncpackage: Fix error message for failed downloads.
|
* syncpackage: Fix error message for failed downloads.
|
||||||
|
|
||||||
-- Stefano Rivera <stefanor@ubuntu.com> Fri, 26 Nov 2010 18:01:54 +0200
|
-- Stefano Rivera <stefanor@ubuntu.com> Fri, 26 Nov 2010 18:38:05 +0200
|
||||||
|
|
||||||
ubuntu-dev-tools (0.106) experimental; urgency=low
|
ubuntu-dev-tools (0.106) experimental; urgency=low
|
||||||
|
|
||||||
|
@ -44,6 +44,9 @@ line
|
|||||||
only indent wrapped lines by one space (default is in\-line with the
|
only indent wrapped lines by one space (default is in\-line with the
|
||||||
field name)
|
field name)
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-b\fR, \fB\-\-sort\-binary\-packages\fR
|
||||||
|
sort binary package paragraphs by name
|
||||||
|
.TP
|
||||||
\fB\-n\fR, \fB\-\-no\-cleanup\fR
|
\fB\-n\fR, \fB\-\-no\-cleanup\fR
|
||||||
do not remove trailing whitespaces
|
do not remove trailing whitespaces
|
||||||
.TP
|
.TP
|
||||||
|
@ -54,7 +54,7 @@ class Control(object):
|
|||||||
f.write(content.encode("utf-8"))
|
f.write(content.encode("utf-8"))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def wrap_and_sort(self, wrap_always, short_indent):
|
def wrap_and_sort(self, wrap_always, short_indent, sort_paragraphs):
|
||||||
for paragraph in self.paragraphs:
|
for paragraph in self.paragraphs:
|
||||||
for field in CONTROL_LIST_FIELDS:
|
for field in CONTROL_LIST_FIELDS:
|
||||||
if field in paragraph:
|
if field in paragraph:
|
||||||
@ -69,6 +69,11 @@ class Control(object):
|
|||||||
archs = sorted(archs, key=lambda x: (1 - int("any" in x), x))
|
archs = sorted(archs, key=lambda x: (1 - int("any" in x), x))
|
||||||
paragraph["Architecture"] = " ".join(archs)
|
paragraph["Architecture"] = " ".join(archs)
|
||||||
|
|
||||||
|
if sort_paragraphs:
|
||||||
|
# Sort with Source package first, by binary Package Name
|
||||||
|
key = lambda x: "" if "Source" in x else x["Package"]
|
||||||
|
self.paragraphs = sorted(self.paragraphs, key=key)
|
||||||
|
|
||||||
def _wrap_field(self, control, entry, wrap_always, short_indent, sort=True):
|
def _wrap_field(self, control, entry, wrap_always, short_indent, sort=True):
|
||||||
packages = map(lambda x: x.strip(), control[entry].split(","))
|
packages = map(lambda x: x.strip(), control[entry].split(","))
|
||||||
if sort:
|
if sort:
|
||||||
@ -138,7 +143,8 @@ def main(options):
|
|||||||
if options.verbose:
|
if options.verbose:
|
||||||
print control_file
|
print control_file
|
||||||
control = Control(control_file, options.cleanup)
|
control = Control(control_file, options.cleanup)
|
||||||
control.wrap_and_sort(options.wrap_always, options.short_indent)
|
control.wrap_and_sort(options.wrap_always, options.short_indent,
|
||||||
|
options.sort_binary_packages)
|
||||||
control.save()
|
control.save()
|
||||||
|
|
||||||
copyright_files = filter(os.path.isfile,
|
copyright_files = filter(os.path.isfile,
|
||||||
@ -171,6 +177,10 @@ if __name__ == "__main__":
|
|||||||
help="only indent wrapped lines by one space (default is "
|
help="only indent wrapped lines by one space (default is "
|
||||||
"in-line with the field name)",
|
"in-line with the field name)",
|
||||||
action="store_true", default=False)
|
action="store_true", default=False)
|
||||||
|
parser.add_option("-b", "--sort-binary-packages",
|
||||||
|
help="Sort binary package paragraphs by name",
|
||||||
|
dest="sort_binary_packages", action="store_true",
|
||||||
|
default=False)
|
||||||
parser.add_option("-n", "--no-cleanup", help="don't cleanup whitespaces",
|
parser.add_option("-n", "--no-cleanup", help="don't cleanup whitespaces",
|
||||||
dest="cleanup", action="store_false", default=True)
|
dest="cleanup", action="store_false", default=True)
|
||||||
parser.add_option("-d", "--debian-directory", dest="debian_directory",
|
parser.add_option("-d", "--debian-directory", dest="debian_directory",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user