diff --git a/dedupestore/archiver.py b/dedupestore/archiver.py index 50e4476a5..e24e39ec7 100644 --- a/dedupestore/archiver.py +++ b/dedupestore/archiver.py @@ -27,7 +27,7 @@ class Archive(object): self.chunks.append((id, sum, csize, osize)) self.chunk_idx[id] = idx return idx - + def open(self, name): archive = cPickle.loads(zlib.decompress(self.store.get(NS_ARCHIVES, name))) self.items = archive['items'] @@ -93,9 +93,11 @@ class Archive(object): for root, dirs, files in os.walk(path): for d in dirs: p = os.path.join(root, d) + print p self.items.append(self.process_dir(p, cache)) for f in files: p = os.path.join(root, f) + print p self.items.append(self.process_file(p, cache)) self.save(name) cache.archives.append(name) @@ -103,13 +105,11 @@ class Archive(object): def process_dir(self, path, cache): path = path.lstrip('/\\:') - print 'Directory: %s' % (path) return {'type': 'DIR', 'path': path} def process_file(self, path, cache): with open(path, 'rb') as fd: path = path.lstrip('/\\:') - print 'Adding: %s...' % path chunks = [] for chunk in chunkify(fd, CHUNK_SIZE, cache.summap): chunks.append(self.add_chunk(*cache.add_chunk(chunk))) diff --git a/dedupestore/cache.py b/dedupestore/cache.py index 00fafb190..5805ba62d 100644 --- a/dedupestore/cache.py +++ b/dedupestore/cache.py @@ -58,7 +58,7 @@ class Cache(object): def save(self): assert self.store.state == Store.OPEN print 'saving cache' - data = {'uuid': self.store.uuid, + data = {'uuid': self.store.uuid, 'chunkmap': self.chunkmap, 'summap': self.summap, 'tid': self.store.tid, 'archives': self.archives} print 'Saving cache as:', self.path @@ -96,7 +96,7 @@ class Cache(object): def chunk_decref(self, id): count, sum, csize, osize = self.chunkmap[id] - sumcount = self.summap[sum] + sumcount = self.summap[sum] if sumcount == 1: del self.summap[sum] else: diff --git a/dedupestore/chunkifier.py b/dedupestore/chunkifier.py index c1e693b68..a9d6f63b6 100644 --- a/dedupestore/chunkifier.py +++ b/dedupestore/chunkifier.py @@ -1,6 +1,6 @@ def checksum(data, sum=0): """Simple but fast checksum that can be updated at either end. - + >>> checksum('FOOBAR') 102367679 >>> checksum('FOOBAR') == checksum('BAR', checksum('FOO')) diff --git a/setup.py b/setup.py index d91c247fb..a7b021bab 100644 --- a/setup.py +++ b/setup.py @@ -10,4 +10,4 @@ setup(name='Dedupestore', packages=['dedupestore'], ext_modules=[Extension('_speedups', ['dedupestore/_speedups.c'])], ) - \ No newline at end of file +