summaryrefslogtreecommitdiffstats
path: root/debian/scripts/joinctrl.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:07:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:07:31 +0000
commitedaebb65d92a48d7075c8c1f64c5ffd87054827b (patch)
tree045c941e1851cde1665bea22d97a2976b7a5bb69 /debian/scripts/joinctrl.py
parentAdding upstream version 4:7.4.7. (diff)
downloadlibreoffice-edaebb65d92a48d7075c8c1f64c5ffd87054827b.tar.xz
libreoffice-edaebb65d92a48d7075c8c1f64c5ffd87054827b.zip
Adding debian version 4:7.4.7-1+deb12u1.debian/4%7.4.7-1+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/scripts/joinctrl.py')
-rwxr-xr-xdebian/scripts/joinctrl.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/debian/scripts/joinctrl.py b/debian/scripts/joinctrl.py
new file mode 100755
index 000000000..ce12f09b9
--- /dev/null
+++ b/debian/scripts/joinctrl.py
@@ -0,0 +1,66 @@
+#! /usr/bin/python3
+
+import re, sys, fileinput
+
+def splitlines():
+ fields = ('Build-Depends', 'Build-Conflicts', 'Build-Depends-Indep', 'Build-Depends-Arch',
+ 'Depends', 'Replaces', 'Provides', 'Conflicts', 'Recommends', 'Suggests', 'Breaks')
+ for line in fileinput.input():
+ line = line[:-1]
+ field = None
+ for f in fields:
+ if line.startswith(f+':'):
+ field = f
+ break
+ if not field:
+ print(line)
+ continue
+ values = [f.strip() for f in line.split(':',1)[1].strip().split(',')]
+ if len(values) > 2:
+ print('%s: %s' % (field, ',\n '.join(values)))
+ else:
+ print('%s: %s' % (field, ', '.join(values)))
+
+def sort_list(unsorted_list):
+ packages = [x for x in unsorted_list if re.match("[a-z0-9]", x)]
+ special = [x for x in unsorted_list if not re.match("[a-z0-9]", x)]
+ return sorted(packages) + sorted(special)
+
+def joinlines():
+ fields = ('Build-Depends', 'Build-Conflicts', 'Build-Depends-Indep', 'Build-Depends-Arch',
+ 'Depends', 'Replaces', 'Provides', 'Conflicts', 'Recommends', 'Suggests', 'Breaks')
+ buffer = None
+ for line in fileinput.input():
+ line = line[:-1]
+ if buffer:
+ if line.startswith(' '):
+ buffer = buffer + ' ' + line.strip()
+ continue
+ else:
+ packages = sort_list(set([x.strip() for x in buffer[len(field)+1:].split(",")]))
+ if "" in packages:
+ packages.remove("")
+ length = len(field) + sum([2 + len(package) for package in packages])
+ if length > 80:
+ indentation = " " * (len(field) + 2)
+ packages_with_indention = [indentation + x for x in packages]
+ packages_with_indention = ",\n".join(packages_with_indention)
+ print(field + ": " + packages_with_indention.strip())
+ else:
+ print(field + ": " + ", ".join(packages).strip())
+ buffer = None
+ field = None
+ for f in fields:
+ if line.startswith(f+':'):
+ field = f
+ break
+ if field:
+ buffer = line.strip()
+ continue
+ print(line)
+
+def main():
+ #splitlines()
+ joinlines()
+
+main()