| 
					
				 | 
			
			
				@@ -3,14 +3,14 @@ from .remote import cache_if_remote 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from collections import namedtuple 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import os 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import stat 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-from binascii import hexlify, unhexlify 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+from binascii import unhexlify 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import shutil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from .key import PlaintextKey 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from .logger import create_logger 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 logger = create_logger() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from .helpers import Error, get_cache_dir, decode_dict, int_to_bigint, \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    bigint_to_int, format_file_size, yes 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    bigint_to_int, bin_to_hex, format_file_size, yes 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from .locking import UpgradableLock 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from .hashindex import ChunkIndex, ChunkIndexEntry 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -37,13 +37,13 @@ class Cache: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @staticmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def break_lock(repository, path=None): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        path = path or os.path.join(get_cache_dir(), hexlify(repository.id).decode('ascii')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        path = path or os.path.join(get_cache_dir(), repository.id_str) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         UpgradableLock(os.path.join(path, 'lock'), exclusive=True).break_lock() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @staticmethod 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def destroy(repository, path=None): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         """destroy the cache for ``repository`` or at ``path``""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        path = path or os.path.join(get_cache_dir(), hexlify(repository.id).decode('ascii')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        path = path or os.path.join(get_cache_dir(), repository.id_str) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         config = os.path.join(path, 'config') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if os.path.exists(config): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             os.remove(config)  # kill config first 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -64,7 +64,7 @@ class Cache: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.repository = repository 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.key = key 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.manifest = manifest 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        self.path = path or os.path.join(get_cache_dir(), hexlify(repository.id).decode('ascii')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        self.path = path or os.path.join(get_cache_dir(), repository.id_str) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.do_files = do_files 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         # Warn user before sending data to a never seen before unencrypted repository 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if not os.path.exists(self.path): 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -134,7 +134,7 @@ Chunk index:    {0.total_unique_chunks:20d} {0.total_chunks:20d}""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         config = configparser.ConfigParser(interpolation=None) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         config.add_section('cache') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         config.set('cache', 'version', '1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        config.set('cache', 'repository', hexlify(self.repository.id).decode('ascii')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        config.set('cache', 'repository', self.repository.id_str) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         config.set('cache', 'manifest', '') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         with open(os.path.join(self.path, 'config'), 'w') as fd: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             config.write(fd) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -214,7 +214,7 @@ Chunk index:    {0.total_unique_chunks:20d} {0.total_chunks:20d}""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     entry = FileCacheEntry(*msgpack.unpackb(item)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if entry.age < 10 and bigint_to_int(entry.mtime) < self._newest_mtime: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         msgpack.pack((path_hash, entry), fd) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        self.config.set('cache', 'manifest', hexlify(self.manifest.id).decode('ascii')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        self.config.set('cache', 'manifest', self.manifest.id_str) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.config.set('cache', 'timestamp', self.manifest.timestamp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.config.set('cache', 'key_type', str(self.key.TYPE)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.config.set('cache', 'previous_location', self.repository._location.canonical_path()) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -257,7 +257,7 @@ Chunk index:    {0.total_unique_chunks:20d} {0.total_chunks:20d}""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         archive_path = os.path.join(self.path, 'chunks.archive.d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         def mkpath(id, suffix=''): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            id_hex = hexlify(id).decode('ascii') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            id_hex = bin_to_hex(id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             path = os.path.join(archive_path, id_hex + suffix) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return path.encode('utf-8') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |