ApportPkgHooks

Differences between revisions 1 and 2
Revision 1 as of 2009-08-23 19:49:20
Size: 95
Editor: pool-71-123-23-94
Comment:
Revision 2 as of 2009-09-01 20:13:55
Size: 4104
Editor: pool-71-182-107-66
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
{{{ }}} {{{
(04:03:26 PM) bdmurray: Hi, my name is Brian Murray and I'm a member of the Ubuntu QA team.
(04:03:37 PM) bdmurray: I'm here today to talk about how you can get higher quality bug reports about packages that you care about.
(04:03:51 PM) bdmurray: You can do this by writing an apport hook for your particular package.
(04:04:20 PM) bdmurray: First off, what is apport?
(04:04:32 PM) bdmurray: Apport is a system which intercepts crashes right when they happen, in development releases of Ubuntu, and gathers useful information about the crash and the operating system environment.
(04:04:45 PM) bdmurray: Additionally, it is used as a mechanism to file non-crash bug reports about software so that we receive more detailed reports.
(04:05:00 PM) bdmurray: Let's look at a sample apport bug report - http://launchpad.net/bugs/416701.
(04:05:19 PM) bdmurray: The bzr package does not have an apport hook but some useful information is still collected.
(04:05:28 PM) bdmurray: We have the architecture, the release being used, the package version and the source package name.
(04:05:42 PM) bdmurray: Additionally, in the Dependencies.txt attachment we have information about the versions of packages upon which bzr depends.
(04:06:26 PM) bdmurray: Are there any questions about apport so far?
(04:07:37 PM) bdmurray: Okay then, carrying on.
(04:07:48 PM) bdmurray: So while all of that can be really useful an apport hook for a package allows us to gather specific information for that package.
(04:08:04 PM) bdmurray: For example, consider a bug report about usplash.
(04:08:17 PM) bdmurray: usplash has a dedicated configuration file, located at "/etc/usplash.conf", and this would be something quite helpful in debugging a usplash bug report but not very useful in other package bug reports.
(04:08:35 PM) bdmurray: Apport looks for package hooks in "/usr/share/apport/package-hooks/" for ones named after the package for which they will be used.
(04:08:46 PM) bdmurray: Looking in "/usr/share/apport/package-hooks/" lets take a look at the usplash hook - with the filename usplash.py.
(04:09:13 PM) bdmurray: The package hooks are written in python.
(04:09:33 PM) bdmurray: We can see that the usplash.py hook imports the apport.hookutils module - "from apport.hookutils import *".
(04:09:47 PM) bdmurray: hookutils is a collection of readymade and safe functions for many commonly used things. There are functions for attaching a file's contents, getting a command's output, grabbing hardware information and much more.
(04:10:09 PM) bdmurray: This package hook is using 'attach_file_if_exists' and 'attach_hardware'.
(04:10:19 PM) bdmurray: 'attach_file_if_exists' is pretty self explanatory but what does attach_hardware include?
(04:10:33 PM) bdmurray: Let's look at the hookutils module to find out.
(04:10:45 PM) bdmurray: You can use "python -c 'import apport.hookutils; help(apport.hookutils)'" or you can view it using codebrowse - http://bazaar.launchpad.net/~apport-hackers/apport/trunk/annotate/head%3A/apport/hookutils.py.
(04:11:42 PM) bdmurray: he 'attach_hardware' function starts at line 72.
(04:11:57 PM) bdmurray: As we can see it adds a wide variety of hardware information to a bug report which can be quite useful for some packages like the kernel and usplash!
(04:12:24 PM) bdmurray: Having the apport package hooks has reduced the amount of bug ping pong necessary to get information out of a bug reporter and having these convenience functions reduces the amount of work it takes to write a package hook.
(04:12:56 PM) bdmurray: In addition to 'attach_hardware' and 'attach_file_if_exists' other functions include: 'attach_conffiles', 'attach_dmesg', 'attach_alsa', 'command_output', 'recent_syslog', 'pci_devices' and 'attach_related_packages'.
(04:13:21 PM) bdmurray: In the event that you have a group of packages that would benefit from a shared convenience function, please file a bug about apport and include the function you'd like added.
...
}}}

