@@ -1725,9 +1725,9 @@ def pgdata_content(self, pgdata, ignore_ptrack=True, exclude_dirs=None):
17251725 file_relpath = os .path .relpath (file_fullpath , pgdata )
17261726 directory_dict ['files' ][file_relpath ] = {'is_datafile' : False }
17271727 with open (file_fullpath , 'rb' ) as f :
1728- content = f .read ()
17291728 # truncate cfm's content's zero tail
17301729 if file_relpath .endswith ('.cfm' ):
1730+ content = f .read ()
17311731 zero64 = b"\x00 " * 64
17321732 l = len (content )
17331733 while l > 64 :
@@ -1736,9 +1736,14 @@ def pgdata_content(self, pgdata, ignore_ptrack=True, exclude_dirs=None):
17361736 break
17371737 l = s
17381738 content = content [:l ]
1739- directory_dict ['files' ][file_relpath ]['md5' ] = hashlib .md5 (content ).hexdigest ()
1740- # directory_dict['files'][file_relpath]['md5'] = hashlib.md5(
1741- # f = open(file_fullpath, 'rb').read()).hexdigest()
1739+ digest = hashlib .md5 (content )
1740+ else :
1741+ digest = hashlib .md5 ()
1742+ while True :
1743+ b = f .read (64 * 1024 )
1744+ if not b : break
1745+ digest .update (b )
1746+ directory_dict ['files' ][file_relpath ]['md5' ] = digest .hexdigest ()
17421747
17431748 # crappy algorithm
17441749 if file .isdigit ():
@@ -1750,7 +1755,7 @@ def pgdata_content(self, pgdata, ignore_ptrack=True, exclude_dirs=None):
17501755 )
17511756
17521757 for root , dirs , files in os .walk (pgdata , topdown = False , followlinks = True ):
1753- for directory in dirs :
1758+ for directory in sorted ( dirs ) :
17541759 directory_path = os .path .join (root , directory )
17551760 directory_relpath = os .path .relpath (directory_path , pgdata )
17561761
0 commit comments