mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Add --sort-binary-packages and --keep-first (LP: #681119)
This commit is contained in:
parent
15e5ef9a82
commit
282aa33614
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -10,7 +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)
|
- Add --sort-binary-packages and --keep-first (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.
|
||||||
@ -20,7 +20,7 @@ ubuntu-dev-tools (0.107) UNRELEASED; urgency=low
|
|||||||
* syncpackage: Fix error message for failed downloads.
|
* syncpackage: Fix error message for failed downloads.
|
||||||
* sponsor-patch: Support building with sbuild (LP: #681242).
|
* sponsor-patch: Support building with sbuild (LP: #681242).
|
||||||
|
|
||||||
-- Benjamin Drung <bdrung@ubuntu.com> Fri, 26 Nov 2010 19:32:48 +0100
|
-- Stefano Rivera <stefanor@ubuntu.com> Sat, 27 Nov 2010 09:22:03 +0200
|
||||||
|
|
||||||
ubuntu-dev-tools (0.106) experimental; urgency=low
|
ubuntu-dev-tools (0.106) experimental; urgency=low
|
||||||
|
|
||||||
|
@ -47,6 +47,12 @@ field name)
|
|||||||
\fB\-b\fR, \fB\-\-sort\-binary\-packages\fR
|
\fB\-b\fR, \fB\-\-sort\-binary\-packages\fR
|
||||||
sort binary package paragraphs by name
|
sort binary package paragraphs by name
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-k\fR, \fB\-\-keep\-first\fR
|
||||||
|
When sorting binary package paragraphs, leave the first one at the top.
|
||||||
|
Unqualified
|
||||||
|
.BR debhelper (7)
|
||||||
|
configuration files are applied to the first package.
|
||||||
|
.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,8 @@ 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, sort_paragraphs):
|
def wrap_and_sort(self, wrap_always, short_indent, sort_paragraphs,
|
||||||
|
keep_first):
|
||||||
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:
|
||||||
@ -70,9 +71,10 @@ class Control(object):
|
|||||||
paragraph["Architecture"] = " ".join(archs)
|
paragraph["Architecture"] = " ".join(archs)
|
||||||
|
|
||||||
if sort_paragraphs:
|
if sort_paragraphs:
|
||||||
# Sort with Source package first, by binary Package Name
|
first = self.paragraphs[:1 + int(keep_first)]
|
||||||
key = lambda x: "" if "Source" in x else x["Package"]
|
sortable = self.paragraphs[1 + int(keep_first):]
|
||||||
self.paragraphs = sorted(self.paragraphs, key=key)
|
key = lambda x: x.get("Package")
|
||||||
|
self.paragraphs = first + sorted(sortable, 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(","))
|
||||||
@ -144,7 +146,7 @@ def main(options):
|
|||||||
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)
|
options.sort_binary_packages, options.keep_first)
|
||||||
control.save()
|
control.save()
|
||||||
|
|
||||||
copyright_files = filter(os.path.isfile,
|
copyright_files = filter(os.path.isfile,
|
||||||
@ -181,6 +183,12 @@ if __name__ == "__main__":
|
|||||||
help="Sort binary package paragraphs by name",
|
help="Sort binary package paragraphs by name",
|
||||||
dest="sort_binary_packages", action="store_true",
|
dest="sort_binary_packages", action="store_true",
|
||||||
default=False)
|
default=False)
|
||||||
|
parser.add_option("-k", "--keep-first",
|
||||||
|
help="When sorting binary package paragraphs, leave the "
|
||||||
|
"first one at the top. Unqualified debhelper "
|
||||||
|
"configuration files are applied to the first "
|
||||||
|
"package.",
|
||||||
|
dest="keep_first", 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