[or-cvs] r17416: {updater} Generate new command formats, I believe. (in updater/trunk: . lib/thandy samples)

nickm at seul.org nickm at seul.org
Sun Nov 30 06:37:05 UTC 2008


Author: nickm
Date: 2008-11-30 01:37:05 -0500 (Sun, 30 Nov 2008)
New Revision: 17416

Modified:
   updater/trunk/TODO
   updater/trunk/lib/thandy/formats.py
   updater/trunk/samples/example-package.cfg
Log:
Generate new command formats, I believe.

Modified: updater/trunk/TODO
===================================================================
--- updater/trunk/TODO	2008-11-30 06:19:36 UTC (rev 17415)
+++ updater/trunk/TODO	2008-11-30 06:37:05 UTC (rev 17416)
@@ -2,9 +2,18 @@
 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.
   o Handle full stalled file in download.
@@ -29,8 +38,6 @@
   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 @@
   - More comments, more tests
   o Document EXE and RPM formats in HOWTO.
   . full pydoc
-  - revise spec
+  . revise spec
 
 - Testing
   - Much bigger unit tests.

Modified: updater/trunk/lib/thandy/formats.py
===================================================================
--- updater/trunk/lib/thandy/formats.py	2008-11-30 06:19:36 UTC (rev 17415)
+++ updater/trunk/lib/thandy/formats.py	2008-11-30 06:37:05 UTC (rev 17416)
@@ -658,6 +658,7 @@
     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 @@
                         '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,22 +693,36 @@
         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)
 
     return result

Modified: updater/trunk/samples/example-package.cfg
===================================================================
--- updater/trunk/samples/example-package.cfg	2008-11-30 06:19:36 UTC (rev 17415)
+++ updater/trunk/samples/example-package.cfg	2008-11-30 06:37:05 UTC (rev 17416)
@@ -19,7 +19,8 @@
 
 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 @@
 #  # (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 @@
 #
 # 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"
+



More information about the tor-commits mailing list