diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-11-16 22:27:17 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-11-16 22:27:17 +0000 |
commit | 48adf40595f127c2bd167aa6774f4ba67e191c0f (patch) | |
tree | 8f200231a5f2a6f4f45a3f964f847457c5da5f00 /lib/thandy/formats.py | |
parent | 115bc0308c9384967ed25975aa21a312a2591524 (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/formats.py')
-rw-r--r-- | lib/thandy/formats.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py index 7ae6080..4afbd00 100644 --- a/lib/thandy/formats.py +++ b/lib/thandy/formats.py @@ -451,7 +451,8 @@ PACKAGE_SCHEMA = S.Obj( version=VERSION_SCHEMA, format=S.Obj(), ts=TIME_SCHEMA, - files=S.ListOf(S.Struct([RELPATH_SCHEMA, HASH_SCHEMA])), + files=S.ListOf(S.Struct([RELPATH_SCHEMA, HASH_SCHEMA], + allowMore=True)), shortdesc=S.DictOf(S.AnyStr(), S.AnyStr()), longdesc=S.DictOf(S.AnyStr(), S.AnyStr())) @@ -612,23 +613,29 @@ def makePackageObj(config_fname, package_fname): 'format', 'location', 'relpath', - ], (), preload) + ], ['rpm_version', 'exe_args'], preload) f = open(package_fname, 'rb') digest = getFileDigest(f) # Check fields! + extra = {} result = { '_type' : "Package", 'ts' : formatTime(time.time()), 'name' : r['name'], 'location' : r['location'], #DOCDOC 'version' : r['version'], 'format' : r['format'], - 'files' : [ [ r['relpath'], formatHash(digest) ] ], + 'files' : [ [ r['relpath'], formatHash(digest), extra ] ], 'shortdesc' : shortDescs, 'longdesc' : longDescs } + if format == 'rpm' and r.get('rpm_version'): + extra['rpm_version'] = r['rpm_version'] + elif format == 'exe' and r.get('exe_args') != None: + extra['exe_args'] = r['exe_args'] + PACKAGE_SCHEMA.checkMatch(result) return result |