[Git][reproducible-builds/diffoscope][master] Make --use-dbgsym a ternary operator to make it easier to totally disable....

Chris Lamb gitlab at salsa.debian.org
Tue Mar 26 23:06:28 CET 2019


Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
b2b61327 by Chris Lamb at 2019-03-26T22:04:17Z
Make --use-dbgsym a ternary operator to make it easier to totally disable. (re. reproducible-builds/diffoscope#2)

- - - - -


4 changed files:

- diffoscope/comparators/elf.py
- diffoscope/config.py
- diffoscope/main.py
- tests/comparators/test_elf.py


Changes:

=====================================
diffoscope/comparators/elf.py
=====================================
@@ -491,6 +491,9 @@ class ElfContainer(Container):
 
     @tool_required('objcopy')
     def _install_debug_symbols(self):
+        if Config().use_dbgsym == 'no':
+            return
+
         # Figure out if we are in a Debian package first
         try:
             deb = (
@@ -511,7 +514,7 @@ class ElfContainer(Container):
         # `Config().use_dbgsym`.
         if (
             not hasattr(deb.container.source, 'container')
-            and not Config().use_dbgsym
+            and Config().use_dbgsym != 'yes'
         ):
             return
 


=====================================
diffoscope/config.py
=====================================
@@ -63,7 +63,7 @@ class Config(object):
         self.exclude_directory_metadata = 'no'
         self.compute_visual_diffs = False
         self.max_container_depth = 50
-        self.use_dbgsym = False
+        self.use_dbgsym = 'auto'
         self.force_details = False
 
     def __setattr__(self, k, v):


=====================================
diffoscope/main.py
=====================================
@@ -371,10 +371,13 @@ def create_parser():
     )
     group3.add_argument(
         '--use-dbgsym',
-        action='store_true',
-        help='Automatically use corresponding -dbgsym packages'
-        'when comparing .deb files. (default: %(default)s)',
-        default=Config().use_dbgsym,
+        metavar='WHEN',
+        default='auto',
+        choices=('no', 'auto', 'yes'),
+        help='When to automatically use corresponding -dbgsym packages when '
+        'comparing .deb files. WHEN is one of {%(choices)s}. Default: auto, '
+        'meaning yes if two .changes or .buildinfo files are specified, '
+        'otherwise no.',
     )
     group3.add_argument(
         '--force-details',


=====================================
tests/comparators/test_elf.py
=====================================
@@ -169,7 +169,7 @@ def dbgsym_dir2():
 
 @pytest.fixture
 def dbgsym_differences(monkeypatch, dbgsym_dir1, dbgsym_dir2):
-    monkeypatch.setattr(Config(), 'use_dbgsym', True)
+    monkeypatch.setattr(Config(), 'use_dbgsym', 'yes')
     return dbgsym_dir1.compare(dbgsym_dir2)
 
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/b2b61327f648e0b2099cdd2850593dcde35648c9

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/b2b61327f648e0b2099cdd2850593dcde35648c9
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/20190326/f8e8a8eb/attachment.html>


More information about the rb-commits mailing list