Author: poeml
Date: Mon Mar 19 23:04:02 2012
New Revision: 8257

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8257&view=rev
Log:
mb makehashes:
- no longer write metalink data / cryptohashes into files. They are stored in
  the database since 2.13.0. The old storage in files was only backwards
  compatibility with 2.12 and earlier.

Modified:
    trunk/mb/mb/hashes.py

Modified: trunk/mb/mb/hashes.py
URL: 
http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mb/mb/hashes.py?rev=8257&r1=8256&r2=8257&view=diff
==============================================================================
--- trunk/mb/mb/hashes.py       (original)
+++ trunk/mb/mb/hashes.py       Mon Mar 19 23:04:02 2012
@@ -73,11 +73,10 @@
         try:
             dst_statinfo = os.stat(self.dst)
             dst_mtime = dst_statinfo.st_mtime
-            dst_size = dst_statinfo.st_size
         except OSError:
-            dst_mtime = dst_size = 0 # file missing
-
-        if int(dst_mtime) == int(self.mtime) and dst_size != 0 and not force:
+            dst_mtime = 0 # file missing
+
+        if int(dst_mtime) == int(self.mtime) and not force:
             if verbose:
                 print 'Up to date hash file: %r' % self.dst
             return 
@@ -92,9 +91,7 @@
             sys.stderr.write('skipping hash (file) generation\n')
             return
 
-        d = open(self.dst, 'wb')
-        d.write(self.hb.dump_2_12_template())
-        d.close()
+        open(self.dst, 'w').close()
 
         if verbose:
             print 'Hash file updated: %r' % self.dst
@@ -349,36 +346,6 @@
         return self.dump_raw()
 
 
-    def dump_2_12_template(self):
-        """dump in the form that was used up to mirrorbrain-2.12.0"""
-
-        r = []
-
-
-        r.append("""      <verification>
-        <hash type="md5">%s</hash>
-        <hash type="sha1">%s</hash>""" % (self.md5hex, self.sha1hex))
-        if self.sha256:
-            r.append('        <hash type="sha256">%s</hash>' % 
(self.sha256hex))
-
-        if self.pgp:
-            r.append('        <signature type="pgp" file="%s.asc">' % 
self.basename)
-            r.append(self.pgp)
-            r.append('        </signature>')
-
-        if self.do_chunked_hashes:
-            r.append('        <pieces length="%s" type="sha1">' % 
(self.chunk_size))
-
-            n = 0
-            for piece in self.pieceshex:
-                r.append('            <hash piece="%s">%s</hash>' % (n, piece))
-                n += 1
-
-            r.append('        </pieces>\n      </verification>\n')
-
-        return '\n'.join(r)
-
-
     def zs_guess_zsync_params(self):
         import math
 




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
        unsubscribe
to the address mirrorbrain-commits-requ...@mirrorbrain.org

Reply via email to