[tor-commits] [thandy/master] Fix behavior for bundles with more than one thp and add thp

nickm at torproject.org nickm at torproject.org
Thu Nov 3 19:14:20 UTC 2011


commit f04c3429dc33c9bcadfe8a3707f8646690838db8
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Fri Sep 2 20:44:53 2011 -0300

    Fix behavior for bundles with more than one thp and add thp
---
 lib/thandy/formats.py                |    9 +++++++--
 lib/thandy/packagesys/ThpPackages.py |    2 +-
 lib/thandy/repository.py             |    4 ++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py
index f57ab46..0a73ff4 100755
--- a/lib/thandy/formats.py
+++ b/lib/thandy/formats.py
@@ -746,6 +746,7 @@ def makePackageObj(config_fname, package_fname):
                             'exe_registry_ent',
                             'db_key', 'db_val',
                             'command_install', 'command_remove',
+                            'thp_name', 'thp_version',
                             ], preload)
 
     f = open(package_fname, 'rb')
@@ -783,8 +784,12 @@ def makePackageObj(config_fname, package_fname):
     elif format == 'thp':
         extra['check_type'] = 'thp'
         extra['install_type'] = 'thp'
-        extra['thp_name'] = r['name']
-        extra['thp_version'] = r['version']
+        if not r.get('thp_name'):
+            raise thandy.FormatException("missing thp_name value")
+        extra['thp_name'] = r['thp_name']
+        if not r.get('thp_version'):
+            raise thandy.FormatException("missing thp_version value")
+        extra['thp_version'] = r['thp_version']
 
     if r.get('command_install'):
         extra['install_type'] = 'command'
diff --git a/lib/thandy/packagesys/ThpPackages.py b/lib/thandy/packagesys/ThpPackages.py
index f359957..493a94a 100755
--- a/lib/thandy/packagesys/ThpPackages.py
+++ b/lib/thandy/packagesys/ThpPackages.py
@@ -26,7 +26,7 @@ class ThpDB(object):
           raise Exception("There is no THP_DB_ROOT variable set")
         dbpath = os.path.join(self._thp_db_root, "pkg-status")
         if not os.path.exists(dbpath):
-            os.mkdir(dbpat)
+            os.mkdir(dbpath)
 
     def getPath(self):
         return self._thp_db_root
diff --git a/lib/thandy/repository.py b/lib/thandy/repository.py
index bb7d2f6..20a1e9a 100755
--- a/lib/thandy/repository.py
+++ b/lib/thandy/repository.py
@@ -493,9 +493,9 @@ class LocalRepository:
                 packages[rp] = pfile
 
                 if pfile_data["format"] == "thp":
-                    thpTransactionDict[bundle['name']] = {}
+                    if not bundle['name'] in thpTransactionDict.keys():
+                        thpTransactionDict[bundle['name']] = {}
                     thpTransactionDict[bundle['name']][pfile_data['name']] = pfile_data
-                    continue
 
         # We have the packages. If we're downloading via bittorrent, we need
         # the .torrent metafiles, as well.





More information about the tor-commits mailing list