Merge lp://qastaging/~3v1n0/snappy-playpen/hello-unity-fixes into lp://qastaging/snappy-playpen

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Michael Hall
Approved revision: 52
Merged at revision: 48
Proposed branch: lp://qastaging/~3v1n0/snappy-playpen/hello-unity-fixes
Merge into: lp://qastaging/snappy-playpen
Diff against target: 523 lines
To merge this branch: bzr merge lp://qastaging/~3v1n0/snappy-playpen/hello-unity-fixes
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+294858@code.qastaging.launchpad.net

Description of the change

Fixed hello-unity, to properly build and run in snap environment.

Since the upstream code needs some patches, I've played a little with it including an example of "quilt" plugin, which allows to use quilt patches to fix upstream code (upstream fixes parially live at lp:~3v1n0/hello-unity/sandbox-support).

To post a comment you must log in.
51. By Marco Trevisan (Treviño)

HelloUnity: use cached files and user data around

52. By Marco Trevisan (Treviño)

HelloUnity: use snap version to chose which data or cache path use

Revision history for this message
Michael Hall (mhall119) wrote :

Built a snap using this, but got apparmor error when running it:

May 16 23:00:34 mhall-thinkpad kernel: [10792.749388] audit: type=1400 audit(1463457634.502:103): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.py" pid=18146 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
May 16 23:00:34 mhall-thinkpad kernel: [10792.749452] audit: type=1400 audit(1463457634.502:104): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/mhall/projects/Ubuntu/snaps/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.pyc" pid=18146 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

Revision history for this message
Michael Hall (mhall119) wrote :

Even installing with --devmode running the app fails:

mhall@mhall-thinkpad:~/projects/Ubuntu/snaps/snappy-playpen/hello-unity$ /snap/bin/hello-unity
Traceback (most recent call last):
  File "/snap/hello-unity/100001/usr/bin/hello-unity", line 4, in <module>
    __import__('pkg_resources').run_script('hello-unity==0.4', 'hello-unity')
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1496, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'hello-unity'

review: Needs Fixing
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Mhmhmh.... Wait, are you sure you installed this snap version? Because this should run /snap/hello-unity/current/opt/bin/hello-unity which is not using the run_script thing.

I also had this problem, but also desktop files should actually run
  /snap/hello-unity/current/bin/hello-unity

Which is a wrapper that eventually calls the script above

Revision history for this message
Michael Hall (mhall119) wrote :

I removed and rebuilt everything, installed with --devmode, still getting this:

mhall@mhall-thinkpad:~/projects/Ubuntu/snaps$ hello-unity
Traceback (most recent call last):
  File "/snap/hello-unity/100001/usr/bin/hello-unity", line 4, in <module>
    __import__('pkg_resources').run_script('hello-unity==0.4', 'hello-unity')
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1496, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'hello-unity'

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I get a different result. Note, I 'snap remove hello-unity' and then 'snap install ./hello-unity_0.4-snap2_amd64.snap'.

Note I didn't install it with --devmode. When I run it I see:

Traceback (most recent call last):
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/site.py", line 75, in <module>
    __boot()
  File "/snap/hello-unity/100001/usr/lib/python2.7/dist-packages/site.py", line 3, in __boot
    import os
ImportError: No module named os

and the following apparmor denials:
audit: type=1400 audit(1463513788.872:142): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/jamie/bzr-pulls/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.py" pid=31432 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
audit: type=1400 audit(1463513788.872:143): apparmor="DENIED" operation="open" profile="snap.hello-unity.hello-unity" name="/home/jamie/bzr-pulls/snappy-playpen/hello-unity/stage/usr/lib/python2.7/os.pyc" pid=31432 comm="hello-unity" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

If I do:
$ grep -r 'jamie/bzr-pulls' ./*|grep -v pyc

I see a ton of absolute paths to my snap build directory rather then the snap install directory (/snap/hello-unity/current/).

Revision history for this message
Michael Hall (mhall119) wrote :

My mistake, I messed up my bzr merge and that was causing all of the problems. I had to use --devmode, and amd also getting some apparmor denials,but the app runs and most of the Unity API use works too, approving

review: Approve
Revision history for this message
Michael Hall (mhall119) wrote :

Marco, can you propose these patches to the upstream project so I can merge them there?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Michael, sure... Changes are already in lp:~3v1n0/hello-unity/sandbox-support (I planned to get these merged upstream too), but I also wanted to use this example to show how to patch upstream code.

However, we still need to include a patch (the one that changes the name of the .desktop file), so You could still merge it and update the downstream patches accordingly (remove the first two of the serie).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches