[diffoscope] 02/05: comparators: utils: container: added get_path_name method

Juliana Oliveira R jwnx-guest at moszumanska.debian.org
Sat Sep 16 17:43:11 CEST 2017

This is an automated email from the git hooks/post-receive script.

jwnx-guest pushed a commit to branch jwnx_fix_different_container_type_comparison
in repository diffoscope.

commit 24bc3210eba5193b6a6cf9efe92c53da89ccc769
Author: Juliana Oliveira Rodrigues <juliana.orod at gmail.com>
Date:   Sat Sep 16 12:20:50 2017 -0300

    comparators: utils: container: added get_path_name method
    The destination path for container extraction was generated by joining
    directory's name and filenames recursively. When those names are too long
    or recursion depth is too high, destination path may exceed OS's max
    filename length.
    This patch adds a new method for Container class called get_path_name,
    which returns a joint between destination directory and an uuid hash.
    It sets filename length to 36 characters.
 diffoscope/comparators/utils/container.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/diffoscope/comparators/utils/container.py b/diffoscope/comparators/utils/container.py
index 5627f5b..c076813 100644
--- a/diffoscope/comparators/utils/container.py
+++ b/diffoscope/comparators/utils/container.py
@@ -18,6 +18,8 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 import abc
+import uuid
+import os.path
 import logging
 import itertools
 from collections import OrderedDict
@@ -66,6 +68,9 @@ class Container(object, metaclass=abc.ABCMeta):
     def get_member(self, member_name):
         raise NotImplementedError()
+    def get_path_name(self, dest_dir):
+      return os.path.join(dest_dir, str(uuid.uuid4()))
     def get_filtered_members(self):
         # If your get_member implementation is O(n) then this will be O(n^2)
         # cost. In such cases it is HIGHLY RECOMMENDED to override this as well

Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git

More information about the diffoscope mailing list