diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-11-17 20:55:28 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-11-17 20:55:28 +0000 |
commit | 2fe77ca953e916966a28e4cf3895565a464cc8fd (patch) | |
tree | 18a50e432b4fe343bc0d223ccd02d3011859e1c0 /lib/thandy/formats.py | |
parent | e5ec1b2ce20f7578fea683229aadc95431fdb451 (diff) |
Add win32 registry support to thandy. untested.
git-svn-id: file:///home/or/svnrepo/updater/trunk@17319 55e972cd-5a19-0410-ae62-a4d7a52db4cd
Diffstat (limited to 'lib/thandy/formats.py')
-rw-r--r-- | lib/thandy/formats.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py index ff65173..e047d87 100644 --- a/lib/thandy/formats.py +++ b/lib/thandy/formats.py @@ -456,6 +456,18 @@ PACKAGE_SCHEMA = S.Obj( shortdesc=S.DictOf(S.AnyStr(), S.AnyStr()), longdesc=S.DictOf(S.AnyStr(), S.AnyStr())) +def checkWinRegistryKeyname(keyname): + """Check keyname for superficial well-formedness as a win32 registry entry + name.""" + hkey, rest = keyname.split("\\", 1) + key, value = rest.rsplit("\\", 1) + if hkey not in [ "HKEY_CURRENT_CONFIG", + "HKEY_CURRENT_USER", + "HKEY_LOCAL_MACHINE" ]: + raise thandy.FormatException("Bad hkey on registry entry.") + elif not key or not value: + raise thandy.FormatException("Bad registry entry.") + ALL_ROLES = ('timestamp', 'mirrors', 'bundle', 'package', 'master') class Key: @@ -613,7 +625,8 @@ def makePackageObj(config_fname, package_fname): 'format', 'location', 'relpath', - ], ['rpm_version', 'exe_args'], preload) + ], ['rpm_version', 'exe_args', + 'exe_registry_ent' ], preload) f = open(package_fname, 'rb') digest = getFileDigest(f) @@ -633,12 +646,20 @@ def makePackageObj(config_fname, package_fname): if format == 'rpm': if not r.get('rpm_version'): - raise Thandy.FormatException("missing rpm_version value") + raise thandy.FormatException("missing rpm_version value") extra['rpm_version'] = r['rpm_version'] elif format == 'exe': if not r.get('exe_args'): - raise Thandy.FormatException("missing exe_args value") + raise thandy.FormatException("missing exe_args value") extra['exe_args'] = r['exe_args'] + if r.get('exe_registry_ent'): + if len(exe_registry_ent) != 2: + raise thandy.FormatException("Bad length on exe_registry_ent") + regkey, regval = r['exe_registry_ent'] + checkWinRegistryKeyname(regkey) + if not isinstance(regval, basestring): + raise thandy.FormatException("Bad version on exe_registry_ent") + extra['registry_ent'] = [ regkey, regval ] PACKAGE_SCHEMA.checkMatch(result) |