diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-10-15 19:28:30 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-10-15 19:28:30 +0000 |
commit | 5bdfb1ef8405a14186637785014aa32337867df5 (patch) | |
tree | 386cf0127a394d41e3805415a4186f0751f47c9c /lib | |
parent | e2ff676152f4df722827bc8d7babe25c6dc42bf0 (diff) |
Checkpoint: s/glider/thandy/; s/sexp/json/
git-svn-id: file:///home/or/svnrepo/updater/trunk@17109 55e972cd-5a19-0410-ae62-a4d7a52db4cd
Diffstat (limited to 'lib')
-rw-r--r-- | lib/thandy/formats.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py index 08d7a7f..c44c9cf 100644 --- a/lib/thandy/formats.py +++ b/lib/thandy/formats.py @@ -670,6 +670,15 @@ def makeBundleObj(config_fname, getPackage): def versionIsNewer(v1, v2): return v1 > v2 +def getBundleKey(bundlePath): + """ + >>> getBundleKey("/bundleinfo/tor-browser/win32/some-file-name.txt") + '/bundleinfo/tor-browser/win32/' + """ + # No, we can't use "os.path.directory." That isn't os-independent. + idx = bundlePath.rindex("/") + return bundlePath[:idx+1] + def makeTimestampObj(mirrorlist_obj, keylist_obj, bundle_objs): result = { '_type' : 'Timestamp', @@ -680,11 +689,11 @@ def makeTimestampObj(mirrorlist_obj, keylist_obj, formatHash(getDigest(keylist_obj)) ] result['b'] = bundles = {} for bundle in bundle_objs: - name = bundle['name'] + k = getBundleKey(bundle['location']) v = bundle['version'] entry = [ v, bundle['location'], bundle['at'], formatHash(getDigest(bundle)) ] - if not bundles.has_key(name) or versionIsNewer(v, bundles[name][0]): - bundles[name] = entry + if not bundles.has_key(k) or versionIsNewer(v, bundles[k]['version']): + bundles[k] = entry TIMESTAMP_SCHEMA.checkMatch(result) |