summaryrefslogtreecommitdiff
path: root/lib/thandy/packagesys/ExePackages.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-11-16 22:27:17 +0000
committerNick Mathewson <nickm@torproject.org>2008-11-16 22:27:17 +0000
commit48adf40595f127c2bd167aa6774f4ba67e191c0f (patch)
tree8f200231a5f2a6f4f45a3f964f847457c5da5f00 /lib/thandy/packagesys/ExePackages.py
parent115bc0308c9384967ed25975aa21a312a2591524 (diff)
attach per-file type-specific metainfo to packages. use metainfo to tell what is already installed. use database to track things we have installed with not attacked version. notice when we have installable files and optionally install them.
git-svn-id: file:///home/or/svnrepo/updater/trunk@17294 55e972cd-5a19-0410-ae62-a4d7a52db4cd
Diffstat (limited to 'lib/thandy/packagesys/ExePackages.py')
-rw-r--r--lib/thandy/packagesys/ExePackages.py37
1 files changed, 32 insertions, 5 deletions
diff --git a/lib/thandy/packagesys/ExePackages.py b/lib/thandy/packagesys/ExePackages.py
index 1688da3..4989f3a 100644
--- a/lib/thandy/packagesys/ExePackages.py
+++ b/lib/thandy/packagesys/ExePackages.py
@@ -1,15 +1,38 @@
# Copyright 2008 The Tor Project, Inc. See LICENSE for licensing information.
+import subprocess
+
+import thandy.util
import thandy.packagesys.PackageSystem as ps
import thandy.packagesys.PackageDB as pdb
class ExePackageSystem(pdb.DBBackedPackageSystem):
+ def __init__(self, repo):
+ self._repo = repo
def getName(self):
- return "executable"
-
- def packageHandleFromJSON(self, json):
- raise NotImplemented() #XXXX????
+ return "exe"
+
+ def packageHandlesFromJSON(self, pkg):
+ if pkg['format'] != 'exe':
+ raise thandy.FormatException()
+
+ handles = []
+ for entry in pkg['files']:
+ if len(entry) < 3:
+ continue
+ rp, h, extra = entry[:3]
+ version = package['version']
+
+ handles.append(
+ ExePackageHandle(self.getDB(),
+ package['name'],
+ version,
+ [], # filelist not implemented in this.
+ rp,
+ self._repo.getFilename(rp),
+ extra['exe_args']))
+ return handles
def canBeAutomatic(self):
return True
@@ -18,12 +41,16 @@ class ExePackageSystem(pdb.DBBackedPackageSystem):
return True
class ExePackageHandle(pdb.DBBackedPackageHandle):
- def __init__(self, packageDB, name, version, filelist, filename,
+ def __init__(self, packageDB, name, version, filelist, relpath, filename,
arguments):
pdb.DBBackedPackageHandle.__init__(packageDB, name, version, filelist)
+ self._relPath = relpath
self._filename = filename
self._arguments = arguments
+ def getRelativePath(self):
+ return self._relPath
+
def _doInstall(self):
commandline = [ self._filename ] + self._arguments
logging.info("Installing %s. Command line: %s", self._filename,