Re: 0compile: pretty_print_plan fails with KeyError for non-OS selections
Thomas Leonard <[email protected]>
| Newsgroups | gmane.comp.file-systems.zero-install.devel |
|---|---|
| Message-ID | <CAG4opy8SWMp9CJz8ycXOR2WMMZu1HA8ZkyjNQZ6KpYxxyrKhjw@mail.gmail.com> |
On 18 March 2015 at 23:42, Tim Cuthbertson <[email protected]> wrote: > For my nodejs source feed, it <requires> gcc_c++ with arch="Linux", > since I don't have a feed for gcc on OSX (you just have to make sure > you have the xcode tools). > > On a mac, I get: > > $ 0install run http://0install.net/2006/interfaces/0compile.xml > autocompile http://gfxmonk.net/dist/0install/node.js.xml > =============== http://gfxmonk.net/dist/0install/node.js.xml =============== > > Selecting versions for node.js... > Selection done. > > Plan: > > - node.js: Compile 0.10.37 (sha1new=1f4acb3bc4749c7aaafe9757f09c341386a816dd) > Traceback (most recent call last): > File "/Users/test/.cache/0install.net/implementations/sha256new_V3EKZQ5AWLF64GJ6QZ5AQLZEWV7ZWONFZ6JNC4DE2RUIBXEBJ2CQ/0compile", > line 78, in <module> > matches[0](args[1:]) > File "/Users/test/.cache/0install.net/implementations/sha256new_V3EKZQ5AWLF64GJ6QZ5AQLZEWV7ZWONFZ6JNC4DE2RUIBXEBJ2CQ/autocompile.py", > line 586, in do_autocompile > compiler.build() > File "/Users/test/.cache/0install.net/implementations/sha256new_V3EKZQ5AWLF64GJ6QZ5AQLZEWV7ZWONFZ6JNC4DE2RUIBXEBJ2CQ/autocompile.py", > line 363, in build > tasks.wait_for_blocker(self.recursive_build(self.iface_uri)) > File "/Users/test/.cache/0install.net/implementations/sha256new_DQ5LNKJ5NVYFL5UQWV7S2NLHWI4TUXDZCZZI65L5YKHEHNVNVSLA/zeroinstall/support/tasks.py", > line 501, in wait_for_blocker > check(blocker) > File "/Users/test/.cache/0install.net/implementations/sha256new_DQ5LNKJ5NVYFL5UQWV7S2NLHWI4TUXDZCZZI65L5YKHEHNVNVSLA/zeroinstall/support/tasks.py", > line 175, in check > support.raise_with_traceback(ex[0], ex[1]) > File "/Users/test/.cache/0install.net/implementations/sha256new_DQ5LNKJ5NVYFL5UQWV7S2NLHWI4TUXDZCZZI65L5YKHEHNVNVSLA/zeroinstall/support/__init__.py", > line 105, in raise_with_traceback > exec("raise ex, None, tb", {'ex': ex, 'tb': tb}) # Python 2 > File "/Users/test/.cache/0install.net/implementations/sha256new_DQ5LNKJ5NVYFL5UQWV7S2NLHWI4TUXDZCZZI65L5YKHEHNVNVSLA/zeroinstall/support/tasks.py", > line 374, in _resume > new_blockers = next(self.iterator) > File "/Users/test/.cache/0install.net/implementations/sha256new_V3EKZQ5AWLF64GJ6QZ5AQLZEWV7ZWONFZ6JNC4DE2RUIBXEBJ2CQ/autocompile.py", > line 304, in recursive_build > self.pretty_print_plan(d.solver, r.interface_uri) > File "/Users/test/.cache/0install.net/implementations/sha256new_V3EKZQ5AWLF64GJ6QZ5AQLZEWV7ZWONFZ6JNC4DE2RUIBXEBJ2CQ/autocompile.py", > line 154, in pretty_print_plan > self.pretty_print_plan(solver, x.interface, indent) > File "/Users/test/.cache/0install.net/implementations/sha256new_V3EKZQ5AWLF64GJ6QZ5AQLZEWV7ZWONFZ6JNC4DE2RUIBXEBJ2CQ/autocompile.py", > line 135, in pretty_print_plan > impl = solver.selections[iface] > File "/Users/test/.cache/0install.net/implementations/sha256new_DQ5LNKJ5NVYFL5UQWV7S2NLHWI4TUXDZCZZI65L5YKHEHNVNVSLA/zeroinstall/injector/selections.py", > line 454, in __getitem__ > sel = self.selections[key.uri] > KeyError: u'http://gfxmonk.net/dist/0install/gcc-c.xml' > > > Ignoring the KeyError in pretty_print_plan makes it work - so it's > just an issue with the diagnostics, the rest of 0compile handles this > case fine. > > I'm not sure how best to fix this though - should we ignore the > KeyError entirely, or do a check for some property on the > `impl.requires` element to determine whether it _should_ be present? I think it should be "solver.requires[iface]" (the selected dependencies) not "impl.requires" (the dependencies listed in the feed). Try this: https://github.com/0install/0compile/commit/bca481ac562ebd54b6d57caef4cd28ca821c39d5 -- Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/