def addPreviousVersions(path):
	write('Adding ' + path + '...\r')
	if isdir(prefix + path):
		names = listdir(prefix + path)
		names.sort()
		for name in names:
			if path != '':
				name = path + '/' + name
			addPreviousVersions(name)
	else:
		match = pattern.match(path)
		if match == None:
			return
		plugin = plugins.getPlugin(match.group(1))
		if plugin == None:
			print 'Ignoring', match.group(1)
			return
		checksum = Util.getDigest(match.group(1), prefix + path)
		timestamp = long(match.group(2))
		if not plugin.hasPreviousVersion(checksum):
			plugin.addPreviousVersion(checksum, timestamp)
Exemplo n.º 2
0
		XMLFileReader(GZIPInputStream(FileInputStream(dbPath)), 0)
	if plugin.startswith('precompiled/'):
		plugin = plugin[12:]
	plugin = PluginCollection.getInstance().getPlugin(plugin)
	if plugin.current != None and checksum == plugin.current.checksum:
		return plugin.current.timestamp
	for version in plugin.previous.keySet():
		if checksum == version.checksum:
			return version.timestamp

from sys import argv

if len(argv) == 2:
	from fiji.updater.util import Util
	print 'Checksumming', argv[1]
	checksum = Util.getDigest(argv[1], argv[1])
	timestamp = getTimestamp(argv[1], checksum)
	print 'Got checksum', checksum
	print '\t... which corresponds to timestamp', timestamp
elif len(argv) == 3:
	if len(argv[2]) == 40:
		timestamp = getTimestamp(argv[1], argv[2])
	else:
		timestamp = argv[2]
	print 'Timestamp', timestamp, 'for', argv[1]
else:
	from sys import exit
	print 'Usage:', argv[0], '<jar>', '[<timestamp-or-checksum>]'
	exit(1)

if timestamp == None:
Exemplo n.º 3
0
    if plugin == None:
        print 'Could not find plugin', plugin, 'in db.xml.gz'
        return None
    if plugin.current != None and checksum == plugin.current.checksum:
        return plugin.current.timestamp
    for version in plugin.previous.keySet():
        if checksum == version.checksum:
            return version.timestamp


from sys import argv

if len(argv) == 2:
    from fiji.updater.util import Util
    print 'Checksumming', argv[1]
    checksum = Util.getDigest(argv[1], argv[1])
    timestamp = getTimestamp(argv[1], checksum)
    print 'Got checksum', checksum
    print '\t... which corresponds to timestamp', timestamp
elif len(argv) == 3:
    if len(argv[2]) == 40:
        timestamp = getTimestamp(argv[1], argv[2])
    else:
        timestamp = argv[2]
    print 'Timestamp', timestamp, 'for', argv[1]
else:
    from sys import exit
    print 'Usage:', argv[0], '<jar>', '[<timestamp-or-checksum>]'
    exit(1)

if timestamp == None: