Handling update-alternatives

2016-08-05 Thread Dan Watkins
Hello all,

Something I'm snapping tries to run `awk`, which isn't included in the
ubuntu-core snap.  As such, I added gawk to stage-packages for my part:

  parts:
thing:
  ...
  stage-packages:
- gawk

Unfortunately, it didn't occur to me that awk is actually provided by
update-alternatives, so just staging the package didn't provide me with
`awk` on the PATH.  It took me a few confusing build/examine iteration
to realise what was going on, which lead to me adding:

  parts:
thing:
  ...
  stage-packages:
- gawk
  organize:
usr/bin/gawk: usr/bin/awk


This seems like a real wrinkle in the snapping experience; I both had to
work out what the problem was, and then hack around it in a slightly
uncomfortable way.  What can we do to iron this out?

My first thought was to add an `awk` part, which would allow you to
specify the way in which you wanted awk to be provided (i.e. "this
Ubuntu package", "build from this source") and ensure that awk would end
up in the PATH of other things in the snap.

My second thought was that creating a custom part for every Ubuntu
package that uses update-alternatives is quite a lot of overhead.  It's
probably impractical, but parsing packages as they are staged to do just
the `update-alternatives` step would be pretty cool.

What do people think?


Cheers,

Dan



signature.asc
Description: OpenPGP digital signature
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Handling update-alternatives

2016-08-05 Thread Evan Dandrea
On Fri, 5 Aug 2016 at 10:21 Dan Watkins 
wrote:

> My first thought was to add an `awk` part, which would allow you to
> specify the way in which you wanted awk to be provided (i.e. "this
> Ubuntu package", "build from this source") and ensure that awk would end
> up in the PATH of other things in the snap.
>

I'd create a part that builds awk from source, then add it to
https://wiki.ubuntu.com/Snappy/Parts so others can benefit from your work
(`snapcraft define awk`).

My understanding of stage-packages is that it helps us until we have a
diverse parts ecosystem.
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Handling update-alternatives

2016-08-05 Thread John Lenton
On 5 August 2016 at 10:20, Dan Watkins  wrote:
> Something I'm snapping tries to run `awk`, which isn't included in the
> ubuntu-core snap

awk *is* in the ubuntu-core snap. What's happening is bug #1580018:
you've used update-alternatives on the host to switch to an awk that
is different to the one in core. If you can live with mawk instead of
gawk on the host (at least during the build) things will work.

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Handling update-alternatives

2016-08-05 Thread Dan Watkins
On 05/08/16 11:00, John Lenton wrote:
> On 5 August 2016 at 10:20, Dan Watkins  wrote:
>> Something I'm snapping tries to run `awk`, which isn't included in the
>> ubuntu-core snap
> 
> awk *is* in the ubuntu-core snap. What's happening is bug #1580018:
> you've used update-alternatives on the host to switch to an awk that
> is different to the one in core. If you can live with mawk instead of
> gawk on the host (at least during the build) things will work.

The snapped program calls /usr/bin/awk at runtime, so I'd presumably
need mawk to be installed in the host at runtime as well?

(AIUI, /usr/bin/awk is a symlink to /etc/alternatives/awk which gets
resolved against the host's /etc.  The host's /etc/alternatives/awk
points at /usr/bin/[gm]awk which is then resolved against the snap's
view of the world.)



signature.asc
Description: OpenPGP digital signature
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Handling update-alternatives

2016-08-05 Thread John Lenton
On 5 August 2016 at 11:25, Dan Watkins  wrote:
>
> The snapped program calls /usr/bin/awk at runtime, so I'd presumably
> need mawk to be installed in the host at runtime as well?

core has mawk, but not gawk. snaps run with the host's
/etc/alternatives but core's /usr.

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Handling update-alternatives

2016-08-05 Thread Didier Roche
Le 05/08/2016 à 12:25, Dan Watkins a écrit :
> On 05/08/16 11:00, John Lenton wrote:
>> On 5 August 2016 at 10:20, Dan Watkins  wrote:
>>> Something I'm snapping tries to run `awk`, which isn't included in the
>>> ubuntu-core snap
>> awk *is* in the ubuntu-core snap. What's happening is bug #1580018:
>> you've used update-alternatives on the host to switch to an awk that
>> is different to the one in core. If you can live with mawk instead of
>> gawk on the host (at least during the build) things will work.
> The snapped program calls /usr/bin/awk at runtime, so I'd presumably
> need mawk to be installed in the host at runtime as well?
>
> (AIUI, /usr/bin/awk is a symlink to /etc/alternatives/awk which gets
> resolved against the host's /etc.  The host's /etc/alternatives/awk
> points at /usr/bin/[gm]awk which is then resolved against the snap's
> view of the world.)

I think that's something which could be fixed again by the request in
https://bugs.launchpad.net/ubuntu/+source/snapcraft/+bug/1583250/ as the
path is hardcoded in your program to redirect to the actual binary in $SNAP.
It seems that Gustavo missed my last ping on "Trying to package angband
as snap" topic (same ML) where this is referenced as well. Maybe I'll be
luckier this time :)

Cheers,
Didier

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Getting QT apps running.

2016-08-05 Thread Dietmar Winkler
Hi,

so I finally spend some time again on this. Since I could not get the
menus to work under standard Ubuntu Unity 16.04 I thought maybe it's
not the snap but something that does not agree within the desktop
manager.

So I simply installed ubuntu-mate-desktop and logged into standard mate.

Then I rebuild the IPE application with three variants of plugs. I.e., in

https://github.com/dietmarw/snaps/blob/master/ipe/snapcraft.yaml#L59

With:
1.   plugs: [x11, home]
2.   plugs: [unity7, home]
3.   plugs: [x11, unity7, home]

The result? ALL of those build worked flawlessly under Ubuntu Mate
whilst under standard Ubuntu Unity (on the very same machine I get:

1.   plugs: [x11, home]> ipe doesn't launch but also no errors in
the terminal
2.   plugs: [unity7, home] > ipe launches without menu
3.   plugs: [x11, unity7, home]  > ipe launches without menu

Since ipe doesn't use any unity speciific stuff the right plug should
actually be simply x11 (and as the FAQ pointed out
https://github.com/otfried/ipe-wiki/wiki/FAQ#ipe-doesnt-work-correctly-on-ubuntu
even when run natively one needs to remove the appmenu-qt5 package to
get the menu).

Question that still stands is why although appmenu-qt5 is NOT present,
IPE would run when natively compiled (also under Unity) but only under
non-unity desktop when build as a snap.

Any idea how to explain this behaviour?

/Dietmar/



On 29 July 2016 at 16:01, Dietmar Winkler  wrote:
> Thanks for the pointer. Reading through the documentation of
> desktop-helper again I noticed that I might actually try the x11 plug
> instead of unity7 since it is the appmenu that causes problems in the
> first place.
>
> But now ipe would not launch at all. Also I don't get any error
> messages (apart from the Gtk warnings).
>
> Are there any debug logs I could search for to see what is getting stuck?
>
>
>
> On 29 July 2016 at 15:34, Joe Talbott  wrote:
>> Note the remote parts are now at https://wiki.ubuntu.com/snapcraft/parts
>>
>> Cheers,
>> Joe
>>
>> On Fri, Jul 29, 2016 at 8:53 AM, Dietmar Winkler  
>> wrote:
>>> Seting the rests of the paths helped. I now have icons. The menu is
>>> still missing which reminded me that there currently is an issue with
>>> appmenu-qt5 which when naively compiled causes some keyboard shortcuts
>>> not to work.
>>> https://github.com/otfried/ipe-wiki/wiki/FAQ#ipe-doesnt-work-correctly-on-ubuntu
>>>
>>> I was wondering if it is possible to generate a variant of desktop/qt5
>>> without appmenu-qt5 staged.
>>>
>>> I've found the definition here: https://wiki.ubuntu.com/Snappy/Parts
>>> but would still need the source to point to.
>>>
>>> --
>>> /Dietmar/
>>>
>>> Secure email communication:
>>> https://encrypt.to/dietmar.wink...@dwe.no
>>> Public OpenPGP key: 0x235E6689
>>>
>>> --
>>> Snapcraft mailing list
>>> Snapcraft@lists.snapcraft.io
>>> Modify settings or unsubscribe at: 
>>> https://lists.ubuntu.com/mailman/listinfo/snapcraft
>
>
>
> --
> /Dietmar/
>
> Secure email communication:
> https://encrypt.to/dietmar.wink...@dwe.no
> Public OpenPGP key: 0x235E6689



-- 
/Dietmar/

Secure email communication:
https://encrypt.to/dietmar.wink...@dwe.no
Public OpenPGP key: 0x235E6689

-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: ntopng strict snap published

2016-08-05 Thread Blake Rouse
Already have pull request into the project.

https://github.com/ntop/ntopng/pull/676

ntopng is a reserved name in the snappy store, so I don't know the process
of getting an account that can have access to that name. Allowing them to
publish under the correct name.

On Fri, Aug 5, 2016 at 1:55 AM, Didier Roche  wrote:

> Le 04/08/2016 à 17:40, Blake Rouse a écrit :
> > I have created a ntopng snap for the dev branch of ntopng. The snap
> > works in strict mode once you connect it to the network-control
> > interface. I currently registered the snap as ntopng-blake as ntopng
> > is a reserved name. Let me know what you think.
> >
> > sudo snap install ntopng-blake
> > sudo snap connect ntopng-blake:network-control
> ubuntu-core:network-control
> > sudo systemctl restart snap.ntopng-blake.ntopng.service
> >
> > Login - http://localhost:3000
> > User - admin
> > Pass - admin
> >
> > A couple things that would improve this snap are:
> >
> > 1. I need the ntopng service to start after the redis service.
> > Currently in the ntopng service it loops until it can connect to redis
> > and then spawns the ntopng process. It would be nice to say in
> > snapcraft start this service after this other service has started.
> >
> > 2. Since network-control interface is a reserved interface you have to
> > manually restart the service once the connection is made. It would be
> > nice to say in snapcraft that this service should be restarted once
> > the connection is made. Even better would be don't start this service
> > until this connection is made.
> >
> > Overall this is an awesome way of getting ntopng running on your
> > system, directly from tip of dev.
> >
> > ntopng - https://github.com/ntop/ntopng
> > ntopng-snap - https://github.com/blakerouse/ntopng-snap
>
> Excellent work Blake!
>
> Do you think there is any chance that you propose it to upstream for
> merging your snapcraft.yaml to their upstream tree?
> Cheers,
> Didier
>
> --
> Snapcraft mailing list
> Snapcraft@lists.snapcraft.io
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/snapcraft
>
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft


Re: Handling update-alternatives

2016-08-05 Thread Steve Langasek
On Fri, Aug 05, 2016 at 09:33:42AM +, Evan Dandrea wrote:
> On Fri, 5 Aug 2016 at 10:21 Dan Watkins 
> wrote:

> > My first thought was to add an `awk` part, which would allow you to
> > specify the way in which you wanted awk to be provided (i.e. "this
> > Ubuntu package", "build from this source") and ensure that awk would end
> > up in the PATH of other things in the snap.

> I'd create a part that builds awk from source, then add it to
> https://wiki.ubuntu.com/Snappy/Parts so others can benefit from your work
> (`snapcraft define awk`).

> My understanding of stage-packages is that it helps us until we have a
> diverse parts ecosystem.

My understanding is that we have a rich repository of pre-built binaries
that can be used via the stage-packages mechanism, that we should take
advantage of wherever it makes sense instead of forcing rebuilds from source
of standard Unix tools ;)

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
Ubuntu Developerhttp://www.debian.org/
slanga...@ubuntu.com vor...@debian.org


signature.asc
Description: PGP signature
-- 
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft