Merge lp:~philip-peitsch/quickly/apport-src-package-support into lp:quickly

Proposed by Philip Peitsch
Status: Rejected
Rejected by: Didier Roche-Tolomelli
Proposed branch: lp:~philip-peitsch/quickly/apport-src-package-support
Merge into: lp:quickly
Prerequisite: lp:~philip-peitsch/quickly/lpi-src-package-support
Diff against target: 53 lines (+32/-2)
2 files modified
data/templates/ubuntu-application/internal/bin/ubuntu-bug (+27/-0)
data/templates/ubuntu-application/run.py (+5/-2)
To merge this branch: bzr merge lp:~philip-peitsch/quickly/apport-src-package-support
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Needs Information
Review via email: mp+21311@code.launchpad.net

Description of the change

This patch creates a bin folder that is placed on the path as part of the template's run command. Inside this bin folder is an ubuntu-bug facade (fake) that simply pops up a dialog informing the user that apport integration is successful.

After looking at apport, it became quite clear that apport depends heavily a package being installed. I couldn't see any easy patches to add the functionality, and hit upon the idea of wrapping ubuntu-bug directly instead.

This is dependent on changes made to the lpi-src-package-support in order to preserve the python path modifications, and allow overriding of the subprocess's environment.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Hum, no so fan of that, but I guess we have no other choice :/
1- I would prefer having it in internal/bin of the template and not in bin/ as this dir doesn't exist*and we want it to be "internal" (as it's only available when you run quickly run, right?).
2- Sucessful -> Successful :)
3- I think sys.path.append will be better than new_env['PATH'] or sys.putenv(). IIRC, there is one which doesn't work with subprocess. You can have a look and quickly/commands.py (the launch() function IIRC)

Or, the more long-term support will be to track/add in launchpad integration some callback return to know if reporting the bug has been successfull or not (maybe not for this release, but for next one

Hope that will help!

I didn't know about this Prerequisite function of merge review! Sweet!

Revision history for this message
Philip Peitsch (philip-peitsch) wrote :

Definitely not my preferred way of integrating either... but it is better than a crash on the terminal :).

1. Sounds good... I have moved it
2. :S... whups! Fixed too
3. The difficulty is that I am essentially creating a new environment to pass to the subprocess call. sys.path and sys.putenv affect this current python process, but what I needed to do was change the env on the new one we're spawning. I had a quick poke and sys.path doesn't seem to have any affect on either env. Basically I believe this change is the only way of doing it... though if you have any other ideas I'm happy to try :)

4. I agree with regards to that. I'm thinking of improving the dialog so it simply displays a link to the +filebug url of the specified project that can be clicked on to test the functionality. Shouldn't be too much hassle... didn't want to put too many eggs into it however until you'd decided this approach was ok :). The next step is to figure out how to test apport integration hooks and things if possible...

449. By Philip Peitsch

Moving ubuntu-bug from bin to internal/bin to better hide it from the outside

450. By Philip Peitsch

Fixing mis-spelling in pop-up dialog

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Hey Philip, did you get some news from the launchpad API side?

review: Needs Information
Revision history for this message
Philip Peitsch (philip-peitsch) wrote :

This is currently blocked on bug #534968. I was never able to get the patch reviewed unfortunately.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

I think this MR doesn't apply anymore, cleaning the list :)

Unmerged revisions

450. By Philip Peitsch

Fixing mis-spelling in pop-up dialog

449. By Philip Peitsch

Moving ubuntu-bug from bin to internal/bin to better hide it from the outside

448. By Philip Peitsch

Splitting bin directory out of template root

447. By Philip Peitsch

Fixing path addition to add template directory to path

446. By Philip Peitsch

Rebasing from lpi-src changes

445. By Philip Peitsch

Adding override to quickly run command to set the LPI_PACKAGE_FILE env variable so launchpad-integration will work even if the package isn't installed

444. By Philip Peitsch

Merging trunk

443. By Philip Peitsch

Making quickly respect PYTHOPATH overrides internally

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'data/templates/ubuntu-application/internal/bin'
2=== added file 'data/templates/ubuntu-application/internal/bin/ubuntu-bug'
3--- data/templates/ubuntu-application/internal/bin/ubuntu-bug 1970-01-01 00:00:00 +0000
4+++ data/templates/ubuntu-application/internal/bin/ubuntu-bug 2010-03-15 21:07:23 +0000
5@@ -0,0 +1,27 @@
6+#!/usr/bin/python
7+
8+import sys
9+import gtk
10+
11+import gettext
12+from gettext import gettext as _
13+# set domain text
14+gettext.textdomain('quickly')
15+
16+argv = sys.argv
17+
18+project_name = None
19+if len(argv) > 1:
20+ project_name = argv[1]
21+
22+msg = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, message_format=_("Successful Apport integration"))
23+msg.set_title("Apport integration")
24+if project_name:
25+ msg.format_secondary_text(_("""Apport integration for '%s' is active.
26+Users will be able to report bugs once this package is installed."""%project_name))
27+else:
28+ msg.format_secondary_text(_("""Apport integration for this project is active.
29+Users will be able to report bugs once this package is installed."""))
30+msg.run()
31+msg.destroy()
32+
33
34=== modified file 'data/templates/ubuntu-application/run.py'
35--- data/templates/ubuntu-application/run.py 2010-03-15 21:07:22 +0000
36+++ data/templates/ubuntu-application/run.py 2010-03-15 21:07:23 +0000
37@@ -52,11 +52,14 @@
38 print _("Can't access to X server, so can't run gtk application")
39 sys.exit(1)
40
41-new_env = None
42+new_env = dict(os.environ)
43+template_bin_file = os.path.join(templatetools.get_template_path_from_project(), 'internal','bin')
44+if os.path.isdir(template_bin_file) and os.path.isfile(os.path.join(template_bin_file, 'ubuntu-bug')):
45+ new_env['PATH'] = ":".join(filter(lambda l:l, [template_bin_file, new_env.get('PATH',None)]))
46+
47 if os.path.isdir('debian'):
48 control_file = os.path.join(os.path.abspath('debian'),'control')
49 if os.path.isfile(control_file):
50- new_env = dict(os.environ)
51 new_env['LPI_PACKAGE_FILE'] = control_file
52
53 project_bin = 'bin/' + configurationhandler.project_config['project']

Subscribers

People subscribed via source and target branches