aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-08-04 21:31:25 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-08-04 21:31:25 (GMT)
commitf32185adac068aeb6ebe9bb4240103a4fb29bbee (patch)
treee3c49fda55f513924c083f0fb7f04d704babbf5a
parent09e55a6a1f9aeeccc8ae9e3b27850e40f7db7c2e (diff)
downloadfusearchive-f32185adac068aeb6ebe9bb4240103a4fb29bbee.zip
fusearchive-f32185adac068aeb6ebe9bb4240103a4fb29bbee.tar.gz
fusearchive-f32185adac068aeb6ebe9bb4240103a4fb29bbee.tar.bz2
Debugging utilities
-rwxr-xr-xdump_chunk.py14
-rwxr-xr-xdump_chunkfile.py18
2 files changed, 32 insertions, 0 deletions
diff --git a/dump_chunk.py b/dump_chunk.py
new file mode 100755
index 0000000..8212e62
--- /dev/null
+++ b/dump_chunk.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+import FuseArchive.Chunk, sys, pickle, os
+
+# This prints some debug info about a chunk
+f = FuseArchive.Chunk.Chunk.parse_header( open( sys.argv[ 1 ] ).read(
+ FuseArchive.Chunk.header_length ) )
+print f
+os.system( "ls -l %s" % sys.argv[ 1 ] )
+
+# Detail
+if len( sys.argv ) == 3:
+ f = FuseArchive.Chunk.Chunk.deserialize( open( sys.argv[ 1 ] ).read() )
+ pickle.dump( f, sys.stdout, 0 )
diff --git a/dump_chunkfile.py b/dump_chunkfile.py
new file mode 100755
index 0000000..84fbfac
--- /dev/null
+++ b/dump_chunkfile.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import FuseArchive.ChunkFile, sys, re, os
+
+# Run this in the storage area, basically 'cat' the file
+file = re.sub( '^.*?tree', '', sys.argv[ 1 ] )
+sys.stderr.write( "Opening file: %s\n" % file )
+
+f = FuseArchive.ChunkFile.ChunkFile( file, os.O_RDONLY, 0 )
+
+sys.stderr.write( "File is: %d bytes\n" % f.size )
+
+offset = 0
+blocksize = 4096
+while offset <= f.size:
+ data = f.read( blocksize, offset )
+ sys.stdout.write( data )
+ offset += blocksize