[or-cvs] [thandy/master] All current versions of Thandy have length fields

Nick Mathewson nickm at seul.org
Tue Aug 25 21:01:44 UTC 2009


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Mon, 1 Jun 2009 14:40:17 +0200
Subject: All current versions of Thandy have length fields
Commit: 8fcaaa5c88234a6141ec15610777d1b70910c97d

---
 lib/thandy/formats.py |    6 ++----
 specs/thandy-spec.txt |   14 ++++----------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py
index b8bdf5b..f59995a 100644
--- a/lib/thandy/formats.py
+++ b/lib/thandy/formats.py
@@ -438,7 +438,7 @@ BUNDLE_SCHEMA = S.Obj(
                     version=VERSION_SCHEMA,
                     path=RELPATH_SCHEMA,
                     hash=HASH_SCHEMA,
-                    length=S.Opt(LENGTH_SCHEMA),
+                    length=LENGTH_SCHEMA,
                     order=S.Struct([S.Int(), S.Int(), S.Int()]),
                     optional=S.Opt(S.Bool()),
                     gloss=S.DictOf(S.AnyStr(), S.AnyStr()),
@@ -771,9 +771,7 @@ def makeBundleObj(config_fname, getPackage, getPackageLength):
             raise thandy.FormatException("No such package as %s"%p['name'])
 
         p['hash'] = formatHash(getDigest(pkginfo))
-        length = getPackageLength(p['name'])
-        if length != None:
-            p['length'] = length
+        p['length'] = getPackageLength(p['name'])
         if p['path'] == None:
             p['path'] = pkginfo['location']
         if p['version'] == None:
diff --git a/specs/thandy-spec.txt b/specs/thandy-spec.txt
index 4fc17e8..586e3fa 100644
--- a/specs/thandy-spec.txt
+++ b/specs/thandy-spec.txt
@@ -398,7 +398,7 @@
       "m" : [ TIME, HASH, LENGTH ],
       "k" : [ TIME, HASH, LENGTH ],
       "b" : { NAME :
-                 [ [ Version, Path, Time, Hash, (Length) ] ] }
+                 [ [ Version, Path, Time, Hash, Length ] ] }
     }
 
   TIME is when the timestamp was signed.  MIRRORLISTHASH is the digest
@@ -407,8 +407,6 @@
   bundles and their locations and hashes.  The "name" of a bundle (in
   this context) is the directory component of the bundle's path.
 
-  The LENGTH field may be absent on very old timestamp files.
-
 3.6. File formats: bundle files
 
      { "_type" : "Bundle",
@@ -423,7 +421,7 @@
               "version" : VERSION,
               "path" : PATH,
               "hash" : HASH,
-              ("length" : LENGTH),
+              "length" : LENGTH,
               "order" : [ INST, UPDATE, REMOVE ],
               ("optional : BOOL, )
               "gloss" : { LANG : TEXT },
@@ -447,9 +445,6 @@
   language. The UI should display the must appropriate language to the
   user.
 
-  The LENGTH field is required on all new bundles, but may be absent
-  on very old ones.
-
 3.7. File formats: package files
 
    { "_type" : "Package",
@@ -458,14 +453,13 @@
      "version" : VERSION,
      "format" : FMT,
      "ts" : TIME,
-     "files" : [  [ PATH, HASH, INFO, (LENGTH) ], ... ],
+     "files" : [  [ PATH, HASH, INFO, LENGTH ], ... ],
      "shortdesc" : { LANG : DESC, ... },
      "longdesc" : { LANG : DESC, ... },
    }
 
   Most elements are self-explanatory.  To interpret the 'INFO' entry
-  for each installable file, see section 6.  The LENGTH field is
-  required on all new packages, but may be absent on very old ones.
+  for each installable file, see section 6.
 
   No two package files in the same repository should have the same
   name and version.  If a package needs to be changed, the version
-- 
1.5.6.5




More information about the tor-commits mailing list