alexlarsson/xdg-app

A little help trying to package glade

olymk2 opened this issue · 15 comments

Thought I would take a stab at building glade as an xdg app, my attempt is below but i have hit a road block.

It gets down to this bit before stopping

make[2]: Entering directory '/run/build/glade/man'
  GEN      glade.1
  GEN      glade-previewer.1
I/O error : Attempt to load network entity http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
I/O error : Attempt to load network entity http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl

I am unsure as to what the cause is, my hunch is because its sand boxed it does not have network access to fetch the file its after or that some requirement is missing from the runtime are you able to give me any hints ?

cat appdir/org.gnome.Glade.json 
{
  "app-id": "org.gnome.Glade",
  "runtime": "org.gnome.Platform",
  "runtime-version": "3.20",
  "sdk": "org.gnome.Sdk",
  "command": "glade",
  "finish-args": [ 
     "--socket=x11", 
     "--share=network", 
     "--share=ipc", 
     "--device=dri" 
  ],
  "modules": [
    {
        "name": "glade",
        "build-options":
            {
                "build-args": ["--share=network"]
            },
        "sources": [
            {
                "type": "git",
                 "url": "https://github.com/GNOME/glade.git",
                 "branch": "master"
            }
        ]
    }
   ]
}

Yeah, this means some DTD is missing and its trying to download one (and builds are sandboxed). It should have network access with that build-args though, so I don't know exactly why its failing. Another alternative is to disable docs in the build or find and bundle the required DTD.

I could not find an option to disable the docs, is there a way to end up back in the sandbox so i could try running wget or curl to confirm if its the sandbox blocking network access ?

Yes, once the build fails, run xdg-app-builder --run $the-build-dir org.gnome.Glade.json sh then go to /run/build/glade and try to run make again to see what is happening.

That works a treat, and it looks lie the sandbox is blocking it

curl http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
curl: (6) Couldn't resolve host 'docbook.sourceforge.net'

looks like it can not resolve the address, unfortunately i cant add it to /etc/hosts because its read only resolv.conf is using 8.8.8.8 to resolve so something is not quite right :/

Well, it should be able to find the docbook dtds locally. They are in the sdk. I wonder why its not finding them. Can you strace the manpage building to see where its looking for the xsl files?

Managed to get a bit further, i found --disable-man-pages option which stops it trying to download :)

  GNU nano 2.5.3                                                            File: appdir/org.gnome.Glade.json                                                                                                                               

{
  "app-id": "org.gnome.Glade",
  "runtime": "org.gnome.Platform",
  "runtime-version": "3.20",
  "sdk": "org.gnome.Sdk",
  "command": "glade",
  "finish-args": [ 
     "--socket=x11", 
     "--share=ipc", 
     "--device=dri" 
  ],
  "modules": [
    {
        "name": "glade",
        "build-options":
            {
                "build-args": ["--share=network"]
            },
        "config-opts": ["--disable-man-pages"],
        "sources": [
            {
                "type": "git",
                 "url": "https://github.com/GNOME/glade.git",
                 "branch": "master"
            }
        ]
    }
   ]
}

that gets it down to this error instead :)

make[2]: Leaving directory '/run/build/glade/help'
make[1]: Leaving directory '/run/build/glade/help'
make[1]: Entering directory '/run/build/glade'
make[2]: Entering directory '/run/build/glade'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/run/build/glade'
make[1]: Leaving directory '/run/build/glade'
stripping /opt/xdg-apps/glade/test/files/bin/glade to /opt/xdg-apps/glade/test/files/lib/debug/bin/glade.debug
error: Failed to execute child process "eu-strip" (No such file or directory)

if its useful i can still do strace if it may help figure out why the network option is not resolving
.

That means you must install elfutils on the host.

cool how does installing things on the host fix a build in a sandbox out of interest, feels like i need it installed inside the sandbox ?

also thats now built \o/ I shall test it is there a place to push it if things work correctly for others or do i have to host myself ?

Stripping the files is done outside the sandbox, because xdg-app-builder can't rely on any particular details of the sdk (it may not have e.g. elfutils).

For testing you can install from a local repo
xdg-app --user remote-add --no-gpg-verify local-repo repo
xdg-app --user install local-repo org.my.app

cheers i will give that a try and let you know later :)

That works perfectly, only change i need is to allow it to open local files so i can actually work on my projects :)

So whats my best plan if i want to make the app available for other to install ?
or could it be setup to be a nightly like some of the other apps ?

This is the final .json in case you want to add it to your nightly builds or incase some one else finds this, as i dont know where i can host this for other people.

{
  "app-id": "org.gnome.Glade",
  "runtime": "org.gnome.Platform",
  "runtime-version": "3.20",
  "sdk": "org.gnome.Sdk",
  "command": "glade",
  "finish-args": [ 
     "--socket=x11", 
     "--share=ipc", 
     "--files=any",
     "--device=dri" 
  ],
  "modules": [
    {
        "name": "glade",
            },
        "config-opts": ["--disable-man-pages"],
        "sources": [
            {
                "type": "git",
                 "url": "https://github.com/GNOME/glade.git",
                 "branch": "master"
            }
        ]
    }
   ]
}

Commited something based on this:
alexlarsson/gnome-apps-nightly@50bbeef

Great thanks a lot for that :)