[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r17096: {updater} Usability fixes and cleanups (updater/trunk/lib/thandy)
Author: nickm
Date: 2008-10-14 16:04:10 -0400 (Tue, 14 Oct 2008)
New Revision: 17096
Modified:
updater/trunk/lib/thandy/SignerCLI.py
updater/trunk/lib/thandy/formats.py
Log:
Usability fixes and cleanups
Modified: updater/trunk/lib/thandy/SignerCLI.py
===================================================================
--- updater/trunk/lib/thandy/SignerCLI.py 2008-10-14 20:03:50 UTC (rev 17095)
+++ updater/trunk/lib/thandy/SignerCLI.py 2008-10-14 20:04:10 UTC (rev 17096)
@@ -98,13 +98,9 @@
_, r, _ = thandy.formats.checkSignedObj(p)
if r != 'package':
print pkgFile, "was not a package"
- packages[p['signed']['location']] = p
+ packages[p['signed']['name']] = p['signed']
- def getHash(path):
- p = packages[path]
- return thandy.formats.getDigest(p['signed'])
-
- bundleObj = thandy.formats.makeBundleObj(configFile, getHash)
+ bundleObj = thandy.formats.makeBundleObj(configFile, packages.__getitem__)
signable = thandy.formats.makeSignable(bundleObj)
ks = getKeyStore()
@@ -224,7 +220,7 @@
r = args[1]
if r not in thandy.formats.ALL_ROLES:
print "Unrecognized role %r. Known roles are %s"%(
- r,", ".join(thandy.format.ALL_ROLES))
+ r,", ".join(thandy.formats.ALL_ROLES))
sys.exit(1)
p = args[2]
k.addRole(r, p)
@@ -239,7 +235,7 @@
r = args[1]
if r not in thandy.formats.ALL_ROLES:
print "Unrecognized role %r. Known roles are %s"%(
- r,", ".join(thandy.format.ALL_ROLES))
+ r,", ".join(thandy.formats.ALL_ROLES))
sys.exit(1)
p = args[2]
Modified: updater/trunk/lib/thandy/formats.py
===================================================================
--- updater/trunk/lib/thandy/formats.py 2008-10-14 20:03:50 UTC (rev 17095)
+++ updater/trunk/lib/thandy/formats.py 2008-10-14 20:04:10 UTC (rev 17096)
@@ -628,11 +628,11 @@
return result
-def makeBundleObj(config_fname, getPackageHash):
+def makeBundleObj(config_fname, getPackage):
packages = []
def ShortGloss(lang, val): packages[-1]['gloss'][lang] = val
def LongGloss(lang, val): packages[-1]['longgloss'][lang] = val
- def Package(name, version, path, order, optional=False):
+ def Package(name, order, version=None, path=None, optional=False):
packages.append({'name' : name,
'version' : version,
'path' : path,
@@ -661,8 +661,18 @@
for p in packages:
try:
- p['hash'] = formatHash(getPackageHash(p['path']))
+ pkginfo = getPackage(p['name'])
except KeyError:
+ raise thandy.FormatException("No such package as %s"%p['name'])
+
+ p['hash'] = formatHash(getDigest(pkginfo))
+ if p['path'] == None:
+ p['path'] = pkginfo['location']
+ if p['version'] == None:
+ p['version'] = pkginfo['version']
+ if p['
+
+ except KeyError:
raise thandy.FormatException("No such package as %s"%p['path'])
BUNDLE_SCHEMA.checkMatch(result)