Hello community,
here is the log from the commit of package zeroinstall-injector for openSUSE:Factory
checked in at Thu Aug 11 10:11:35 CEST 2011.
--------
--- zeroinstall-injector/zeroinstall-injector.changes 2011-07-12 20:47:44.000000000 +0200
+++ /mounts/work_src_done/STABLE/zeroinstall-injector/zeroinstall-injector.changes 2011-08-08 18:16:43.000000000 +0200
@@ -1,0 +2,6 @@
+Sat Jul 31 10:46:34 UTC 2011 - talex5@gmail.com
+
+- Updated to 1.2. For a list of changes, see:
+ http://article.gmane.org/gmane.comp.file-systems.zero-install.devel/4387
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
zeroinstall-injector-1.1.tar.bz2
New:
----
zeroinstall-injector-1.2.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ _service:format_spec_file:zeroinstall-injector.spec ++++++
--- /var/tmp/diff_new_pack.34zgOv/_old 2011-08-11 10:11:17.000000000 +0200
+++ /var/tmp/diff_new_pack.34zgOv/_new 2011-08-11 10:11:17.000000000 +0200
@@ -21,9 +21,9 @@
%define cache_dir /var/cache/0install.net
Name: zeroinstall-injector
-Version: 1.1
+Version: 1.2
Release: 1
-%define source_version 1.1
+%define source_version 1.2
Summary: Decentralised cross-distribution software installation
Group: System/Management
++++++ zeroinstall-injector.spec ++++++
--- /var/tmp/diff_new_pack.34zgOv/_old 2011-08-11 10:11:17.000000000 +0200
+++ /var/tmp/diff_new_pack.34zgOv/_new 2011-08-11 10:11:17.000000000 +0200
@@ -21,9 +21,9 @@
%define cache_dir /var/cache/0install.net
Name: zeroinstall-injector
-Version: 1.1
+Version: 1.2
Release: 1
-%define source_version 1.1
+%define source_version 1.2
Summary: Decentralised cross-distribution software installation
Group: System/Management
@@ -124,5 +124,4 @@
# set up sharing of downloads later.
/usr/sbin/useradd -c 'Zero Install shared cache' \
-s /sbin/nologin -r -d '/' zeroinst 2> /dev/null || :
-
%changelog
++++++ zeroinstall-injector-1.1.tar.bz2 -> zeroinstall-injector-1.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/ZeroInstall.xml new/zeroinstall-injector-1.2/ZeroInstall.xml
--- old/zeroinstall-injector-1.1/ZeroInstall.xml 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/ZeroInstall.xml 2011-07-23 10:55:28.000000000 +0200
@@ -49,6 +49,6 @@
<version before="3" not-before="2.6"/>
</requires>
- <implementation id="." released="2011-06-25" version="1.1"/>
+ <implementation id="." released="2011-07-23" version="1.2"/>
</group>
</interface>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/Source.xml new/zeroinstall-injector-1.2/tests/Source.xml
--- old/zeroinstall-injector-1.1/tests/Source.xml 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/tests/Source.xml 2011-07-23 10:55:28.000000000 +0200
@@ -10,7 +10,7 @@
<requires interface='notused' use='never'/>
<requires interface='http://foo/Compiler.xml'>
<environment name='PATH' insert='bin'/>
- <environment name='NO_PATH' value='bin'/>
+ <environment name='NO_PATH' value='bin' separator=','/>
<environment name='BINDIR' insert='bin' mode='replace'/>
</requires>
<implementation id='sha1=234' version='1' version-modifier='.0' arch='*-src' compile:command='make'>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/old-selections.xml new/zeroinstall-injector-1.2/tests/old-selections.xml
--- old/zeroinstall-injector-1.1/tests/old-selections.xml 1970-01-01 01:00:00.000000000 +0100
+++ new/zeroinstall-injector-1.2/tests/old-selections.xml 2011-07-23 10:55:28.000000000 +0200
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<selections xmlns="http://zero-install.sourceforge.net/2004/injector/interface" interface="http://www.serscis.eu/0install/serscis-access-modeller">
+ <selection doc-dir="doc" id="sha1new=daf7bfada93ec758baeef1c714f3239ce0a5a462" interface="http://repo.roscidus.com/java/iris" license="OSI Approved :: GNU General Public License v2" released="2011-03-26" version="0.60">
+ <manifest-digest sha1new="daf7bfada93ec758baeef1c714f3239ce0a5a462"/>
+ <environment insert="iris-0.60.jar" mode="prepend" name="CLASSPATH"/>
+ <environment insert="iris-app-0.60.jar" mode="prepend" name="CLASSPATH"/>
+ <environment insert="iris-parser-0.60.jar" mode="prepend" name="CLASSPATH"/>
+ </selection>
+ <selection arch="Linux-x86_64" id="sha1new=3ede8dc4b83dd3d7705ee3a427b637a2cb98d789" interface="http://repo.roscidus.com/java/openjdk-6-jre" released="2011-05-29" version="6.18-1.8.7-2">
+ <manifest-digest sha1new="3ede8dc4b83dd3d7705ee3a427b637a2cb98d789"/>
+ </selection>
+ <selection distributions="Debian" from-feed="distribution:http://repo.roscidus.com/utils/graphviz" id="package:deb:graphviz:2.26.3-7:x86_64" interface="http://repo.roscidus.com/utils/graphviz" package="graphviz" version="2.26.3-7"/>
+ <selection id="sha1new=55b14f34a76a28c4ca3f4f7c08ebacb8ca87c52e" interface="http://www.serscis.eu/0install/serscis-access-modeller" released="2011-06-23" version="0.4">
+ <manifest-digest sha1new="55b14f34a76a28c4ca3f4f7c08ebacb8ca87c52e" sha256="d5f30349df0fac73c4621cc3161ab125ba5f83ba9ec35e27fbb0f3a7392070eb"/>
+ <environment insert="." mode="prepend" name="CLASSPATH"/>
+ <requires interface="http://repo.roscidus.com/java/iris"/>
+ <requires interface="http://repo.roscidus.com/utils/graphviz">
+ <environment insert="." mode="prepend" name="GRAPHVIZ_HOME"/>
+ </requires>
+ </selection>
+ <command name="run">
+ <runner interface="http://repo.roscidus.com/java/openjdk-6-jre"/>
+ <arg>eu.serscis.Eval</arg>
+ </command>
+ <command path="bin/java"/>
+</selections>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/runnable/RunExec.xml new/zeroinstall-injector-1.2/tests/runnable/RunExec.xml
--- old/zeroinstall-injector-1.1/tests/runnable/RunExec.xml 1970-01-01 01:00:00.000000000 +0100
+++ new/zeroinstall-injector-1.2/tests/runnable/RunExec.xml 2011-07-23 10:55:28.000000000 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
+ <name>RunExec</name>
+ <summary>script that uses a command</summary>
+
+ <implementation id="test" local-path="." version="1">
+ <command name="run" path="go.sh"/>
+ <requires interface='./Runnable.xml'>
+ <executable-in-path name='0testprog'/>
+ <executable-in-var name='PROG' command='foo'/>
+ </requires>
+ </implementation>
+</interface>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/runnable/Runnable.xml new/zeroinstall-injector-1.2/tests/runnable/Runnable.xml
--- old/zeroinstall-injector-1.1/tests/runnable/Runnable.xml 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/tests/runnable/Runnable.xml 2011-07-23 10:55:28.000000000 +0200
@@ -11,5 +11,12 @@
<arg>command-arg</arg>
<arg>--</arg>
</command>
+ <command name="foo" path="script">
+ <runner interface='./Runner.xml' command='runme'>
+ <arg>arg-for-runner</arg>
+ </runner>
+ <arg>foo-arg</arg>
+ <arg>--</arg>
+ </command>
</implementation>
</interface>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/runnable/go.sh new/zeroinstall-injector-1.2/tests/runnable/go.sh
--- old/zeroinstall-injector-1.1/tests/runnable/go.sh 1970-01-01 01:00:00.000000000 +0100
+++ new/zeroinstall-injector-1.2/tests/runnable/go.sh 2011-07-23 10:55:28.000000000 +0200
@@ -0,0 +1,3 @@
+#!/bin/sh
+"$PROG" var "$@"
+exec 0testprog path "$@"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/testalias.py new/zeroinstall-injector-1.2/tests/testalias.py
--- old/zeroinstall-injector-1.1/tests/testalias.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/tests/testalias.py 2011-07-23 10:55:28.000000000 +0200
@@ -9,14 +9,22 @@
from zeroinstall import alias
expected_script = """#!/bin/sh
+exec 0launch 'http://example.com/foo.xml' "$@"
+"""
+
+old_script = """#!/bin/sh
if [ "$*" = "--versions" ]; then
exec 0launch -gd 'http://example.com/foo.xml' "$@"
else
exec 0launch 'http://example.com/foo.xml' "$@"
fi
-"""
+ """
expected_script_main = """#!/bin/sh
+exec 0launch --main 'a'\\'''\\''\\test' 'http://example.com/foo.xml' "$@"
+"""
+
+old_script_main = """#!/bin/sh
if [ "$*" = "--versions" ]; then
exec 0launch -gd 'http://example.com/foo.xml' "$@"
else
@@ -51,6 +59,23 @@
tmp.flush()
tmp.seek(0)
uri, main = alias.parse_script(tmp.name)
+ self.assertEquals('http://example.com/foo.xml', uri)
+ self.assertEquals('a\'\'\\test', main)
+
+ def testParseOld(self):
+ tmp = tempfile.NamedTemporaryFile()
+ tmp.write(old_script)
+ tmp.flush()
+ tmp.seek(0)
+ uri, main = alias.parse_script(tmp.name)
+ self.assertEquals('http://example.com/foo.xml', uri)
+ self.assertEquals(None, main)
+
+ tmp = tempfile.NamedTemporaryFile()
+ tmp.write(old_script_main)
+ tmp.flush()
+ tmp.seek(0)
+ uri, main = alias.parse_script(tmp.name)
self.assertEquals('http://example.com/foo.xml', uri)
self.assertEquals('a\'\'\\test', main)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/testinstall.py new/zeroinstall-injector-1.2/tests/testinstall.py
--- old/zeroinstall-injector-1.1/tests/testinstall.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/tests/testinstall.py 2011-07-23 10:55:28.000000000 +0200
@@ -89,6 +89,10 @@
assert 'Version: 1\n' in out
assert '(not cached)' in out
+ out, err = self.run_0install(['select', 'runnable/RunExec.xml'])
+ assert not err, err
+ assert 'Runner' in out, out
+
def testDownload(self):
out, err = self.run_0install(['download'])
assert out.lower().startswith("usage:")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/testrun.py new/zeroinstall-injector-1.2/tests/testrun.py
--- old/zeroinstall-injector-1.1/tests/testrun.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/tests/testrun.py 2011-07-23 10:55:28.000000000 +0200
@@ -6,12 +6,13 @@
sys.path.insert(0, '..')
-from zeroinstall.injector import policy, run
+from zeroinstall.injector import policy, run, namespaces
from zeroinstall import SafeException
mydir = os.path.abspath(os.path.dirname(__file__))
local_0launch = os.path.join(os.path.dirname(mydir), '0launch')
runnable = os.path.join(mydir, 'runnable', 'Runnable.xml')
+runexec = os.path.join(mydir, 'runnable', 'RunExec.xml')
recursive_runner = os.path.join(mydir, 'runnable', 'RecursiveRunner.xml')
command_feed = os.path.join(mydir, 'Command.xml')
@@ -83,6 +84,24 @@
child = subprocess.Popen([local_0launch, '--', recursive_runner, 'user-arg'], stdout = subprocess.PIPE)
stdout, _ = child.communicate()
assert 'Runner: script=A test script: args=command-arg -- arg-for-runnable recursive-arg -- user-arg' in stdout, stdout
+
+ def testExecutable(self):
+ child = subprocess.Popen([local_0launch, '--', runexec, 'user-arg-run'], stdout = subprocess.PIPE)
+ stdout, _ = child.communicate()
+ assert 'Runner: script=A test script: args=foo-arg -- var user-arg-run' in stdout, stdout
+ assert 'Runner: script=A test script: args=command-arg -- path user-arg-run' in stdout, stdout
+
+ # Check runenv.py is updated correctly
+ from zeroinstall.support import basedir
+ runenv = basedir.load_first_cache(namespaces.config_site, namespaces.config_prog, 'runenv.py')
+ os.chmod(runenv, 0700)
+ with open(runenv, 'wb') as s:
+ s.write('#!/\n')
+
+ child = subprocess.Popen([local_0launch, '--', runexec, 'user-arg-run'], stdout = subprocess.PIPE)
+ stdout, _ = child.communicate()
+ assert 'Runner: script=A test script: args=foo-arg -- var user-arg-run' in stdout, stdout
+ assert 'Runner: script=A test script: args=command-arg -- path user-arg-run' in stdout, stdout
if __name__ == '__main__':
unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/tests/testselections.py new/zeroinstall-injector-1.2/tests/testselections.py
--- old/zeroinstall-injector-1.1/tests/testselections.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/tests/testselections.py 2011-07-23 10:55:28.000000000 +0200
@@ -56,9 +56,11 @@
self.assertEquals('bin', dep.bindings[0].insert)
self.assertEquals('PATH', dep.bindings[0].name)
self.assertEquals('prepend', dep.bindings[0].mode)
+ assert dep.bindings[0].separator in ';:'
self.assertEquals('bin', dep.bindings[1].value)
self.assertEquals('NO_PATH', dep.bindings[1].name)
+ self.assertEquals(',', dep.bindings[1].separator)
self.assertEquals('bin', dep.bindings[2].insert)
self.assertEquals('BINDIR', dep.bindings[2].name)
@@ -66,7 +68,7 @@
self.assertEquals(["sha1=345"], sels[0].digests)
- s1 = selections.Selections(p)
+ s1 = p.solver.selections
s1.selections['http://foo/Source.xml'].attrs['http://namespace foo'] = 'bar'
assertSel(s1)
@@ -83,7 +85,7 @@
p = policy.Policy(iface, config = self.config)
p.need_download()
assert p.ready
- s1 = selections.Selections(p)
+ s1 = p.solver.selections
xml = s1.toDOM().toxml("utf-8")
# Reload selections and check they're the same
@@ -102,7 +104,7 @@
feed.implementations = {impl.id: impl}
assert p.need_download()
assert p.ready, p.solver.get_failure_reason()
- s1 = selections.Selections(p)
+ s1 = p.solver.selections
xml = s1.toDOM().toxml("utf-8")
root = qdom.parse(StringIO(xml))
s2 = selections.Selections(root)
@@ -126,7 +128,7 @@
dep_impl = p.solver.selections[self.config.iface_cache.get_interface(dep_impl_uri)]
assert dep_impl.id == 'sha1=256'
- s1 = selections.Selections(p)
+ s1 = p.solver.selections
assert s1.commands[0].path == 'runnable/missing'
xml = s1.toDOM().toxml("utf-8")
root = qdom.parse(StringIO(xml))
@@ -143,5 +145,22 @@
dep_impl = s2.selections[dep_impl_uri]
assert dep_impl.id == 'sha1=256'
+ def testOldCommands(self):
+ command_feed = os.path.join(mydir, 'old-selections.xml')
+ with open(command_feed) as stream:
+ s1 = selections.Selections(qdom.parse(stream))
+ self.assertEquals("run", s1.command)
+ self.assertEquals(2, len(s1.commands))
+ self.assertEquals("bin/java", s1.commands[1].path)
+
+ xml = s1.toDOM().toxml("utf-8")
+ root = qdom.parse(StringIO(xml))
+ s2 = selections.Selections(root)
+
+ self.assertEquals("run", s2.command)
+ self.assertEquals(2, len(s2.commands))
+ self.assertEquals("bin/java", s2.commands[1].path)
+
+
if __name__ == '__main__':
unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/bugs.py new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/bugs.py
--- old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/bugs.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/bugs.py 2011-07-23 10:55:28.000000000 +0200
@@ -58,7 +58,7 @@
text += '\nSystem without uname()\n'
if policy.solver.ready:
- sels = selections.Selections(policy)
+ sels = policy.solver.selections
text += "\n" + sels.toDOM().toprettyxml(encoding = 'utf-8')
reporter = BugReporter(policy, iface, text)
@@ -191,7 +191,7 @@
return
from zeroinstall.injector import selections
- sels = selections.Selections(self.policy)
+ sels = self.policy.solver.selections
doc = sels.toDOM()
self.hide()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/gui.py new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/gui.py
--- old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/gui.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/gui.py 2011-07-23 10:55:28.000000000 +0200
@@ -7,7 +7,7 @@
from zeroinstall.support import tasks
from zeroinstall.injector import handler, download
-version = '1.1'
+version = '1.2'
class GUIHandler(handler.Handler):
dl_callbacks = None # Download -> [ callback ]
@@ -27,7 +27,7 @@
def downloads_changed(self):
if self.monitored_downloads and self.pulse is None:
def pulse():
- self.mainwindow.update_download_status()
+ self.mainwindow.update_download_status(only_update_visible = True)
return True
pulse()
self.pulse = gobject.timeout_add(200, pulse)
@@ -42,7 +42,7 @@
self.mainwindow.update_download_status()
def impl_added_to_store(self, impl):
- self.mainwindow.update_download_status()
+ self.mainwindow.update_download_status(only_update_visible = True)
@tasks.async
def _switch_to_main_window(self, reason):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/iface_browser.py new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/iface_browser.py
--- old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/iface_browser.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/iface_browser.py 2011-07-23 10:55:28.000000000 +0200
@@ -139,7 +139,7 @@
def walk(model, it):
while it:
- yield model[it]
+ yield it
for x in walk(model, model.iter_children(it)): yield x
it = model.iter_next(it)
@@ -326,10 +326,10 @@
done = {} # Detect cycles
+ sels = self.policy.solver.selections
+
self.model.clear()
- commands = self.policy.solver.selections.commands
- def add_node(parent, iface, command, essential):
- # (command is the index into commands, if any)
+ def add_node(parent, iface, commands, essential):
if iface in done:
return
done[iface] = True
@@ -349,7 +349,7 @@
self.model[iter][InterfaceBrowser.ICON] = self.get_icon(iface) or self.default_icon
self.model[iter][InterfaceBrowser.PROBLEM] = False
- sel = self.policy.solver.selections.selections.get(iface.uri, None)
+ sel = sels.selections.get(iface.uri, None)
if sel:
impl = sel.impl
old_impl = self.original_implementation.get(iface, None)
@@ -361,15 +361,14 @@
self.model[iter][InterfaceBrowser.DOWNLOAD_SIZE] = utils.get_fetch_info(self.policy, impl)
deps = sel.dependencies
- if command is not None:
- deps += commands[command].requires
+ for c in commands:
+ deps += sel.get_command(c).requires
for child in deps:
if isinstance(child, model.InterfaceDependency):
- if child.qdom.name == 'runner':
- child_command = command + 1
- else:
- child_command = None
- add_node(iter, iface_cache.get_interface(child.interface), child_command, child.importance == model.Dependency.Essential)
+ add_node(iter,
+ iface_cache.get_interface(child.interface),
+ child.get_required_commands(),
+ child.importance == model.Dependency.Essential)
else:
child_iter = self.model.append(parent)
self.model[child_iter][InterfaceBrowser.INTERFACE_NAME] = '?'
@@ -379,11 +378,7 @@
else:
self.model[iter][InterfaceBrowser.PROBLEM] = essential
self.model[iter][InterfaceBrowser.VERSION] = _('(problem)') if essential else _('(none)')
- if commands:
- add_node(None, self.root, 0, essential = True)
- else:
- # Nothing could be selected, or no command requested
- add_node(None, self.root, None, essential = True)
+ add_node(None, self.root, [sels.command], essential = True)
self.tree_view.expand_all()
def show_popup_menu(self, iface, bev):
@@ -440,7 +435,7 @@
assert self.original_implementation is None
self.original_implementation = self.policy.implementation.copy()
- def update_download_status(self):
+ def update_download_status(self, only_update_visible = False):
"""Called at regular intervals while there are downloads in progress,
and once at the end. Also called when things are added to the store.
Update the TreeView with the interfaces."""
@@ -456,7 +451,18 @@
selections = self.policy.solver.selections
- for row in walk(self.model, self.model.get_iter_root()):
+ # Only update currently visible rows
+ if only_update_visible and self.tree_view.get_visible_range() != None:
+ firstVisiblePath, lastVisiblePath = self.tree_view.get_visible_range()
+ firstVisibleIter = self.model.get_iter(firstVisiblePath)
+ else:
+ # (or should we just wait until the TreeView has settled enough to tell
+ # us what is visible?)
+ firstVisibleIter = self.model.get_iter_root()
+ lastVisiblePath = None
+
+ for it in walk(self.model, firstVisibleIter):
+ row = self.model[it]
iface = row[InterfaceBrowser.INTERFACE]
# Is this interface the download's hint?
@@ -490,9 +496,13 @@
row[InterfaceBrowser.DOWNLOAD_SIZE] = utils.get_fetch_info(self.policy, impl)
row[InterfaceBrowser.SUMMARY] = iface.summary
+ if self.model.get_path(it) == lastVisiblePath:
+ break
+
def highlight_problems(self):
"""Called when the solve finishes. Highlight any missing implementations."""
- for row in walk(self.model, self.model.get_iter_root()):
+ for it in walk(self.model, self.model.get_iter_root()):
+ row = self.model[it]
iface = row[InterfaceBrowser.INTERFACE]
sel = self.policy.solver.selections.selections.get(iface.uri, None)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/mainwindow.py new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/mainwindow.py
--- old/zeroinstall-injector-1.1/zeroinstall/0launch-gui/mainwindow.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/0launch-gui/mainwindow.py 2011-07-23 10:55:28.000000000 +0200
@@ -121,7 +121,7 @@
dialog.alert(self.window, _('Not all downloads succeeded; cannot run program.\n\nFailed to get:') + '\n- ' + missing)
else:
from zeroinstall.injector import selections
- sels = selections.Selections(self.policy)
+ sels = self.policy.solver.selections
doc = sels.toDOM()
reply = doc.toxml('utf-8')
sys.stdout.write(('Length:%8x\n' % len(reply)) + reply)
@@ -136,12 +136,12 @@
run_button.set_active(False)
self.report_exception(ex)
- def update_download_status(self):
+ def update_download_status(self, only_update_visible = False):
"""Called at regular intervals while there are downloads in progress,
and once at the end. Update the display."""
monitored_downloads = self.policy.handler.monitored_downloads
- self.browser.update_download_status()
+ self.browser.update_download_status(only_update_visible)
if not monitored_downloads:
self.progress_area.hide()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/__init__.py new/zeroinstall-injector-1.2/zeroinstall/__init__.py
--- old/zeroinstall-injector-1.1/zeroinstall/__init__.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/__init__.py 2011-07-23 10:55:28.000000000 +0200
@@ -13,7 +13,7 @@
@var _: a function for translating strings using the zero-install domain (for use internally by Zero Install)
"""
-version = '1.1'
+version = '1.2'
import gettext
from os.path import dirname, join
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/alias.py new/zeroinstall-injector-1.2/zeroinstall/alias.py
--- old/zeroinstall-injector-1.1/zeroinstall/alias.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/alias.py 2011-07-23 10:55:28.000000000 +0200
@@ -8,7 +8,7 @@
from zeroinstall import _
-_template = '''#!/bin/sh
+_old_template = '''#!/bin/sh
if [ "$*" = "--versions" ]; then
exec 0launch -gd '%s' "$@"
else
@@ -16,6 +16,10 @@
fi
'''
+_template = '''#!/bin/sh
+exec 0launch %s'%s' "$@"
+'''
+
class NotAnAliasScript(Exception):
pass
@@ -27,12 +31,22 @@
@raise NotAnAliasScript: if we can't parse the script
"""
stream = file(pathname)
- template_header = _template[:_template.index("-gd '")]
+ template_header = _template[:_template.index("%s'")]
actual_header = stream.read(len(template_header))
- if template_header != actual_header:
- raise NotAnAliasScript(_("'%s' does not look like a script created by 0alias") % pathname)
- rest = stream.read() # If it's a 0alias script, it should be quite short!
- line = rest.split('\n')[2]
+ stream.seek(0)
+ if template_header == actual_header:
+ # If it's a 0alias script, it should be quite short!
+ rest = stream.read()
+ line = rest.split('\n')[1]
+ else:
+ old_template_header = \
+ _old_template[:_old_template.index("-gd '")]
+ actual_header = stream.read(len(old_template_header))
+ if old_template_header != actual_header:
+ raise NotAnAliasScript(_("'%s' does not look like a script created by 0alias") % pathname)
+ rest = stream.read()
+ line = rest.split('\n')[2]
+
split = line.rfind("' '")
if split != -1:
# We have a --main
@@ -53,8 +67,8 @@
assert "\\" not in interface_uri
if main is not None:
- main_arg = "--main '%s'" % main.replace("'", "'\\''")
+ main_arg = "--main '%s' " % main.replace("'", "'\\''")
else:
main_arg = ""
- stream.write(_template % (interface_uri, main_arg, interface_uri))
+ stream.write(_template % (main_arg, interface_uri))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/cmd/select.py new/zeroinstall-injector-1.2/zeroinstall/cmd/select.py
--- old/zeroinstall-injector-1.1/zeroinstall/cmd/select.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/cmd/select.py 2011-07-23 10:55:28.000000000 +0200
@@ -131,7 +131,7 @@
select_only = select_only)
if downloaded:
tasks.wait_for_blocker(downloaded)
- sels = selections.Selections(policy)
+ sels = policy.solver.selections
return sels
@@ -158,13 +158,14 @@
def show_human(sels, stores):
from zeroinstall import zerostore
done = set() # detect cycles
- def print_node(uri, command, indent):
+ def print_node(uri, commands, indent):
if uri in done: return
done.add(uri)
impl = sels.selections.get(uri, None)
print indent + "- URI:", uri
if impl:
print indent + " Version:", impl.version
+ #print indent + " Command:", command
try:
if impl.id.startswith('package:'):
path = "(" + impl.id + ")"
@@ -174,21 +175,14 @@
path = "(not cached)"
print indent + " Path:", path
indent += " "
+
deps = impl.dependencies
- if command is not None:
- deps += sels.commands[command].requires
+ for c in commands:
+ deps += impl.get_command(c).requires
for child in deps:
- if isinstance(child, model.InterfaceDependency):
- if child.qdom.name == 'runner':
- child_command = command + 1
- else:
- child_command = None
- print_node(child.interface, child_command, indent)
+ print_node(child.interface, child.get_required_commands(), indent)
else:
print indent + " No selected version"
- if sels.commands:
- print_node(sels.interface, 0, "")
- else:
- print_node(sels.interface, None, "")
+ print_node(sels.interface, [sels.command], "")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/helpers.py new/zeroinstall-injector-1.2/zeroinstall/helpers.py
--- old/zeroinstall-injector-1.1/zeroinstall/helpers.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/helpers.py 2011-07-23 10:55:28.000000000 +0200
@@ -123,4 +123,4 @@
done = p.solve_and_download_impls()
tasks.wait_for_blocker(done)
- return selections.Selections(p)
+ return p.solver.selections
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/injector/_runenv.py new/zeroinstall-injector-1.2/zeroinstall/injector/_runenv.py
--- old/zeroinstall-injector-1.1/zeroinstall/injector/_runenv.py 1970-01-01 01:00:00.000000000 +0100
+++ new/zeroinstall-injector-1.2/zeroinstall/injector/_runenv.py 2011-07-23 10:55:28.000000000 +0200
@@ -0,0 +1,14 @@
+"""
+Helper script for <executable> bindings.
+"""
+
+# Copyright (C) 2011, Thomas Leonard
+# See the README file for details, or visit http://0install.net.
+
+import os, sys
+
+def main():
+ envname = os.path.basename(sys.argv[0])
+ import json
+ args = json.loads(os.environ["0install-runenv-" + envname])
+ os.execv(args[0], args + sys.argv[1:])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zeroinstall-injector-1.1/zeroinstall/injector/model.py new/zeroinstall-injector-1.2/zeroinstall/injector/model.py
--- old/zeroinstall-injector-1.1/zeroinstall/injector/model.py 2011-06-25 16:31:12.000000000 +0200
+++ new/zeroinstall-injector-1.2/zeroinstall/injector/model.py 2011-07-23 10:55:28.000000000 +0200
@@ -21,7 +21,7 @@
from zeroinstall.injector import qdom
# Element names for bindings in feed files
-binding_names = frozenset(['environment', 'overlay'])
+binding_names = frozenset(['environment', 'overlay', 'executable-in-path', 'executable-in-var'])
network_offline = 'off-line'
network_minimal = 'minimal'
@@ -135,6 +135,10 @@
if binding.insert is not None and binding.value is not None:
raise InvalidInterface(_("Binding contains both 'insert' and 'value'"))
return binding
+ elif e.name == 'executable-in-path':
+ return ExecutableBinding(e, in_path = True)
+ elif e.name == 'executable-in-var':
+ return ExecutableBinding(e, in_path = False)
elif e.name == 'overlay':
return OverlayBinding(e.getAttribute('src'), e.getAttribute('mount-point'))
else:
@@ -240,6 +244,12 @@
"""Information about how the choice of a Dependency is made known
to the application being run."""
+ @property
+ def command(self):
+ """"Returns the name of the specific command needed by this binding, if any.
+ @since: 1.2"""
+ return None
+
class EnvironmentBinding(Binding):
"""Indicate the chosen implementation using an environment variable."""
__slots__ = ['name', 'insert', 'default', 'mode', 'value']
@@ -293,7 +303,7 @@
else:
return old_value + self.separator + extra
- def _toxml(self, doc):
+ def _toxml(self, doc, prefixes):
"""Create a DOM element for this binding.
@param doc: document to use to create the element
@return: the new element
@@ -308,8 +318,37 @@
env_elem.setAttributeNS(None, 'value', self.value)
if self.default:
env_elem.setAttributeNS(None, 'default', self.default)
+ if self.separator:
+ env_elem.setAttributeNS(None, 'separator', self.separator)
return env_elem
+class ExecutableBinding(Binding):
+ """Make the chosen command available in $PATH.
+ @ivar in_path: True to add the named command to $PATH, False to store in named variable
+ @type in_path: bool
+ """
+ __slots__ = ['qdom']
+
+ def __init__(self, qdom, in_path):
+ self.qdom = qdom
+ self.in_path = in_path
+
+ def __str__(self):
+ return str(self.qdom)
+
+ __repr__ = __str__
+
+ def _toxml(self, doc, prefixes):
+ return self.qdom.toDOM(doc, prefixes)
+
+ @property
+ def name(self):
+ return self.qdom.getAttribute('name')
+
+ @property
+ def command(self):
+ return self.qdom.getAttribute("command") or 'run'
+
class OverlayBinding(Binding):
"""Make the chosen implementation available by overlaying it onto another part of the file-system.
This is to support legacy programs which use hard-coded paths."""
@@ -379,6 +418,10 @@
def importance(self):
return self.qdom.getAttribute("importance") or Dependency.Essential
+ def get_required_commands(self):
+ """Return a list of command names needed by this dependency"""
+ return []
+
class InterfaceDependency(Dependency):
"""A Dependency on a Zero Install interface.
@ivar interface: the interface required by this dependency
@@ -405,6 +448,24 @@
def __str__(self):
return _("