Dev Week -- Writing Apport Package Hooks -- bdmurray -- Tue Sep 1st, 2009

UTC

(04:03:26 PM) bdmurray: Hi, my name is Brian Murray and I'm a member of the Ubuntu QA team.
(04:03:37 PM) bdmurray: I'm here today to talk about how you can get higher quality bug reports about packages that you care about.
(04:03:51 PM) bdmurray: You can do this by writing an apport hook for your particular package.
(04:04:20 PM) bdmurray: First off, what is apport?
(04:04:32 PM) bdmurray: Apport is a system which intercepts crashes right when they happen, in development releases of Ubuntu, and gathers useful information about the crash and the operating system environment.
(04:04:45 PM) bdmurray: Additionally, it is used as a mechanism to file non-crash bug reports about software so that we receive more detailed reports.
(04:05:00 PM) bdmurray: Let's look at a sample apport bug report - http://launchpad.net/bugs/416701.
(04:05:19 PM) bdmurray: The bzr package does not have an apport hook but some useful information is still collected.
(04:05:28 PM) bdmurray: We have the architecture, the release being used, the package version and the source package name.
(04:05:42 PM) bdmurray: Additionally, in the Dependencies.txt attachment we have information about the versions of packages upon which bzr depends.
(04:06:26 PM) bdmurray: Are there any questions about apport so far?
(04:07:37 PM) bdmurray: Okay then, carrying on.
(04:07:48 PM) bdmurray: So while all of that can be really useful an apport hook for a package allows us to gather specific information for that package.
(04:08:04 PM) bdmurray: For example, consider a bug report about usplash.
(04:08:17 PM) bdmurray: usplash has a dedicated configuration file, located at "/etc/usplash.conf", and this would be something quite helpful in debugging a usplash bug report but not very useful in other package bug reports.
(04:08:35 PM) bdmurray: Apport looks for package hooks in "/usr/share/apport/package-hooks/" for ones named after the package for which they will be used.
(04:08:46 PM) bdmurray: Looking in "/usr/share/apport/package-hooks/" lets take a look at the usplash hook - with the filename usplash.py.
(04:09:13 PM) bdmurray: The package hooks are written in python.
(04:09:33 PM) bdmurray: We can see that the usplash.py hook imports the apport.hookutils module - "from apport.hookutils import *".
(04:09:47 PM) bdmurray: hookutils is a collection of readymade and safe functions for many commonly used things.  There are functions for attaching a file's contents, getting a command's output, grabbing hardware information and much more.
(04:10:09 PM) bdmurray: This package hook is using 'attach_file_if_exists' and 'attach_hardware'.
(04:10:19 PM) bdmurray: 'attach_file_if_exists' is pretty self explanatory but what does attach_hardware include?
(04:10:33 PM) bdmurray: Let's look at the hookutils module to find out.
(04:10:45 PM) bdmurray: You can use "python -c 'import apport.hookutils; help(apport.hookutils)'" or you can view it using codebrowse - http://bazaar.launchpad.net/~apport-hackers/apport/trunk/annotate/head%3A/apport/hookutils.py.
(04:11:42 PM) bdmurray: he 'attach_hardware' function starts at line 72.
(04:11:57 PM) bdmurray: As we can see it adds a wide variety of hardware information to a bug report which can be quite useful for some packages like the kernel and usplash!
(04:12:24 PM) bdmurray: Having the apport package hooks has reduced the amount of bug ping pong necessary to get information out of a bug reporter and having these convenience functions reduces the amount of work it takes to write a package hook.
(04:12:56 PM) bdmurray: In addition to 'attach_hardware' and 'attach_file_if_exists' other functions include: 'attach_conffiles', 'attach_dmesg', 'attach_alsa', 'command_output', 'recent_syslog', 'pci_devices' and 'attach_related_packages'.
(04:13:21 PM) bdmurray: In the event that you have a group of packages that would benefit from a shared convenience function, please file a bug about apport and include the function you'd like added.
...

MeetingLogs/devweek0909/ApportPkgHooks (last edited 2011-02-24 13:30:26 by host86-180-154-18)