summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@torproject.org>2011-09-02 20:44:53 -0300
committerTomás Touceda <chiiph@torproject.org>2011-09-02 20:44:53 -0300
commitf04c3429dc33c9bcadfe8a3707f8646690838db8 (patch)
tree101a178256e71c5aba0d960c00181298be61f464
parent40b3a86a82054c88f5865cef9b8d7fff8486f768 (diff)
Fix behavior for bundles with more than one thp and add thp
-rwxr-xr-xlib/thandy/formats.py9
-rwxr-xr-xlib/thandy/packagesys/ThpPackages.py2
-rwxr-xr-xlib/thandy/repository.py4
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.