Bughelper

Dev Week -- Bughelper - Making Bug Work Easier -- Brian Murray, Markus Korn -- Thu, Feb 21

(01:02:29 PM) bdmurray: Hello thekorn and I develop the bughelper suite and python-launchpad-bugs and wanted to tell you about how they can help you work with bug reports.
(01:02:35 PM) Grazieno: bdmurray: yes, sure!
(01:02:58 PM) bdmurray: If you want to tryout the examples we provide in our session, please install bughelper and python-launchpad-bugs. Some of the examples will only work with the latest versions of this tools.
(01:03:33 PM) bdmurray: thekorn has setup a ppa for the latest version of them and you can get them by adding     *
(01:03:37 PM) bdmurray: thekorn has setup a ppa for the latest version of them and you can get them by adding           deb [WWW] http://ppa.launchpad.net/bughelper-dev/ubuntu hardy main
(01:03:56 PM) bdmurray: to your /etc/apt/sources.list, and replace 'hardy' with the version of ubuntu you use
(01:04:29 PM) bdmurray: Then you can should update via 'sudo apt-get update' and install bughelper and python-launchpad-bugs
(01:05:10 PM) thekorn: pranith asked: 'what all packages do we need to install to get started?'
(01:05:10 PM) bdmurray: So what is python-launchpad-bugs?  It is a python interface to work with bugs, and blueprints to a degree, in Launchpad.
(01:05:20 PM) thekorn: sorry ;)
(01:06:13 PM) bdmurray: You should install bughelper and python-launchpad-bugs to get started.
(01:06:42 PM) bdmurray: Bughelper is a suite of utilies that uses python-launchpad-bugs to help you find specific bugs in Launchpad.
(01:06:56 PM) bdmurray: We'll start off talking about the bughelper suite and then move on to python-launchpad-bugs.
(01:07:17 PM) bdmurray: The bughelper suite has 3 main applications - buginfo, bugnumbers and bughelper
(01:07:41 PM) bdmurray: buginfo is designed for reporting information about one specifc bug
(01:07:55 PM) bdmurray: for example 'buginfo --title 38442' will return the bugs title
(01:08:59 PM) bdmurray: While bugnumbers is designed for returning a list of bugs based off a query in launchpad
(01:09:40 PM) bdmurray: Starting points for a query include '-p' for a package in Ubuntu, '-l' for a url of a search in Launchpad
(01:10:13 PM) bdmurray: Or now you can search a whole distribution using '-D' or an upstream project using '-P'
(01:10:49 PM) bdmurray: Using those starting points you can then filter using features in Launchpad (bug status and importance) and some not in Launchpad
(01:11:20 PM) bdmurray: some features not in Launchpad are querying on the quantity of duplicates, subscribers, comments, attachments
(01:11:36 PM) bdmurray: in addition to the date or author of the last comment or the bug reporter
(01:11:52 PM) bdmurray: For example lets say I'm the gdm maintainer and I know Brian Murray reports some useful bug reports I could find all the bugs he's reported using 'bugnumbers -p gdm --reporter=brian-murray' or if I wanted just the new ones I could add that as a filter too so 'bugnumbers -p gdm --reporter=brian-murray --status New'
(01:12:23 PM) bdmurray: Another example is xorg bug reports which should always contain 2 attachments /etc/X11/xorg.conf and /var/log/Xorg.0.log. We could look for New bug reports with more than 1 attachment using 'bugnumbers -p xorg --na ">1"' to find "more complete" bug reports that might be worth triaging first.
(01:13:02 PM) bdmurray: I run reports on busy packages for bugs with more than 2 duplicates, more than 5 subscribers and more than 5 comments at http://people.ubuntu.com/~brian/reports/
(01:13:57 PM) bdmurray: Additionally, you can modify the output of bugnumbers - formats available include just the bug numbers, urls, moinmoin wiki markup, html to name a few
(01:14:33 PM) bdmurray: You can also check out statistics for your package via 'bugnumbers -p gnome-power-manager --stats -C' where -C includes closed bug reports
(01:14:55 PM) bdmurray: Are there any questions about buginfo or bugnumbers?
(01:16:03 PM) phoenix24_: bdmurray: QUESTION: Do the "bughelper python-launchpad-bugs" support Proxy Server ?
(01:16:38 PM) bdmurray: thekorn: Do you know the answer to that?
(01:16:58 PM) thekorn: phoenix24_, I did not try it with the latest code,
(01:17:08 PM) thekorn: but we had a bugreport on this in the past
(01:17:15 PM) thekorn: but I'm not sure
(01:17:36 PM) Grazieno: bdmurray: I think does not works
(01:18:17 PM) bdmurray: Okay, we'll look into that then.  Anything else?
(01:19:11 PM) yuriy: bdmurray: QUESTION: could you elaborate on the usage of -l? what urls can you/ are you supposed to give it?
(01:20:54 PM) bdmurray: yuriy: you can give it any valid search in Launchpad.  Let's say we wanted to find bugs tagged apport-bug with more than 2 attachments.  We could use 'bugnumbers -l <lpsearch> --na ">2"'
(01:21:33 PM) bdmurray: It'd be useful to use a url search in this case because those bugs be reported about multiple packages.
(01:22:08 PM) bdmurray: So your starting point really depends on the scope of bug reports you want to find.
(01:22:29 PM) yuriy: bdmurray: so you would just search whatever you want on launchpad, then copy/paste the resulting URL?
(01:23:17 PM) bdmurray: yuriy: that's correct the advantage here is that you could have it then output into html or moinmoin markup or add an additional filter that doesn't exist in launchpad
(01:23:29 PM) bdmurray: Does that help?
(01:23:34 PM) yuriy: bdmurray: yeah, thanks
(01:24:07 PM) yuriy: bdmurray: QUESTION: is there API documentation online for python-launchpad?
(01:24:23 PM) bdmurray: yuriy: yes, we'll get to that shortly
(01:24:24 PM) bdmurray: moving on
(01:24:54 PM) bdmurray: bughelper, the application, searches bug reports and attachments for a specific string and provides with a clue about that bug
(01:25:00 PM) emgent`work is now known as emgent
(01:25:26 PM) bdmurray: clue files use a separate bzr branch bughelper-data and are stored on your local disk in ~/.bughelper/packages
(01:25:51 PM) bdmurray: this is a separate project in Launchpad - https://code.launchpad.net/bughelper-data/ and anyone in the bugsquad can add clues for packages so feel free to add clues for your package
(01:26:07 PM) bdmurray: et's have a look at '~/.bughelper/packages/bughelper.info' as an example
(01:26:24 PM) bdmurray: this file is also online at http://tinyurl.com/2zwm7a
(01:26:38 PM) bdmurray: as you can see clue-file are in a xml format and can contain multiple clues
(01:27:06 PM) bdmurray: you can combine operations by using logical operators like 'and' or 'or'
(01:27:33 PM) bdmurray: this is done in the "contains" portion of the clue file
(01:27:47 PM) bdmurray: Regular Expressions are also supported as you can see in the first clue, this clue matches all bugs with 'importance' set to 'Undecided' and which are tagged with 'xpath' or 'commandline'
(01:28:28 PM) bdmurray: When a bug with those attributes are found we'll be presented with the hint in <info>
(01:29:01 PM) bdmurray: This can be useful for finding duplicate bug reports or managing bug workflow
(01:29:29 PM) bdmurray: So a crash report might have a specifc string in it and we can search all bug reports in a package for that string
(01:29:49 PM) bdmurray: Or the kernel team wants confirmed or triaged bugs assigned to a specific team
(01:29:54 PM) pranith: bdmurray, QUESTION: can you give us an example so that we can see it live?
(01:30:23 PM) bdmurray: Here is the output of a matched clue:
(01:30:43 PM) bdmurray: http://launchpad.net/bugs/191834 [update-manager (Ubuntu): New/Undecided] - This is expected when someone is running a development release of Ubuntu
(01:31:09 PM) bdmurray: We are presented with a link to the matched bug report and a hint as to what the issue might be
(01:31:35 PM) bdmurray: pranith: Is that what you are looking for?
(01:32:21 PM) bdmurray: Writing clue files is a way for us to easily share our knowledge with other bug triagers
(01:32:22 PM) pranith: bdmurray, how do i get this bug report using bughelper?
(01:32:40 PM) pranith: bdmurray, ok
(01:32:44 PM) pranith: bdmurray, i got it now
(01:32:50 PM) bdmurray: pranith: via 'bughelper -p <package>'
(01:33:22 PM) bdmurray: you can add additional filters too like if you only wanted to search new bugs for a specific string
(01:33:38 PM) bdmurray: that would be 'bughelper -p <package> --status New'
(01:33:59 PM) pranith: bdmurray, thanks, i got it
(01:34:01 PM) bdmurray: We have time for one more question about bughelper before moving on to python-launchpad-bugs
(01:35:15 PM) bdmurray: I'll hand it over to thekorn then
(01:35:34 PM) thekorn: ok, let's have a deeper look at
(01:35:39 PM) thekorn: == python-launchpad-bugs ==
(01:35:46 PM) thekorn:  
(01:35:55 PM) thekorn: python-launchpad-bugs allows you to access bugs.launchpad.net via python. This python module is used by many tools like apport, ubuntu-dev-tools and of course bughelper and bugnumbers.
(01:36:12 PM) thekorn:  
(01:36:18 PM) thekorn: Let me give you a short "Howto" on using python-launchpad-bugs. This requires some basic understanding of python.
(01:36:29 PM) thekorn:  
(01:36:36 PM) thekorn: Let's start a python session and do some general preparation:
(01:36:43 PM) thekorn:     >>> import launchpadbugs.connector as Connector
(01:37:00 PM) thekorn:     >>> from launchpadbugs.basebuglistfilter import URLBugListFilter
(01:37:17 PM) thekorn:  
(01:37:20 PM) thekorn: Ok, so far so good, let's get a list of all open bugs in the bughelper project
(01:37:36 PM) thekorn:     >>> BugList = Connector.ConnectBugList()
(01:37:50 PM) thekorn:     >>> bl = BugList("https://bugs.launchpad.net/bughelper/+bugs")
(01:38:07 PM) thekorn: Each member of this list has attributes like 'bugnumber', 'url', 'status' and 'importance'.
(01:38:21 PM) thekorn:  
(01:38:34 PM) thekorn: Getting filtered lists is also very easy:
(01:38:52 PM) thekorn:     >>> bug_filter = URLBugListFilter()
(01:39:09 PM) thekorn:     >>> bug_filter.add_option("status", ("New","Confirmed"))
(01:39:43 PM) thekorn:     >>> bug_filter.add_option("importance", ("Medium",))
(01:39:56 PM) thekorn:     >>> bl = BugList(bug_filter("https://bugs.launchpad.net/bughelper/+bugs"))
(01:40:07 PM) thekorn: It's also possible to use any python functions as a filter, but this would go too far right now.
(01:40:20 PM) thekorn:  
(01:41:01 PM) thekorn: any questions so far?
(01:41:29 PM) pranith: thekorn, this is how the bughelper gets the list of bugs?
(01:42:06 PM) thekorn: pranith, yes bughelper/bugnumber is using python-launchpad-bugs to get buglists etc
(01:42:23 PM) thekorn:  
(01:42:33 PM) thekorn: Okay, that's all about bug lists for now, for more information please visit http://tinyurl.com/yrmze9
(01:43:00 PM) thekorn:  
(01:43:38 PM) thekorn: yuriy, ^ this is one part of our API documentation
(01:43:57 PM) thekorn: Now, let's have a look on how to handle bugreports with python-launchpad-bugs:
(01:44:00 PM) rzr: hi there
(01:44:14 PM) thekorn:     >>> Bug = Connector.ConnectBug()
(01:44:25 PM) thekorn:     >>> b = Bug(123456)
(01:44:39 PM) thekorn: The argument of Bug() can either be a bug number, an url of a bugreport or an element of a BugList-object
(01:44:52 PM) thekorn:  
(01:45:03 PM) thekorn: There is a huge amount of attributes of a bug-object. You can access almost all information of a bugreport.
(01:45:15 PM) thekorn: Let's have a look at some examples:
(01:45:22 PM) thekorn:     >>> b.url
(01:45:31 PM) thekorn:     'https://bugs.launchpad.net/ubuntu/+source/xine-lib/+bug/123456'
(01:45:38 PM) thekorn:     >>> print b.subscriptions
(01:45:44 PM) thekorn:     set([<user ken-paulsen (Valyander)>, [...], <user kubuntu-sujee (LinuxLover)>])
(01:45:55 PM) thekorn:     >>> print b.comments
(01:46:00 PM) thekorn:     [<Comment #1 by kubuntu-sujee on 2007-07-03 07:17:39 UTC>,[...],<Comment #6 by bersace on 2007-09-30 22:04:49 UTC>]
(01:46:15 PM) thekorn: For a list of all attributes of a Bug-object and some examples on using these attributes have a look at http://tinyurl.com/2mboze
(01:46:40 PM) thekorn:  
(01:46:44 PM) thekorn: So far, we have only read bugs, but with python-launchpad-bugs you can also change bugreports in a very easy way!
(01:46:52 PM) thekorn: First of all, only registered user can change bugreports in launchpad, so let's authenticate with our account data:
(01:47:14 PM) thekorn:     >>> Bug.authentication = {"password":"<your-password>","email":"<your-login-email>"}
(01:47:23 PM) thekorn: There is also another possibility of authentication: you can use a mozilla cookie-file (this for example works for cookies created by epiphany or firefox < 3.0)
(01:47:38 PM) thekorn:     >>> Bug.authentication = "/path/to/the/cookiefile/cookie.txt"
(01:47:48 PM) thekorn:  
(01:48:09 PM) thekorn: Now I want to show you, as an example, how to change the status of a bug:
(01:48:34 PM) thekorn:     >>> demo = Bug(193948)
(01:48:41 PM) thekorn:     >>> demo.status
(01:48:47 PM) thekorn:     'New'
(01:48:52 PM) thekorn:     >>> demo.status = "Invalid"
(01:48:58 PM) thekorn:     >>> demo.commit()
(01:49:04 PM) thekorn: Until you call the 'commit()'-method all changes are local, with 'commit()' you try to commit all changes you did locally to launchpad.
(01:49:26 PM) thekorn:  
(01:49:43 PM) thekorn: yuriy> thekorn: QUESTION: can you authenticate using an ssh key?
(01:50:00 PM) thekorn: no, py-lp-bugs do not support this
(01:50:36 PM) thekorn:  
(01:50:41 PM) thekorn: Like this you can for example change the description, add comments or attachments, subscribe to a bug or change the tags.
(01:51:03 PM) thekorn:  
(01:51:05 PM) thekorn: Let's have a look at two more complex examples.
(01:51:11 PM) thekorn: You can get this scripts here: https://wiki.ubuntu.com/BugHelper/Dev/python-launchpad-bugs/Examples
(01:51:26 PM) thekorn: These two scripts show you how to use python-launchpad-bugs to do things you can't do in launchpad itself.
(01:51:39 PM) thekorn:  
(01:51:41 PM) thekorn: Let's say you are a developer of an upstream project in launchpad. When you create a package of your tool and build it for ubuntu, bugs in ubuntu are closed by the (LP: #123456) syntax, but upstream bugs were not. The first example also closes this upstream bugs in your project and adds a comment containing the changelog-entry.
(01:52:16 PM) thekorn:  
(01:52:26 PM) thekorn: I wrote the second example few days ago when we had all these python-central bugreports. This example returns you a list of bugs created in ubuntu after 2008-02-18 and filters this list by the following criteria:
(01:52:46 PM) thekorn:     * 'pycentral' or 'python-central' in the content of the bugreport (that's no magic, launchpad can do this :))
(01:53:31 PM) thekorn:     * an attachment called 'DpkgTerminalLog.gz' which contains 'pycentral' or 'python-central' (this is magic! no way to do this in launchpad)
(01:54:27 PM) thekorn:  
(01:54:34 PM) thekorn: <RainCT> QUESTION: Since the last python-launchpadbugs update I get Ā«AssertionError: Parsing of this page (https://bugs.launchpad.net/ubuntu/+bugs?field.searchtext=[.........]) is not supported by python-launchpad-bugsĀ» when I run some scripts I had that used it... What changed?
(01:55:16 PM) thekorn: that's simple you need either the latest version in hardy, or the latest versions of py-lp-bugs from the team PPA
(01:55:49 PM) thekorn: because the way launchpad presents the data changes with almost evry update
(01:56:12 PM) thekorn: but it should be fixed with the latest version of py-lp-bugs
(01:56:15 PM) thekorn:  
(01:56:30 PM) thekorn: RainCT, I hope this helps
(01:56:38 PM) thekorn: as an explanation
(01:57:09 PM) thekorn: let's move on
(01:57:13 PM) thekorn:  
(01:57:19 PM) thekorn: As a last example I want to show you how to create a bugreport with python-launchpad-bugs, it's only one line of code!
(01:57:29 PM) thekorn:     >>> b = Bug.New(
(01:57:33 PM) thekorn:     ...    product = {"name":"buglog-data"},
(01:57:38 PM) thekorn:     ...    summary = "this class is almost over",
(01:57:44 PM) thekorn:     ...    description = "UDW rocks! - but we need more time to show all features of bughelper and py-lp-bugs")
(01:58:00 PM) thekorn: This creates a new bugreport in the 'buglog-data'-project, if you would like to file a bugreport in ubuntu use
(01:58:10 PM) thekorn:     'product = {"target": "ubuntu", "name": "my-package"}'
(01:58:22 PM) thekorn:  
(01:58:32 PM) thekorn: Ok, that's all about python-launchpad-bugs for now, time for some questions!
(01:59:10 PM) thekorn: no questions?
(01:59:59 PM) bdmurray: I realize this is a lot to absorb and think about
(01:59:59 PM) mruiz: go go pedro_ !
(02:00:10 PM) thekorn: yeah,
(02:00:14 PM) thekorn:  
(02:00:17 PM) thekorn: If you would like to use bughelper and/or python-launchpadbugs and have any questions, or even better if you want to help us improving this two packages, this are ways to get in with us:
(02:00:26 PM) dholbach: thanks thekorn, thanks bdmurray - you guys ROCK! :)
(02:00:28 PM) forsaken_: do other bug trackers have an API?
(02:00:49 PM) ***thekorn hugs dholbach 
(02:00:51 PM) thekorn:     * bughelper has a separate mailing list, bughelper@l.u.c
(02:00:54 PM) thekorn:     * browse https://launchpad.net/python-launchpad-bugs and https://launchpad.net/bughelper to file bugreports or get the code
(02:00:57 PM) ***dholbach hugs thekorn back
(02:01:00 PM) thekorn:     * for more information check out our wiki pages at https://wiki.ubuntu.com/BugHelper
(02:01:02 PM) thekorn:     * and last but not least ping us in #ubuntu-bugs
(02:01:11 PM) pranith: thekorn, bdmurray thanks for the class. it was really informative
(02:01:16 PM) thekorn: DONE!
(02:01:22 PM) phoenix24_: Thanks!!
(02:01:31 PM) barcc: thanks
(02:01:35 PM) bdmurray: Thanks for coming to our class.
(02:01:49 PM) thekorn: thanks for joining our session!

MeetingLogs/devweek0802/Bughelper (last edited 2008-09-02 19:33:25 by c-24-21-234-111)