[Git][reproducible-builds/diffoscope][master] 3 commits: Ignore "--debug" and similar arguments when creating a hopefully-useful temporary directory suffix.

Chris Lamb gitlab at salsa.debian.org
Wed Mar 3 12:27:21 UTC 2021



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
fc310cf7 by Chris Lamb at 2021-03-03T12:16:01+00:00
Ignore "--debug" and similar arguments when creating a hopefully-useful temporary directory suffix.

- - - - -
fa168733 by Chris Lamb at 2021-03-03T12:21:32+00:00
Reduce "Unable to stat file" warnings to debug messages as these are sometimes by design.

- - - - -
25634e37 by Chris Lamb at 2021-03-03T12:21:32+00:00
Don't emit a "Returning a FooContainer" - we already emit "Instantiating a FooContainer" log message.

- - - - -


3 changed files:

- diffoscope/comparators/directory.py
- diffoscope/comparators/utils/file.py
- diffoscope/tempfiles.py


Changes:

=====================================
diffoscope/comparators/directory.py
=====================================
@@ -175,9 +175,7 @@ def compare_meta(path1, path2):
         stat1 = os.lstat(path1)
         stat2 = os.lstat(path2)
     except Exception as e:
-        logger.warning(
-            f'Unable to stat file "{path1}" or "{path2}" ({str(e)})'
-        )
+        logger.debug(f'Unable to stat file "{path1}" or "{path2}" ({str(e)})')
         return []
 
     differences = []


=====================================
diffoscope/comparators/utils/file.py
=====================================
@@ -284,11 +284,6 @@ class File(metaclass=abc.ABCMeta):
             try:
                 self._as_container = klass(self)
 
-                logger.debug(
-                    "Returning a %s for %s",
-                    formatted_class,
-                    self.name,
-                )
                 return self._as_container
             except RequiredToolNotFound as exc:
                 logger.debug(


=====================================
diffoscope/tempfiles.py
=====================================
@@ -105,11 +105,13 @@ def _get_base_temporary_directory():
     if _BASEDIR is None or not os.path.exists(_BASEDIR.name):
         try:
             # Try and generate a potentially-useful suffix to our temporary directory
+            filtered_argv = [x for x in sys.argv if not x.startswith("-")]
+
             suffix = "_{}".format(
                 re.sub(
                     r"[^\w]",
                     "",
-                    os.path.basename(os.path.dirname(sys.argv[-1])),
+                    os.path.basename(os.path.dirname(filtered_argv[-1])),
                 )[-10:]
             )
         except IndexError:



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/50fe6655f1e1005501a59776600cb78fdf42e1e8...25634e379b4c7021f09777003a50a640af74efc7

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/50fe6655f1e1005501a59776600cb78fdf42e1e8...25634e379b4c7021f09777003a50a640af74efc7
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/20210303/9ff863c2/attachment.htm>


More information about the rb-commits mailing list