Re: Weird errors when playing with 0compile

Thomas Leonard <[email protected]> Sat, 11 Jun 2022 14:51:11 +0000
Newsgroups gmane.comp.file-systems.zero-install.devel
Message-ID <CAG4opy9pzOjS1iMQGf4vnPyrBUYt5aAMXzn1wzw2F5JQLejsSg@mail.gmail.com>
On Mon, 6 Jun 2022 at 12:06, Bastian Eicher <[email protected]> wrote:
>
> Hi Mateusz,
>
> I just gave it a try and can reproduce the same error on my machine.
>
> On Windows tools like 0compile and 0template internally call "0install fetch" and pass via stdin a partial feed containing implementations to be downloaded.
> The relevant code is here: https://github.com/0install/0install/blob/b2.3/zeroinstall/injector/fetch.py#L697-L715

> In this case the feed XML being passed looks like this:>
> <interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
[...]
>             <ns0:implementation arch="Windows-x86_64">
>                 <command name="run" path="pikchr.exe"/>
>             </ns0:implementation>
>         </command>
>
> <ns0:implementation> seems to be the problem here. This is the implementation that 0compile wants to build, so there is nothing to download. Also, the "ns0" XML prefix is undeclared, causing "0install fetch" to reject the feed.
>
> @Thomas Can we prevent 0compile from including the implementation being built in the list of fetched implementations?

It's not asking for it to be fetched - that's why it's in a different namespace.

> I don't quite understand where the "ns0" XML prefix is coming from.

_download_with_external_fetcher is using Prefixes to collect a list of
prefixes it needs to define, but then it never adds them to the
document! See Selections.toDOM for how to do that.

From the command-line it works.

With the old Python version, I get:

$ ./0install select --xml --os=Windows --source ./pikchr.xml
<?xml version="1.0"?>
<selections xmlns="http://zero-install.sourceforge.net/2004/injector/interface"
            xmlns:ns0="http://zero-install.sourceforge.net/2006/namespaces/0compile"
            interface="/tmp/pikchr.xml"
            command="compile">
[...]
      <ns0:implementation arch="Windows-x86_64">
        <command name="run" path="pikchr.exe"/>
      </ns0:implementation>

(i.e. it uses ns0, but defines it at the start)

With the current OCaml version, I get:

$ 0install select --xml --os=Windows --source ./pikchr.xml
<?xml version="1.0" encoding="UTF-8"?>
<selections command="compile" interface="/tmp/pikchr.xml" source="true"
    xmlns:compile="http://zero-install.sourceforge.net/2006/namespaces/0compile"
    xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
[...]
      <compile:implementation arch="Windows-x86_64">
        <command name="run" path="pikchr.exe"/>
      </compile:implementation>


-- 
talex5 (GitHub/Twitter)
http://roscidus.com/blog/