From d124ec5255713e40b5f325c614ad9fdb7f26ff28 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 30 Nov 2008 06:37:05 +0000 Subject: Generate new command formats, I believe. git-svn-id: file:///home/or/svnrepo/updater/trunk@17416 55e972cd-5a19-0410-ae62-a4d7a52db4cd --- TODO | 17 ++++++++++++----- lib/thandy/formats.py | 40 +++++++++++++++++++++++++++++----------- samples/example-package.cfg | 20 +++++++++++++++----- 3 files changed, 56 insertions(+), 21 deletions(-) diff --git a/TODO b/TODO index 8c5e6cd..0f99e94 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,17 @@ o get messaging sorted o try to write up a registry-based exe version checker., o Decouple install from check: they are not necessarily related. o Generate newer, better objects internally. - - Generate new, better formats for existing 'exe' items - - Generate command items properly. + o Generate new, better formats for existing 'exe' items + o Generate command items properly. + +- Missing packaging features: + - Generate multi-item packages properly. + - Transition better for checking on a given item + - Implement remove + - Get RPM actually more tested + - Get install-from-compressed-file working. + - Transaction support where available. + - OSX backend . Download improvements. o Back off on download failure. @@ -29,8 +38,6 @@ o Write client-side code X Rendezvous-back with Tor when done. - Better configurability: let users override mirrors, keys, etc. -- Backend for "A bunch of files you can unzip someplace." -- OSX backend (hard). - Proper exponential back-off on download backend. - Wrapping @@ -40,7 +47,7 @@ o Write client-side code - More comments, more tests o Document EXE and RPM formats in HOWTO. . full pydoc - - revise spec + . revise spec - Testing - Much bigger unit tests. diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py index 168f267..d5d57a2 100644 --- a/lib/thandy/formats.py +++ b/lib/thandy/formats.py @@ -658,6 +658,7 @@ def makePackageObj(config_fname, package_fname): longDescs = {} def ShortDesc(lang, val): shortDescs[lang] = val def LongDesc(lang, val): longDescs[lang] = val + #XXXX handle multiple files. preload = { 'ShortDesc' : ShortDesc, 'LongDesc' : LongDesc } r = readConfigFile(config_fname, ['name', @@ -666,7 +667,10 @@ def makePackageObj(config_fname, package_fname): 'location', 'relpath', ], ['rpm_version', 'exe_args', - 'exe_registry_ent' ], preload) + 'exe_registry_ent', + 'db_key', 'db_val', + 'command_install', 'command_remove', + ], preload) f = open(package_fname, 'rb') digest = getFileDigest(f) @@ -689,21 +693,35 @@ def makePackageObj(config_fname, package_fname): if not r.get('rpm_version'): raise thandy.FormatException("missing rpm_version value") extra['rpm_version'] = r['rpm_version'] + extra['check_type'] = 'rpm' + extra['install_type'] = 'rpm' elif format == 'exe': if not r.get('exe_args'): raise thandy.FormatException("missing exe_args value") extra['exe_args'] = r['exe_args'] + if not r.get('cmd_install'): + extra['install_type'] = 'command' + extra['cmd_install'] = [ "${FILE}" ] + r['exe_args'] + + if r.get('command_install'): extra['install_type'] = 'command' - extra['cmd_install'] = [ "${FILE}" ] + r['exe_args'] - if r.get('exe_registry_ent'): - if len(r['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 ] - extra['check_type'] = 'registry' + extra['cmd_install'] = r['command_install'] + if r.get('command_remove'): + extra['cmd_remove'] = r['command_remove'] + + if r.get('exe_registry_ent'): + if len(r['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 ] + extra['check_type'] = 'registry' + elif r.get('db_key'): + extra['item_name'] = r['db_key'] + extra['item_version'] = r['db_val'] + extra['check_type'] = 'db' PACKAGE_SCHEMA.checkMatch(result) diff --git a/samples/example-package.cfg b/samples/example-package.cfg index 6df6ac0..0f31c98 100644 --- a/samples/example-package.cfg +++ b/samples/example-package.cfg @@ -19,7 +19,8 @@ LongDesc('en', Its description is not quite so long as it might be, but hey.""") -# What kind of package is this? +# What kind of package is this? Mostly this is ignored right now. +# Don't use 'exe': that's special. format = "none" # Thandy knows how to manage some file formats, but it needs to include @@ -36,11 +37,12 @@ format = "none" # # (You can use this format for anything that you install by executing it # # that does not have its own built-in installation mechanism.) # -# format = "exe" +# format = "win32" # -# # What arguments do you pass to this package to install it? -# # This needs to be a list of strings. -# exe_args = [ "--silent", "--automatic", "--omit-bugs", ] +# # What do you call to install the package? +# # This needs to be a list of strings. ${FILE} is expanded to the file +# # name. +# command_install = [ {${FILE}", "--silent", "--automatic", "--omit-bugs", ] # # # Optional: a registry key, value pair for a version number that this # # package will set when it installs itself. The exe is responsible for @@ -51,3 +53,11 @@ format = "none" # # exe_registry_ent = [ r'HKEY_LOCAL_MACHINE\Software\Blahblahblach\Version', # '0.1.2' ] +# +# # Optional: a database key and value that are stored in the internal +# # Thandy database when this item is installed, so Thandy can remember +# # if it is installed. Do not use this if you are setting exe_registry_ent. +# # Using the registry is a better idea. +# db_key = "example-exe" +# db_val = "0.1.2" + -- cgit v1.2.3