[Git][reproducible-builds/diffoscope][master] 4 commits: Ensure we only parse the recommended packages from --list-debian-substvars...
Chris Lamb
gitlab at salsa.debian.org
Fri Mar 6 22:17:00 UTC 2020
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
b838101b by Chris Lamb at 2020-03-06T13:56:12-08:00
Ensure we only parse the recommended packages from --list-debian-substvars when we want them for debian/tests/control generation.
- - - - -
6ad1d918 by Chris Lamb at 2020-03-06T14:15:59-08:00
Factor out generation of comparator descriptions.
- - - - -
982d3a41 by Chris Lamb at 2020-03-06T14:16:27-08:00
Remove any duplicate comparator descriptions when formatting.
- - - - -
35c522d5 by Chris Lamb at 2020-03-06T14:16:28-08:00
Inject the supported file formats into the package long description. (Closes: reproducible-builds/diffoscope#90)
- - - - -
4 changed files:
- debian/control
- debian/rules
- diffoscope/comparators/__init__.py
- diffoscope/main.py
Changes:
=====================================
debian/control
=====================================
@@ -112,4 +112,6 @@ Description: in-depth comparison of files, archives, and directories
compare two tarballs, ISO images, or PDF just as easily. The differences can
be shown in a text or HTML report.
.
+ ${diffoscope:Description}
+ .
diffoscope is developed as part of the “reproducible builds” project.
=====================================
debian/rules
=====================================
@@ -69,7 +69,7 @@ override_dh_auto_clean:
@echo "# EDIT debian/tests/control.in INSTEAD!" >> debian/tests/control.tmp
@echo "#" >> debian/tests/control.tmp
@cat debian/tests/control.in >> debian/tests/control.tmp
- @sed -i "s#%RECOMMENDS%#$(shell bin/diffoscope --list-debian-substvars | cut -d= -f2)#" debian/tests/control.tmp
+ @sed -i "s#%RECOMMENDS%#$(shell bin/diffoscope --list-debian-substvars | awk -F= '/diffoscope:Recommends/ { print $$2 }')#" debian/tests/control.tmp
@sed -i "s#%PYRECOMMENDS%#$(shell python3 -c "import distutils.core; \
setup = distutils.core.run_setup('setup.py'); \
print(', '.join(sorted(['python3-{}'.format(x) for y in setup.extras_require.values() for x in y])))" \
=====================================
diffoscope/comparators/__init__.py
=====================================
@@ -152,9 +152,14 @@ class ComparatorManager:
logger.debug("Loaded %d comparator classes", len(self.classes))
- def get_descriptions(self):
- for x in self.classes:
- try:
- yield x.DESCRIPTION
- except AttributeError:
- pass
+ def format_descriptions(self):
+ def gen_descriptions():
+ for x in self.classes:
+ try:
+ yield x.DESCRIPTION
+ except AttributeError:
+ pass
+
+ xs = list(sorted(set(gen_descriptions())))
+
+ return '{} and {}.\n'.format(', '.join(xs[:-1]), xs[-1])
=====================================
diffoscope/main.py
=====================================
@@ -474,12 +474,9 @@ class HelpFormatter(argparse.HelpFormatter):
title, textwrap.indent(wrapped, ' ' * indent)
)
- descriptions = list(sorted(ComparatorManager().get_descriptions()))
append(
'file formats supported',
- '{} and {}.\n'.format(
- ', '.join(descriptions[:-1]), descriptions[-1]
- ),
+ ComparatorManager().format_descriptions(),
)
append('diffoscope homepage', '<https://diffoscope.org/>')
@@ -581,6 +578,13 @@ class ListDebianSubstvarsAction(argparse._StoreTrueAction):
for x in ('gzip', 'tar', 'coreutils', 'diffutils', 'findutils'):
packages.discard(x)
+ description = 'File formats supported include: {}'.format(
+ ComparatorManager().format_descriptions(),
+ )
+ wrapped = '${Newline}'.join(textwrap.wrap(description, 79))
+ wrapped = wrapped.replace('${Newline}.', '${Newline}')
+ print('diffoscope:Description={}'.format(wrapped))
+
print('diffoscope:Recommends={}'.format(', '.join(sorted(packages))))
sys.exit(0)
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/abd1363563f1e04a136f59302a16d2634dad7dce...35c522d5a923aa206d07b70409e47fa85d163b06
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/abd1363563f1e04a136f59302a16d2634dad7dce...35c522d5a923aa206d07b70409e47fa85d163b06
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20200306/01b5d33d/attachment.htm>
More information about the rb-commits
mailing list