/srv/irclogs.ubuntu.com/2011/07/12/#ubuntu-classroom.txt

=== someone is now known as Guest80499
jonas42is happing something now?01:56
jonas42happening*01:57
=== jonas42 is now known as Jonas42
jgruber_lernidno, classes start again in about 14 hours01:57
Jonas42ok, thanks01:59
Jonas42what are you doing here?01:59
Jonas42i`m sorry, i`m new here02:00
collymoorehi everybody02:06
supinpshello03:19
dr__hi03:47
=== wraith is now known as Guest94790
=== ikonia_ is now known as ikonia
=== aksyahba is now known as acklee
=== blaze is now known as Guest51455
=== __2hack3r is now known as sayan
dholbachAlright my friends - welcome everybody to the second day of Ubuntu Developer Week!15:51
dholbachI'll just do a very quick introduction, before I vanish off the stage15:51
dholbachMost of you know the organisational bits by now:15:51
dholbach - please make sure you join #ubuntu-classroom-chat as well, so you can ask questions and chat in there15:52
dholbach - if you want to ask questions, please prefix them with QUESTION:15:52
dholbach   ie: QUESTION: Which instrument does Barry play?15:52
dholbach - also: if you can't make it to a session or missed something: there'll be logs up later on at https://wiki.ubuntu.com/UbuntuDeveloperWeek (logs of yesterday are linked already)15:52
coolbhavidholbach, there is still time remaining I guess before I start15:54
dholbachToday we're going to kick off with "Getting started with merging packages from debian" - Bhavani "coolbhavi" Shankar will lead the session and you all have 6 minutes left to relax, grab another coffee/tea/water15:54
acknopperexit15:54
dholbachThere is :)15:54
dholbachand please let your friends know about the event in case they're interested :-)15:54
dholbachEnjoy another great day off Ubuntu Developer Week!15:54
coolbhavihey all before I start the session I am bhavani shankar a ubuntu contributor and MOTU and ll be showing a simple example using merge o matic15:58
coolbhaviHey all16:00
coolbhaviso lets get kicking on this16:00
coolbhaviWe are going to learn how to merge packages16:00
coolbhaviBut, first of all we need to understand what merging is16:00
coolbhaviToday I'm going to show you how to do a merge using merge - o - matic (MoM). Ubuntu's semi automatic merging system16:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Getting started with merging packages from debian - Instructors: coolbhavi
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/12/%23ubuntu-classroom.html following the conclusion of the session.16:01
coolbhaviefore we start off just a basic roundup of the concept(s) involved16:01
coolbhaviOn our first stage of development cycle we import packages from debian unstable (sid). (In case of a LTS we import packages from debian testing)16:01
coolbhaviThere are two ways to import a package from debian (one is a sync and other is a merge)16:02
coolbhaviSync is importing the debian package "as is" without any further changes16:02
coolbhaviwhereas merging is importing the debian package and intoducing/including all the ubuntu changes.16:02
coolbhaviBut we need to cross verify whether the ubuntu changes are applicable for the present version and the ubuntu changes have been superceeded by debian in which case its a sync16:02
coolbhaviNow getting to know a short background lets move on16:03
coolbhaviPlease enable universe and main repositories and pull in all the packages essential for ubuntu development environment (as mentioned in the ubuntu packaging guide which m pasting here for your kind reference16:04
coolbhavisudo apt-get install --no-install-recommends bzr-builddeb ubuntu-dev-tools fakeroot build-essential gnupg pbuilder debhelper16:05
coolbhavi(PS: btw, this page provides a overview of merging workflow https://wiki.ubuntu.com/UbuntuDevelopment/Merging and we are going to see a simple example of it now)16:05
coolbhaviSo assuming you have understood till now lets move on16:06
coolbhaviFirst of all we need to check what packages have need to be merged. Thats where MoM comes into picture16:06
coolbhaviMoM is available here: http://merges.ubuntu.com16:06
coolbhaviFirst of all we need to create a work directory, I use ~/development, you could use  a directory of your own16:06
coolbhaviFrom now on we are calling this $WORK_DIR, so please create a working directory for your own.16:07
coolbhavinow store the path on the $WORK_DIR variable giving "export $WORK_DIR=/path/to/work/directory"16:07
coolbhavifor convenience16:07
coolbhaviwhich in my case will be "export WORK_DIR=~/development"16:08
coolbhaviBy MoM way we use a script called grab-merge.sh which is available in ubuntu-dev-tools but for convineince I'll download the script here16:08
coolbhaviExecute this in a terminal16:08
coolbhavicd $WORK_DIR ; wget -c http://merges.ubuntu.com/grab-merge.sh; chmod +x grab-merge.sh16:08
coolbhaviI'll go a bit slow from now on for others to catch up if m going fast16:09
coolbhaviSo once its done we can start merging process16:10
coolbhaviSince we are new contributors I ll take a simple example of a universe package merge which is ldaptor a pure python based LDAP client in short16:10
coolbhaviSee:  https://launchpad.net/ubuntu/+source/ldaptor16:11
coolbhavibtw the complete list of universe package merges is here:16:11
coolbhavi https://merges.ubuntu.com/universe.html16:11
coolbhaviHere we find a large list of packages, with their ubuntu, debian and base version also we see the last uploader, which is the last person who work on the package, and in some cases the16:12
coolbhaviuploader of the package (sponsor of the package)16:12
coolbhaviSo if all is fine we are going to work on ldaptor package now16:13
coolbhaviso we are going to create an empty directory to work on it and get into it:16:14
coolbhavimkdir $WORK_DIR/ldaptor ; cd $WORK_DIR/ldaptor16:14
coolbhavinow we need to download the debian and ubuntu packages to work on them, that's easily done with the script we download earlier:16:14
coolbhaviNow I assume everyone has created a directory named ldaptor we ll execute grab-merge.sh script which on my system will be india@ubuntu11:~/development/ldaptor$ ../grab-merge.sh ldaptor16:16
coolbhaviNow I'll leave some time for the packages to download16:17
coolbhavimost of the work have been already done by MoM, we only need to work on some fine tuning and the tasks16:19
coolbhaviwhich need human intervention16:19
coolbhaviok, if everything is already downloaded we can see a file called REPORT, this is the first thing we16:20
coolbhavineed to look at16:20
=== Shock is now known as Guest98355
coolbhaviIn this case there are no conflicts so indicating that its a pretty simple merge but quite interesting :)16:20
coolbhavinow we just need to look at the debian changelog and determine whether the ubuntu changes are still applicable or not16:21
coolbhavifor that do cd ldaptor-0.0.43+debian1-5ubuntu1/debian  in my system16:22
coolbhaviindia@ubuntu11:~/development/ldaptor$ cd ldaptor-0.0.43+debian1-5ubuntu1/debian/16:23
=== vivek is now known as Guest37421
coolbhavinow once you are in the /debian directory16:23
coolbhavitype in this command dch -e to edit the debian/changelog in your favourite editor16:24
coolbhavii use good old nano :)16:24
coolbhaviyou ll find a lines like this at the start ldaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low16:26
coolbhavi  * Merge from debian unstable.  Remaining changes:16:26
coolbhavi    -  SUMMARISE HERE16:26
coolbhaviwith the debian package changelog and previous ubuntu package chanbgelog merged together :)16:27
coolbhaviNow if you take a look at the previous ubuntu specific changelog you ll find this:16:28
coolbhavildaptor (0.0.43+debian1-4ubuntu1) oneiric; urgency=low16:28
coolbhavi  * Merge from debian unstable. Remaining change:16:28
coolbhavi    - Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations.16:28
coolbhaviwhich is pretty interesting as the package fails to build on the official buildds of ubuntu due to a package which strips translations pertaining to the package and if the po or pot files are empty it causes a build failure16:31
coolbhaviwithout this change the package would have been imported as is giving raise to a sync :)16:32
coolbhaviso now we need to update the changelog for the latest ubuntu version of the package we are working on which on my system now will be16:33
coolbhavildaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low16:33
coolbhavi  * Merge from debian unstable.  Remaining changes:16:33
coolbhavi    - Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations.16:33
coolbhaviPlease take note of the spacings and the format of the changelog as it ll be machine parseable :)16:35
coolbhaviNow save the changes in your favourite editor ]16:35
coolbhaviand run the following command debuild -S16:36
coolbhaviSo that builds the .dsc file and generates the .changes file now you should test build the package .dsc file in a pbuilder or sbuild to check whether the package builds correctly not and generates the deb file16:36
coolbhavi(Note: this step is very important for ensuring quality work and quick sponsoring :) )16:37
coolbhaviso after building the .dsc please test it in a pbuilder so issue the following command: sudo pbuilder build ldaptor_0.0.43+debian1-5ubuntu1.dsc16:39
coolbhavi<saimanoj79> QUESTION: make: dh: Command not found make: *** [clean] Error 12716:40
coolbhavisaimanoj79, make sure you have installed all the packages correctlly required for ubuntu development as said above16:41
coolbhavi<vanderson> debsign: gpg error occurred!  Aborting....debuild: fatal error at line 1256:running debsign failed   is it work?16:41
coolbhavivanderson, please create a GPG key too because its required to sign the .dsc built and .changes with your gpg key https://wiki.ubuntu.com/GnuPrivacyGuardHowto should help you16:43
coolbhaviOnce the package builds correctly generate the debdiff between the current debian_version.dsc and current ubuntu_version.dsc and attach it to a bug opened as defined in the merging workflow in this link: https://wiki.ubuntu.com/UbuntuDevelopment/Merging16:43
coolbhaviso in my system I would do: india@ubuntu11:~/development/ldaptor$ debdiff ldaptor_0.0.43+debian1-5.dsc ldaptor_0.0.43+debian1-5ubuntu1.dsc > ldaptor.diff16:45
coolbhaviand attach ldaptor.diff as a patch to the bug I created as per the merge workflow as a patch16:45
coolbhaviand last but not the least Subscribe the ubuntu-sponsors team on your merge request bug for feedback and uploading of your change :)16:47
coolbhaviso this was a session on how to get started merging packages from debian. This I believe can get you started into merging packages The above example was a simple one and various packages have various sort of conflicts which are need to be handled diligently :)16:50
ClassBotThere are 10 minutes remaining in the current session.16:51
coolbhaviand we need to look at the importance of debian package change too while merging a package from debian16:51
coolbhavi<and`> coolbhavi, QUESTION: as a side note, would you mind explaining what a fake sync is and why do we need that?16:51
coolbhaviand`, fake sync arises due to mismatching of orig tarballs in debian and ubuntu so it cant be synced directly from debian in short terms16:53
coolbhaviand if you get stuck anywhere in the ubuntu development sphere please feel free to tap on us in #ubuntu-motu or #ubuntu-devel16:55
coolbhaviwe are always there to help you :)16:55
ClassBotThere are 5 minutes remaining in the current session.16:55
coolbhavi<mjaga> QUESTION: in which directory did you issue the pbuilder command? I'm getting ... is not a valid .dsc file name16:56
coolbhavimjaga, its in the ldaptor directory that we created16:56
coolbhavi<takdir> QUESTION: how to apply that patch (.diff) to ubuntu package16:57
coolbhaviwe use the generated diff to apply to the debian package in case of a merge takdir16:58
coolbhaviso if anyone is on facebook you can catch me up on facebook.com/bshankar :)16:59
coolbhavithats all from my side now :)17:00
coolbhavithanks all for turning up for this session17:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Porting from pygtk to gobject introspection - Instructors: pitti
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/12/%23ubuntu-classroom.html following the conclusion of the session.17:01
pittithanks coolbhavi!17:01
pittiHello everyone! I am Martin Pitt from the Canonical Ubuntu Desktop Team.17:01
pittijust a note, if you were in this talk at the last UDW half a year ago, it'll be pretty much the same17:02
pittijust to get an impression of how many folks are listening, can you raise hands (o/) or say hello in #chat?17:02
pittinice :)17:03
=== Guest24161 is now known as vistaero
pittiso, let's python!17:03
pittiPython is a very important and popular language in Ubuntu, we have a lot of applications written in Python for GTK and Qt/KDE. Most prominent examples are our installer Ubiquity, Software Center, our driver installer "Jockey", and our bug/crash reporting system "Apport" (shameless plug!).17:03
pittiBy way of Quickly we also encourage application developers to use Python and GTK, as these allow you to write GUI applications both conveniently, fast, and still rather robust.17:04
pittiUntil recently, the package of choice for that has been PyGTK, a manually maintained Python binding for GTK, ATK, Pango, Glade, and a few other things. However, a few months ago, with the advent of GTK3, PyGTK was declared dead, so it's time to bring the banner of the great new world of its successor -- gobject-introspection -- to the world!17:04
pittiI'll concentrate on the app developer side, i. e. how to use GI typelibs in Python, but will nevertheless give a quick overview of gobject-introspection.17:04
pittiPorting existing PyGTK2 code is a topic that has kept, and will still keep many of us busy for some months, so I'll explain the process and common pitfalls with that.17:05
pittiFinally I'll give some pointers to documentation, and will be available for some Q&A.17:05
pittiEveryone ready to dive in? Please let me know (here or in #-chat) when I become too fast. If I am being totally unclear, please yell and I'll handle that immediately. If you just have a followup question, let's handle these at the end.17:05
pitti== Quick recap: What is GI? ==17:06
pittiSo far a lot of energy was spent to write so-called "bindings", i. e. glue code which exposes an existing API such as GTK for a target language: PyGTK, libnotify-cil, or Vala's .vapi files.17:06
pittiThis both leads to a combinatorial explosion (libraries times languages), as well as many bindings which don't exist at all, or being of low quality. In addition it is also an almost insurmountable barrier for introducing new languages, as they would need a lot of bindings before they become useful.17:06
pittiGI is a set of tools to generate a machine parseable and complete API/ABI description of a library, and a library (libgirepository) which can then be used by a language compiler/interpreter to automatically provide a binding for this library.17:07
pittiWith GI you can then use every library which ships a typelib in every language which has GI support.17:07
pittiGI ABI/API descriptions come in two forms:17:07
pitti * An XML file, called the "GIR" (GI repository). These are mainly interesting for developers if they need to look up a particular detail of e. g. a method argument or an enum value. These are not actually used at runtime (as XML would be too costly to interpret every time), and thus they are shipped in the library's -dev package in Ubuntu and Debian. For example, libgtk2.0-dev ships17:07
pitti/usr/share/gir-1.0/Gdk-2.0.gir.17:07
pitti * A compiled binary form for efficient access, called the "typelib". These are the files that language bindings actually use. Ubuntu/Debian ship them in separate packages named gir<GI_ABI_version>-<libraryname>-<library_ABI_version>, for example, gir1.2-gtk-2.0 ships /usr/lib/girepository-1.0/Gdk-2.0.typelib.17:07
pitti(Yes, it's confusing that the gir1.2-* package does _not_ actually ship the .gir file; don't ask me why they were named "gir-", not "typelib-").17:08
pitti== How does it work in Python? ==17:08
pittipygobject is the piece of software which provides Python access to GI (amongst other things, like providing the glib and GObject bindings). The package name in Ubuntu/Debian is "python-gobject", and it should already be installed on all but the most manually trimmed down installations.17:08
pittiInitial GI support was added to pygobject in version 2.19.0 (August 2009), but the entire GI/pygobject/annotations stack really only stabilized in the last couple of months, so that in practice you will need at least pygobject 2.28 and the corresponding latest upstream releases of GTK and other libraries you want to use.17:09
pittiThis means that you can only really use this with the latest release of distros, i. e. Ubuntu 11.04 (Natty) or Debian testing.17:09
pitti(some time to catch up, will slow down a bit as per #chat)17:10
pittipygobject provides a "gi.repository" module namespace which generates virtual Python modules from installed typelibs on the fly.17:11
pittiFor example, if you install gir1.2-gtk-2.0 (it's already installed by default in Ubuntu 11.04), you can do:17:11
pitti$ python -c 'from gi.repository import Gtk; print Gtk'17:12
pitti<gi.module.DynamicModule 'Gtk' from '/usr/lib/girepository-1.0/Gtk-2.0.typelib'>17:12
pittiand use it just like any other Python module.17:12
pittiI bet that this first example comes as an absolutely unexpected surprise to you:17:12
pitti$ python -c 'from gi.repository import Gtk; Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.CLOSE, "Hello World").run()'17:12
* pitti gives everyone a couple of seconds to copy&paste&run that and be shocked in awe17:12
pittiworking?17:14
pittiLet's look at the corresponding C code:17:14
pitti  GtkWidget* gtk_message_dialog_new (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...);17:14
=== Shock is now known as Guest57437
pittiand the C call:17:15
pitti  GtkMessageDialog* msg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "Hello World");17:15
pitti  msg.run()17:15
pittiSo what do we see here?17:15
pitti(1) The C API by and large remains valid in Python (and other languages using the GI bindings), in particular the structure, order, and data types of arguments. There are a few exceptions which are mostly due to the different way Python works, and in some cases to make it easier to write code in Python.17:15
pittiI'll speak about details below. But this means that you can (and should) use the normal API documentation for the C API of the library. devhelp is your friend!17:15
pitti(2) As Python is a proper object oriented language, pygobject (and in fact the GI typelib already) expose a GObject API as proper classes, objects, methods, and attributes. I. e. in Python you write17:16
pitti  b = Gtk.Button(...)17:16
pitti  b.set_label("foo")17:16
pittiinstead of the C gobject syntax17:16
pitti  GtkWidget* b = gtk_button_new(...);17:16
pitti  gtk_button_set_label(b, "foo");17:16
pittiThe class names in the typelib (and thus in Python) are derived from the actual class names stated in the C library (like "GtkButton"), except that the common namespace prefix ("Gtk" here) is stripped, as it becomes the name of the module.17:17
pitti(3) Global constants would be a heavy namespace clutter in Python, and thus pygobject exposes them in a namespaced fashion as well.17:17
pittiI. e. if the MessageDialog constructor expects a constant of type "GtkMessageType", then by above namespace split this becomes a Python class "Gtk.MessageType" with the individual constants as attributes, e. g. Gtk.MessageType.INFO.17:17
pitti(4) Data types are converted in a rather obvious fashion. E. g. when the C API expects an int* array pointer, you can supply a normal Python array [0, 1, 2]. A Python string "foo" will match a gchar*, Pythons None matches NULL, etc.17:18
pittiSo the GObject API actually translates quite naturally into a real OO language like Python, and after some time of getting used to above transformation rules, you should have no trouble translating the C API documentation into their Python equivalents.17:18
pittiWhen in doubt, you can always look for the precise names, data types, etc. in the .gir instead, which shows the API broken by class, method, enum, etc, with the exact names and namespaces as they are exposed in Python.17:18
pittiThere is also some effort of turning .girs into actual HTML documentation/devhelp, which will make development a lot nicer17:19
pittibut I'm afraid it's not there yet, so for now you need to use the C API documentation and the .gir files17:19
pittiAs I mentioned above, this is in no way restricted to GTK, GNOME, or UI. For example, if you handle any kind of hardware and hotplugging, you almost certainly want to query udev, which provides a nice glib integration (with signals) through the gudev library.17:20
pittiThis example lists all block devices (i. e. hard drives, USB sticks, etc.):17:20
pitti(You need to install the gir1.2-gudev-1.0 package for this)17:21
pitti$ python17:21
pitti>>> from gi.repository import GUdev17:21
pitti>>> c = GUdev.Client()17:21
pitti>>> for dev in c.query_by_subsystem("block"):17:21
pitti...     print dev.get_device_file()17:21
pitti...17:21
pitti/dev/sda17:21
pitti/dev/sda117:21
pitti/dev/sda217:21
pitti[...]17:21
pittiSee http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/GUdevClient.html#g-udev-client-query-by-subsystem for the corresponding C API.17:21
pittior /usr/share/gir-1.0/GUdev-1.0.gir for the proper class/method OO API17:21
pittiGI is not even restricted to GObject, you can annotate any non-OO function based API with it. E. g. there is already a /usr/share/gir-1.0/xlib-2.0.gir (although it's horribly incomplete). These will behave as normal functions in Python (or other languages) as well.17:22
pitti== Other API differences ==17:22
pittiI said above in (1) that the structure of method arguments is by and large the same in C and in GI/Python. There are some notable exceptions which you must be aware of.17:22
pitti=== Constructors ===17:23
pittiThe biggest one is constructors. There is actually two ways of calling one:17:23
pitti * Use the real constructor implementation from the library. Unlike in normal Python you need to explicitly specify the constructor name:17:23
pitti   Gtk.Button.new()17:23
pitti   Gtk.Button.new_with_label("foo")17:23
pitti * Use the standard GObject constructor and pass in the initial property values as named arguments:17:23
pitti   Gtk.Button(label="foo", use_underline=True)17:23
pittiThe second is actually the recommended one, as it makes the meaning of the arguments more explicit, and also underlines the GObject best practice that a constructor should do nothing more than to initialize properties. But otherwise it's pretty much a matter of taste which one you use.17:23
pitti=== Passing arrays ===17:24
pittiUnlike C, higher level languages know how long an array is, while in the C API you need to specify that explicitly, either by terminating them with NULL or explicitly giving the length of the array in a separate argument.17:24
pittiWhich one is used is already specified in the annotations and thus in the typelib, so Python can automatically provide the right format without the developer needing to append an extra "None" or a separate len(my_array) argument.17:25
pittiFor example, in C you have17:25
pitti   gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme, const gchar *path[], gint n_elements)17:25
pitti(where you pass an array and an explicit length)17:25
pittiIn Python you can just call this as17:25
pitti   my_icon_theme.set_search_path(['/foo', '/bar'])17:25
pittiand don't need to worry about the array size.17:26
pitti=== Output arguments ===17:26
pittiC functions can't return more than one argument, so they often use pointers which the function then fills out.17:26
pittiConversely, Python doesn't know about pointers, but can easily return more than one value as a tuple.17:26
pittiThe annotations already describe which arguments are "out" arguments, so in Python they become part of the return tuple:17:27
pittifirst one is the "real" return value, and then all out arguments in the same order as they appear in the declaration.17:27
pittiFor example:17:27
pitti  GdkWindow* gdk_window_get_pointer (GdkWindow *window, gint *x, gint *y, GdkModifierType *mask)17:27
pittiIn C you declare variables for x, y, mask, and pass pointers to them as arguments17:27
pittiIn Python you would call this like17:27
pitti  (ptr_window, x, y, mask) = mywindow.get_pointer()17:28
pitti=== Non-introspectable functions/methods ===17:28
pittiWhen you work with PyGI for a longer time, you'll inevitably stumble over a method that simply doesn't exist in the bindings.17:28
pittiThese usually are marked with introspectable="0" in the GIR.17:28
pittiIn the best case this is because there are some missing annotations in the library which don't have a safe default, so GI disables these to prevent crashes. They usually come along with a corresponding warning message from g-ir-scanner, and it's usually quite easy to fix these.17:29
pittiin popular libraries like GTK 3, pretty much all of them are fixed now, but in less common libraries there's probably still a ton of them17:29
pittiAnother common case are functions which take a variable number of arguments, such as gtk_cell_area_add_with_properties().17:30
pittiVarargs cannot be handled safely by libgirepository.17:30
pittiIn these cases there are often alternatives available (such as gtk_cell_area_cell_set_property()). For other cases libraries now often have a ..._v() counterpart which takes a list instead of variable arguments.17:31
pitti== Migrating pygtk2 code ==17:31
pitti(there are two more common differences: overrides and GDestroyNotify, but they are documented on a wiki page, no need to bore you with them right now)17:32
pittiA big task that we in Ubuntu already started in the Natty cycle, and which will continue to keep us and all other PyGTK app developers busy for a while is to port PyGTK2 applications to GTK3 and PyGI.17:32
pittiNote that this is really two migrations in one step, but is recommended as GTK2 still has a lot of breakage with PyGI, although I did a fair amount of work to backport fixes from GTK3 (the six applications that we ported in Natty run with PyGI and GTK2, after all).17:33
pittiThe GTK2 → GTK3 specifics are documented at http://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html and I don't want to cover them here.17:33
pitti=== Step 1: The Great Renaming ===17:33
pittiThe biggest part in terms of volume of code changed is basically just a renaming exercise.17:34
pittiE. g. "gtk.*" now becomes "Gtk.*", and "gtk.MESSAGE_INFO" becomes "Gtk.MessageType.INFO".17:34
pittiLikewise, the imports need to be updated: "import gtk" becomes "from gi.repository import Gtk".17:34
pittiFortunately this is is a mechanical task which can be automated.17:34
pittiThe pygobject git tree has a script "pygi-conver.sh" which is a long list of perl -pe 's/old/new/' string replacements. You can get it from http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh.17:34
pittiIt's really blunt, but surprisingly effective, and for small applications chances are that it will already produce something which actually runs.17:35
pittiNote that this script is in no way finished, and should be considered a collaborative effort amongst porters. So if you have something which should be added there, please don't hesitate to open a bug or ping me or someone else on IRC (see below). We pygobject devs will be happy to improve the script.17:35
=== Ursinha is now known as Ursinha-lunch
pittiWhen you just run pygi-convert.sh in your project tree, it will work on all *.py files. If you have other Python code there which is named differently (such as bin/myprogram), you should run it once more with all these file names as argument.17:35
pitti=== Step 2: Wash, rinse, repeat ===17:36
pittiOnce the mechanical renamings are out of the way, the tedious and laborious part starts.17:36
pittiAs Python does not have a concept of "compile-time check" and can't even check that called methods exist or that you pass the right number of parameters, you now have to enter a loop of "start your program", "click around until it breaks", "fix it", "goto 1".17:36
pittihe necessary changes here are really hard to generalize, as they highly depend on what your program actually does, and this will also involve the GTK 2 → 3 parts.17:36
pitti(just imagine a 'T' at the start of the last sentence)17:37
pittiOne thing that comes up a lot are pack_start()/pack_end() calls. In PyGTK they have default values for "expand", "start", and "padding", but as GTK does not have them, you won't have them in PyGI either.17:37
pittiThere even was a patch once for providing an override for them, but it was rejected as it would cement the API incompatibility.17:37
pittiand upstream decided (righfully IMHO) that staying close to the original API is better than staying compatible with pygtk's quirks17:38
pittiOne thing you need to be aware of is that you can't do a migration halfway:17:38
pittiIf you try to import both "gtk" and "gi.repository.GTK", hell will break lose and you'll get nothing but program hangs and crashes, as you are trying to work with the same library in two different ways.17:38
pittiyou have to be especially careful if you import other libraries which import gtk by themselves, so it might not actually be immediately obvious that this happens17:38
pittiYou can mix static and GI bindings of _different_ libraries, such as using dbus-python and GTI-GI.17:39
pittisorry, GTK-GI17:39
pitti=== Step 3: Packaging changes ===17:40
pittiAfter you have your code running with PyGI and committed it to your branch and released it, you need to update the dependencies of your distro package for PyGI.17:40
pittiYou should grep your code for "gi.repository" and collect a list of all imported typelibs, and then translate them into the appropriate package name.17:40
pittiFor example, if you import "Gtk, Notify, Gudev" you need to add package dependencies to gir1.2-gtk-3.0, gir1.2-notify-0.7, and gir1.2-gudev-1.0 on Debian/Ubuntu17:40
pittiI have no idea about other distros, so the package names will differ, but the concept is the same17:40
pittiAt the same time you should drop dependencies to the old static bindings, like python-gtk2, python-notify, etc.17:41
pittiFinally you should also bump the version of the python-gobject dependency to (>= 2.28) to ensure that you run with a reasonably bug free PyGI.17:41
pitti== RTFM & Links ==17:41
pittiI'd like to give a list of useful links for this topic here.17:41
pittiThis has a good general overview about GI's architecture, annotations, etc:17:41
pitti    https://live.gnome.org/GObjectIntrospection17:41
pittiBy and large the contents of this talk from previous UDW, massaged to be a proper wiki page:17:42
pitti    https://live.gnome.org/PyGObject/IntrospectionPorting17:42
pittiThe interview with Jon Palmieri and Tomeu Vizoso is also an interesting read about its state:17:42
pitti    http://www.gnomejournal.org/article/118/pygtk-gobject-and-gnome-317:42
pittiThe GI/PyGI developers hang out on IRC here:17:42
pitti    #introspection / #python on irc.gnome.org17:42
pittipygobject's git tree has a very comprehensive demo showing off pretty much all available GTK widgets in PyGI:17:42
pitti    http://git.gnome.org/browse/pygobject/tree/demos/gtk-demo17:42
pittiDescription of the Python overrides for much easier GVariant and GDBus support17:42
pitti    http://www.piware.de/2011/01/na-zdravi-pygi/17:42
pittiExamples of previously done pygtk → pyGI ports:17:42
pitti  Apport: http://bazaar.launchpad.net/~apport-hackers/apport/trunk/revision/180117:42
pitti   Jockey: http://bazaar.launchpad.net/~jockey-hackers/jockey/trunk/revision/67917:42
pitti   gtimelog: http://bazaar.launchpad.net/~pitti/gtimelog/pygi/revision/18117:42
pitti   system-config-printer (work in progress): http://git.fedorahosted.org/git/?p=system-config-printer.git;a=shortlog;h=refs/heads/pygi17:42
pitti   The gtimelog one is interesting because it makes the code work with *both* PyGTK and PyGI, whichever is available.17:43
pitti== Q & A ==17:43
pittiThanks everyone for your attention! I'm happy to answer questions now.17:43
ClassBotnum asked: Im sorry if I missed something but what are those gir files?17:44
pittinum: so, the .gir file is an XML text format which describes the API of a library17:44
pittiit contains everything which a C header (*.h) file contains, but goes way beyond that17:45
pittifor example, it also documents the lifetime, parameter direction, the position of array length parameters, or who owns the object that a method returns17:45
pittithis (well, in its binary typelib incarnation) is what the language bindings use to use the library17:45
pittijust open usr/share/gir-1.0/Gtk-2.0.gir and have a look17:46
ClassBotjohn_g asked: Can you say more about the window sizing changes?17:46
pittithis is actually on the side of gtk 2 -> 3, which indeed changed this17:47
pittithere is no difference at all if you move from pygtk2 to PyGI with GTK217:47
pittimost prominent change here is the different expand/fill default, which often makes GTK3 apps look very huge until they get fixed17:48
pittihttp://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html has more details about this17:48
ClassBotbj0 asked: is there an example or howto for adding GI/PyGI support to a relatively simple library?  Is writing a .gir all that is needed?17:48
pittiah, I didn't cover that part, only from the POV of the "user" (python developer)17:48
pittiit's actually easier17:48
pittiyou don't write the .gir, it's generated from the GI tools17:49
pittiit scans the header and .C files and gets all the classes, methods, docstrings, parameter names etc. from it17:49
pittiwhat you need to do in addition is to add extra magic docstring comments to do the "annotations"17:49
pittii. e. if you have a method17:49
pittiGtkButton* foo(GtkWindow *window)17:50
pittiyou need to say who will own the returned button -- the caller (you) or the foo method17:50
pittithis will tell Python whether it needs to free the object, etc.17:50
pittihttps://live.gnome.org/GObjectIntrospection/Annotations explains that17:50
pittilet me dig out gudev, as this is much smaller than gir17:50
ClassBotThere are 10 minutes remaining in the current session.17:51
pittithan GTK, I mean17:51
pittibut the nice thing is that most of these are already defined in gtk-doc, too17:51
pittii. e. the things that python needs to know are also things you as a programmer need to know :)17:52
pittihttp://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=extras/gudev/gudevclient.c;h=97b951adcd421e559c4a2d7b3b822eb95dd01f1d;hb=HEAD#l33617:53
pitticheck this out17:53
pitti/**17:53
pitti * g_udev_client_query_by_subsystem:17:53
pittistandard docstring17:53
pitti * @subsystem: (allow-none): The subsystem to get devices for or %NULL to get all devices.17:53
pittithe "(allow-none)" is an annotation17:53
pittiand tells python (or you) that you can pass "NULL" for this17:54
pitti * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list.17:54
pittithe element-type tells the bindings about the type of the elements in teh returned GList*17:54
pittiand the (transfer full) says that the object will be owned by the caller17:54
pittiand so on17:54
pittiso in summary, all you need to do is to annotate parameters properly, then the GI tools will produce a working gir/typelib17:55
pittitime for one more question17:55
pittiseems not; then thanks again everyone!17:55
ClassBotThere are 5 minutes remaining in the current session.17:55
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Working with bugs reported by apport - Instructors: bdmurray
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/12/%23ubuntu-classroom.html following the conclusion of the session.18:01
=== someone is now known as Guest30183
bdmurrayHi, I'm Brian Murray and I work for Canonical as a defect analyst.  Part of being a defect analyst is working with bug reports in Launchpad.18:02
bdmurrayOne of the ways, and actually the preferred way, that bugs are reported to Launchpad is via apport.18:02
bdmurrayApport is an automated system for reporting problems regarding Ubuntu packages.18:03
bdmurrayThese problems include crashes and package installation failures.18:03
bdmurrayAs these reports are regularly formatted it is also possible to work with them using automated tools.  This is what I am going to talk about today.18:04
bdmurrayLet's look at bug reported by apport together - http://launchpad.net/bugs/807715.18:04
bdmurrayWe can tell this bug was one reported by apport because of the keys and values in the description for example ProblemType: Crash and the tag apport-crash.18:05
bdmurrayBoth of these indicate that we are looking at a crash reported by apport.  The actual crash appears in Traceback.txt.18:05
bdmurrayThe Traceback.txt indicates it is an error importing a python module and since update-manager is installed on a lot of systems this bug is likely to receive a lot of duplicates18:06
bdmurrayWe can see the bug already has 10 of them.18:06
bdmurrayBecause we already know the cause of the bug and how to fix it but a fix isn't available yet - it'd be a good idea to prevent this bug from being reported any more.18:06
bdmurrayApport provides us with a system for doing just that - bug patterns.18:07
bdmurrayAre there any questions so far?18:08
bdmurraySo the branch containing bug patterns can be found at https://code.launchpad.net/~ubuntu-bugcontrol/apport/ubuntu-bugpatterns/.18:09
bdmurrayWhen apport prepares to report a bug about a package it first checks to see if the bug it will report matches a bug pattern.18:09
bdmurrayquestion from andyrock: how does LP detect bug duplicates?18:10
bdmurrayDuplicate detection is actually done by the apport retracer and it builds a crash signature based of the traceback or stacktrace and then it marks bugs as a duplicate of another.  For an example look at one of the duplicates of bug 807715.18:11
bdmurrayIf the bug matches a pattern the reporter will be directed to an existing bug report or a web page instead of going through the bug reporting process.18:12
bdmurrayThe pattern   is an xml file that contains pattern matches, using regular expressions, for apport bug keys.18:12
bdmurrayTo write one for bug 807715 I used (http://bazaar.launchpad.net/~ubuntu-bugcontrol/apport/ubuntu-bugpatterns/revision/244) the following:18:12
bdmurray<pattern url="https://launchpad.net/bugs/807715">18:12
bdmurrayThis is the url future bug reporters will be directed to.18:13
bdmurrayYou could even send them to a wiki page like https://wiki.ubuntu.com/Bugs/InitramfsLiveMedia.18:13
bdmurray~At this page I've documented the issue people have encountered and provided steps for resolving the issue rather than directing them to a bug report as that may be harder to parse.18:13
bdmurrayCarrying on with the example for bug 807715.  We want the pattern to match a specific package:18:14
bdmurray<re key="Package">^update-manager </re>18:14
bdmurrayThen we have the unique error that we've encountered.18:15
bdmurray<re key="Traceback">ImportError: cannot import name GConf</re>18:15
bdmurrayPatterns can even be used to search attachments to the bug report like Traceback.txt as I've done or log files like DpkgTerminalLog.txt.18:15
bdmurrayAnybody from the Ubuntu Bug Control team can commit a bug pattern and I'll happily review any merge proposals.18:15
bdmurrayThe bugpatterns.xml file (http://bazaar.launchpad.net/~ubuntu-bugcontrol/apport/ubuntu-bugpatterns/view/head:/bugpatterns.xml) contains lots of examples to help you get started.18:17
bdmurrayAre there any questions regarding the format of bugpatterns or how they work?18:18
bdmurray< andyrock> Question: in <re etc. etc.> `re` means `regular expression`?18:18
bdmurrayyes, that is correct18:18
bdmurrayfor example here http://bazaar.launchpad.net/~ubuntu-bugcontrol/apport/ubuntu-bugpatterns/view/head:/bugpatterns.xml#L67 we can see we are matching either of two specific version of apport18:19
bdmurray<re key="Package">1.20.1-0ubuntu[4|5]</re>18:19
bdmurrayAny more questions?18:19
bdmurrayIncluded in the bugpatterns bzr branch are some tools for testing and working with bugpatterns18:20
bdmurrayOnce you've written a bug pattern you can test it with the test-local script e.g. ./test-local 807715.18:21
bdmurrayIt will download the details from the bug report and reconstruct an apport crash file.18:21
bdmurrayThen the pattern matching function will be run against that crash file.  I usually do this with one or two bug reports to make sure they match my pattern before I commit it.18:21
bdmurrayThe bug patterns are auto synced to http://people.canonical.com/~ubuntu-archive/bugpatterns/ which is where apport looks for them.18:22
bdmurrayIn addition to the test-local script there is a utility called search-bugs which takes a package name and tags as arguments e.g. (search-bugs --package update-manager --tags apport-crash).18:23
bdmurrayThis is a great    way to make sure your pattern isn't catching the wrong bug reports.18:23
bdmurrayThis is really important as a poorly written bug pattern could end blocking all apport bug reports about package or even all of Ubuntu!18:23
bdmurrayAdditionally, while the apport retracer will automatically mark crash reports as duplicates it does not currently do this with package installation failures.18:24
bdmurraySo if you write a bug pattern regarding a package installation failure you can use search-bugs with the '-C' switch to consolidate all the existing bug reports into the one you've identified as the master bug report.18:24
bdmurrayBy the way package installation failures are identifiable by "ProblemType: Package" and the tag apport-package.18:25
bdmurraysearch-bugs will add a comment to each   bug matching the pattern and mark it as a duplicate of the bug identified in pattern url.18:25
bdmurrayAn overview of writing bug patterns can be found at https://wiki.ubuntu.com/Apport/DeveloperHowTo#Bug_patterns.  Are there any questions regarding how to write bug patterns or use the tools in the bug patterns branch?18:26
bdmurrayAnother thing worth noting is that the apport retracer also helps identify bug reports that would benefit from a bug pattern by tagging them 'bugpattern-needed'.18:28
bdmurrayIt does this for crash reports with more than 10 duplicates.18:28
bdmurraySo we've talked about how we can deal with bugs reported by apport once they've arrived in Launchpad, but what can we do to add information to bugs reported via apport?18:30
bdmurraypport supports package hooks - meaning that it looks in the directory /usr/share/apport/package-hooks/ for a file matching the name of the binary or the source package and adds the information in the package hook to the bug report.18:31
bdmurrayFor example if we look at /usr/share/apport/package-hooks/source_update-manager.py which is also viewable at http://bazaar.launchpad.net/~ubuntu-core-dev/update-manager/main/view/head:/debian/source_update-manager.py.18:32
bdmurrayWe can see that we add the file "/var/log/apt/history.log" to the bug report and name the attachment "DpkgHistoryLog.txt".18:32
bdmurraySo now if update-manager crashes or a user reports a bug via 'ubuntu-bug update-manager' we will have an attachment named DpkgHistoryLog.txt added to the bug report.18:33
bdmurrayThis is helpful in debugging the issue with update-manager as it provides us with the context for the operation being performed.18:34
bdmurrayThe Stable Release Updates team is also happy to approve SRUs that add apport package hooks to a package.18:35
bdmurrayBack to the update-manager package hook - it is utilizing some convenience functions provided by apport.18:36
bdmurrayFor example attach_gconf adds the non-default gconf values for update-manager.18:36
bdmurrayWe can review the convenience functions at http://bazaar.launchpad.net/~apport-hackers/apport/trunk/view/head:/apport/hookutils.py.18:37
bdmurrayUseful ones include attach_hardware, command_output, recent_syslog and attach_network.18:39
bdmurrayIt is also possible to communicate with the bug reporter in a source package hook by asking questions or displaying messages.18:39
bdmurrayIt is even possible to prevent the reporting of bugs - before a bug pattern is ever searched for.18:40
bdmurrayI've done both of these things, asking the reporter a question and preventing certain bugs from being reported, in the ubiquity package hook.18:40
bdmurrayYou can see it at http://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu/oneiric/apport/ubuntu/view/head:/data/package-hooks/source_ubiquity.py18:41
bdmurrayhttp://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu/oneiric/apport/ubuntu/view/head:/data/package-hooks/source_ubiquity.py#L2618:42
bdmurrayHere we examine the syslog file from when the installation was run for SQUASHFS errors18:42
bdmurrayIn the event that any are found an information dialog is presented to the reporter explaining the issue and informing them about things they can do to resolve the issue.18:43
bdmurrayhttp://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu/oneiric/apport/ubuntu/view/head:/data/package-hooks/source_ubiquity.py#L3118:45
bdmurrayHere a Yes / No dialog box is presented to the bug reporter asking them if they want to include their debug log file in the report.18:45
bdmurrayMost ubuntu systems will have lots of package hooks installed on them in /usr/share/apport/package-hooks and there are some great examples in there of things you can do.18:47
bdmurrayThe xorg package hook is pretty complicated but gathers lots of information.18:47
bdmurrayThe grub2 package hook actually reviews a configuration file for errors which is quite handy.18:49
bdmurrayAre there any questions regarding the material covered so far?18:50
ClassBotThere are 10 minutes remaining in the current session.18:51
bdmurrayOkay well that's all I have18:52
bdmurrayI hope you understand how you can better work with bugs reported by apport about your package by using bug patterns and how to make those bugs reported by apport even more informative.18:53
bdmurrayThanks for your time!18:53
ClassBotThere are 5 minutes remaining in the current session.18:55
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Fixing obvious bugs in Launchpad - Instructors: deryck
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/12/%23ubuntu-classroom.html following the conclusion of the session.19:02
deryckOk, so I guess that's me.  Hi, all.  :)19:02
deryckMy name is Deryck Hodge. I'm a team lead for one of the dev teams working on Launchpad.19:02
deryckThis session will be about fixing obvious bugs in Launchpad.19:02
deryckFeel free to ask questions as we go.19:02
deryckLaunchpad is a large code base with a complex deployment story, so one way into hacking on Launchpad is to start by fixing obvious or easy bugs.19:02
deryckFrom there you can decide if you want to go deeper or spend more time working on Launchpad.19:02
deryckWorking on lp is great by itself, but also a great way to support Ubuntu development.19:03
deryckThe goals for this session then are to:19:03
deryck * show you how to setup a Launchpad dev environment19:03
deryck * give you a tour of the Launchpad codebase19:03
deryck * teach you how to find easy bugs19:03
deryck * demonstrate how to approach fixing a bug19:03
deryckYou can try to follow along if you like, but I'm not assuming that, since certain steps like branching can take time....19:04
deryckI'll just outline and demo here.19:04
deryckSo, let's start with getting a Launchpad dev environment setup.19:04
deryckLaunchpad uses a set of scripts we refer to as "rocketfuel" to manage our dev environment. These live in the Launchpad devel  tree and all begin with "rocketfuel-" names.19:05
deryckSo rocketfuel-setup would be the script you would run to build a dev environment.19:05
deryckA word of warning....19:05
deryckThis script appends to your /etc/hosts file, adds ppa sources for launchpad development, and adds local apache configs.19:06
deryckIf that scares you, don't run the script.  If it doesn't, then you can get a working environment by downloading the script and running it, like:19:06
deryck * bzr --no-plugins cat http://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel/utilities/rocketfuel-setup > rocketfuel-setup19:06
deryck * ./rocketfuel-setup19:06
deryck(I'm pasting from notes, so the "*" has no meaning, it's just my bullet points I copied by accident.)19:07
deryckThe above will install into $HOME/launchpad by default. But it does look for some env variables if you want to install in non-standard places.19:08
deryckI change things myself, so my $HOME/.rocketfule-env.sh looks like:19:08
deryckhttp://pastebin.ubuntu.com/642768/19:08
deryckIf you create this file before running rocketfuel-setup, you'll get things in the places you want them.  Or just go with the defaults. :)19:09
deryckIf you want to do each step of rocketfuel-setup by hand rather than run the script, see the full instructions at:19:10
deryckhttps://dev.launchpad.net/Getting19:10
deryckUnder the "Do it yourself" section19:10
deryckIf you want to run rocketfuel-setup for convenience but want it isolated a bit, you can run launchpad in a vm, or use an LXC container or a chroot.19:11
deryckFor more on that, see:19:11
deryckhttps://dev.launchpad.net/Running/LXC or https://dev.launchpad.net/Running/Schroot19:11
deryckThe point of all of the above is to get you familiar with getting setup and point you to sources of more info.19:12
deryckYou don't have to do this now to continue following along... but feel free, of course.19:12
deryckOkay, so after you do all that you should be able to browse the local tree.  If you're using the default location you can see it at $HOME/launchpad/lp-branches/devel.19:12
deryckNow, you need a working database setup.19:13
deryckThis is as simple as changing into the lp tree and running:19:13
deryck./utilities/launchpad-database-setup $USER && make schema19:14
deryckwhere $USER is whatever local user you want to access the db with.19:14
deryckA warning again.....19:14
deryckIf you already have a working Postgres setup, this will destroy any existing DBs. So run isolated per suggestions above if you need to.19:14
deryckAlso "make schema" is your friend if you get your DB in a weird state. It always resets the DB for development.19:15
deryckNow we can run the local Launchpad with:   make run19:15
deryckThis takes a minute to start up but you should be able to go to https://launchpad.dev/ in your browser and connect.19:16
deryckYou can also run tests here.  By killing the running lp and trying something like:19:16
deryck./bin/test -cvvt test_bugheat19:16
deryckTesting becomes important as we do changes later.  We'll come back to that.19:16
deryckAny questions so far on getting setup and running lp locally?19:17
deryckNow that we're setup (or at least know how to get setup), let's look at the code itself!19:18
deryckYou can ls the top of the tree to see what's there:  ls -l ~/launchpad/lp-branches/devel19:18
deryckBut the interesting bits are in lib, especially lib/lp and lib/canonical.19:18
derycklib/canonical is a part of the tree that we can't seem to get rid of.  Eventually everything should end up moved to lib/lp...19:19
deryck...but if you can't find something in lib/lp, then look in lib/canonical.19:19
deryckEverything under the lib directory are the Python packages we'll deal with.  So lib/lp/bugs/model/bug.py can be referenced in Python by lp.bugs.model.bug.19:19
deryckHere's a paste to make this clear:19:20
deryckhttp://pastebin.ubuntu.com/642785/19:20
deryckNotice in the paste that there is a bin/py in the tree that allows you to use Python with the correct path set for lp development.19:20
deryckYou can use `make harness` at the top of the lp tree to get a Python shell with several objects available already.19:21
deryckThis is nice for interpretative debugging or figuring things out.19:21
deryckSo to understand the tree structure, let's focus on lib/lp since that's where most everything lives these days.19:22
deryckEach component of launchpad.net has it's own directory in the lp tree.  "bugs" and "code" and "translations" and so on.19:22
deryckEach of these has roughly the same structure....  an interfaces, model, browser, and templates directory.... among other directories that are common.19:22
deryckso lp.bugs.model and lp.code.model and so on.19:23
deryckThis is roughly our MVC division in launchpad, for those who know MVC-style development from other web app frameworks like Django.19:23
deryckInterfaces are declared in the "interfaces" dir, "model" then contains the classes that implement those interfaces.19:24
deryck"browser" holds the view stuff and templates are the html portion.  Well, TAL versions of the html.19:24
deryckGenerally, if you want to figure out what's happening with the Python objects or the database layer, look at stuff in the interfaces and model directories....19:24
deryck(Read up on Zope Component Architecture to make better sense of those files.)19:25
deryck...but we said we want to focus on easy or obvious bugs, which are likely something to do with the web page itself.19:25
deryckSo let's focus on the stuff in templates or browser code.19:25
deryckAgain, this is the stuff that has to do with display on launchpad.net. (Or launchpad.dev if you working locally.)19:26
deryckThat concludes the tour of the code.  Any questions on that part?19:26
deryckNow let's try to understand how we organize bugs on the launchpad project to find something to fix.19:27
deryckTagging can help us here.  We use "trivial" or "easy" to mark bugs that are pretty shallow.19:28
deryckHere is a list of 162 Triaged launchpad bugs tagged "trivial" --19:28
deryckhttp://tinyurl.com/6l572gg19:28
deryckBut if you look at those bugs, you can see we often use "trivial" to mean trivial to an *experienced* Launchpad dev.19:29
deryckSo that might be useful, but I like to narrow further, when looking for truly easy stuff.19:29
deryckLet's search for Triaged bugs with the tag "trivial" and "ui" since I know "ui" is used to many anything in the web page itself.19:30
deryckhttp://tinyurl.com/5snjlva19:30
deryckNow we're down to 69 bugs. :-)19:30
deryckFWIW, "ui" and "css" and "javascript" are all tags we use for front end work that combined with "easy" or "trivial" tags can help you find easier bugs to fix.19:31
derycktrivial means (for lp devs) something that can be fixed in an hour.  "easy" is a bit longer but still short work.  maybe 2-3 hour fix all told.19:32
deryckYou can look through these bugs above if you like, but I've spent some time with them already this morning....19:32
deryck....so I've found a bug that will be a nice one to demo how to approach fixing bugs.19:32
deryckLet's look at bug 470430 and start working on how to fix Launchpad  bugs now.19:33
deryckhttps://bugs.launchpad.net/launchpad/+bug/47043019:33
deryckThis is an older bug that outlines that the icon for the link "Copy packages" is bad.19:34
deryckSee the bug report for a link to a page that has the bad link on it.19:34
deryckWe currently use the edit icon that is used too much on Launchpad, and mpt recommends a new icon or an expander icon.19:35
deryckBut we can also just remove the icon to fix the issue.19:35
deryckThe first thing I would do is simply search the soyuz templates to find the one that has the link for "Copy packages."19:36
deryck(I know to look in soyuz because I know that's the part of lp that deals with packaging on Launchpad.)19:36
deryck(If you want to work on an easy bug like this but don't even know where to start, ask in #launchpad-dev here on Freenode.)19:37
deryckfeel free to ping me if no one responds :)19:37
deryckSo back to the bug in question....19:37
deryckTo find this link, I would change to the devel tree and run:19:37
deryckgrep -rI "Copy packages" lib/lp/soyuz/templates/19:37
deryckIf you do that, you'll find that it returns nothing.  This is a clue that the link is created in Python code rather than a template.19:38
=== yofel_ is now known as yofel
deryckSo I need to look in the browser code I told you about earlier:19:38
deryckgrep -rI "Copy packages" lib/lp/soyuz/browser/19:39
deryckThis gives me:   http://pastebin.ubuntu.com/642798/19:39
deryckThe "text" and "label" bits there look promising.19:40
deryckSo I now want to open lib/lp/soyuz/browser/archive.py in an editor and see what's happening there.19:40
deryckWe need to search the file for the phrase "Copy packages".19:40
deryckWe can find a function that is called "copy" which creates a link from a class called "Link".  This looks like it!19:41
deryckSee the code pasted here:  http://pastebin.ubuntu.com/642799/19:41
deryckThat line also sets the icon to "edit."  And this is the cause of our bug.19:42
deryckSo the easy fix is to just remove the icon line and make it like:  http://pastebin.ubuntu.com/642801/19:42
deryckThe fix is at line 5 in the paste.19:42
deryckAnd now we've fixed a trivial bug! :-)19:43
deryckThe next steps would be to branch from devel, create your own branch with this fix in it, and push it up to Launchpad.19:44
deryckThen propose it for merging into lp:launchpad.19:44
deryckA Launchpad dev should then step in and help you get your changes landed.19:44
deryckAny questions about all that?19:44
deryckIt really is just that easy to fix easy bugs. :)19:46
deryckToday we've been through getting setup with lp dev, finding our way around the code base, finding bugs, and learning how to approach fixing easy bugs.19:47
deryckPlease ask around on #launchpad-dev if you'd like to get more involved with launchpad development and try your hand at fixing these kinds of bugs.19:47
deryckThanks for attending the session everyone!  That's all I have.19:48
deryckI'll hang around until the next session if any lingering questions arise.19:48
ClassBotThere are 10 minutes remaining in the current session.19:51
ClassBotThere are 5 minutes remaining in the current session.19:55
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: DEX - how cross-community collaboration works - Instructors: nhandler
nhandlerHello everyone. My name is Nathan Handler. I am an Ubuntu Developer and a member of the DEX team.20:01
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/12/%23ubuntu-classroom.html following the conclusion of the session.20:01
nhandlerI am also spending the summer participating in Google's Summer of Code with Debian, where I am working with Matt Zimmerman and Stefano Zacchiroli on creating some tools for DEX.20:02
nhandlerThis session will probably be on the shorter side. So please feel free to ask questions at any time in #ubuntu-classroom-chat. Please be sure to prefix them with QUESTION:20:03
nhandlerThe first thing I am sure some of you are wondering is, "What is DEX?".20:03
nhandlerDEX is the Debian dErivatives eXchange. Normally, Debian-based derivatives pull packages from Debian and then merge in changes that they have made.20:04
nhandlerThe goal of DEX is to get these changes applied in Debian to make things easier for the derivatives and to allow all of the derivatives to benefit from the changes.20:04
nhandlerThe DEX homepage is available at http://dex.alioth.debian.org/20:04
nhandlerCurrently, the only derivative that is actively participating in DEX is Ubuntu.20:04
nhandlerWe organized our first project, ancient-patches, several months ago.20:05
nhandlerDetails about the project are available here: http://dex.alioth.debian.org/ubuntu/ancient-patches/20:06
nhandlerOne issue that we had with that project was that it took too much time to create a new project, and all changes had to be committed to the VCS on alioth (which required membership in the alioth team).20:07
nhandlerThat is why I am spending the summer creating a new dashboard and some other tools to make DEX easier to use. You can see what the dashboard currently looks like here: http://dex.alioth.debian.org/gsoc2011/projects/dex.html20:07
nhandlerKeep in mind, there are still many bugs and other issues that need to be fixed before the dashboard can be deemed stable.20:08
nhandlerOne thing you will notice is that there are now two projects showing up on the dashboard. There is the old ancient-patches project, but there is also a python2.7 project. This python2.7 project is being organized by Allison Randal.20:09
nhandlerThere is a brief FAQ available for using the dashboard: http://dex.alioth.debian.org/gsoc2011/docs/FAQ20:10
nhandlerIt explains how projects can either be created by applying special usertags to a set of bugs in the Debian BTS, or they can be specified in a plain text file by connecting via ssh to wagner.debian.org20:11
nhandlerThe table (while currently not functioning) will eventually support adding and modifying tasks via the web20:13
nhandlerThis means that there will be no need for every participant in a DEX project to have membership in the alioth team like there was for ancient-patches20:14
ClassBotrww asked: Those dashboard graphs look pretty. What did you use to generate them?20:14
nhandlerrww is referring to the graph that is displayed at the bottom of each project to track the number of open tasks versus time. These graphs are currently updated once each day via cron using matplotlib. They still have some issues that need to be sorted out, but they should be functional.20:15
nhandlerEventually, there will be a second graph on each project page. This graph will be a bar graph that shows the most active people in a DEX project. The idea is to allow new contributors to get instant visual recognition for their contributions20:16
ClassBotpleia2 asked: So everything is handled through Debian BTS? So other derivatives can participate without DEX specifically having to take into consideration their BTS (launchpad, bugzilla, etc)?20:16
nhandlerEventually, I might add some support to the dashboard for downstream bug trackers. But for now, the goal of DEX is to get those downstream changes applied in Debian, which will involve a bug getting filed in the BTS.20:17
nhandlerIf a derivative has a project whose tasks are downstream bugs, DEX would allow them to do this, but it would not pull in any additional information about those downstream bugs (i.e. status, owner, package, etc)20:18
ClassBotpleia2 asked: Even though Ubuntu is the only one actively participating, have many other derivatives shown serious interest?20:18
nhandlerI have not seen that many posts from other derivatives on the mailing list. However, the debian derivatives front desk put together a census shortly before DEX started up. They got a fairly nice response: http://wiki.debian.org/Derivatives/Census . I have a feeling some of the larger derivatives will get involved in DEX once it gets more stable and organized20:20
nhandlerAt this point, some of you are hopefully wondering how you might go about getting involved with DEX.20:21
nhandlerIf you are interested in helping out with a project, you could help out with the python2.7 project. We will also soon be starting a large merges project that you might be interested in.20:22
nhandlerMost of these projects will be discussed on the debian-derivatives mailing list (http://lists.debian.org/debian-derivatives/).20:23
nhandlerYou do not need to be an Ubuntu or Debian developer to help out. For the ancient-patches project, most of the people involved were not Debian Developers.20:23
nhandlerA lot of the work tends to be triage-related. We need to figure out whether the change is needed in Debian, whether it has already been applied, search for and report bugs on the BTS, and talk to the package maintainers to decide on the best approach. While packaging knowledge might help, being an official developer is not needed to perform those tasks.20:24
nhandlerWe also would appreciate help testing the dashboard, and any suggestions for tools and other improvements that we could make to make DEX easier to get involved with.20:25
nhandlerFinally, if you are interested in starting a DEX project of your own, either for Ubuntu or another Debian-based derivative, simply send an email to the debian-derivatives mailing list or stop by #debian-derivatives on oftc, and we would be more than glad to help you get started.20:26
nhandlerAny questions at this point?20:26
nhandlerIn that case, I'll take a few minutes to go back and talk about why DEX is doing what it does.20:28
nhandlerIn the first part of the Ubuntu release cycle, we spend time pulling updates packages from Debian. If we have not modified them in Ubuntu before, we can use tools to automatically do this (sync).20:28
nhandlerIf we have made changes, a developer needs to manually update the package (merge).20:29
nhandlerSimiler tasks occur in other Debian-based erivatives.20:29
nhandlerIf we take some time to get the changes made in Ubuntu back into Debian, it means less work for us, as we get to sync the package in the future.20:30
nhandlerIt also means that Debian, and all other Debian-based derivatives get to benefit from our changes. If other derivatives do the same thing, we get to benefit from their changes as well.20:31
nhandlerSo everybody benefits from this work, not just Ubuntu or Debian.20:31
nhandlerAny questions on that?20:31
nhandlerFinally, I'll talk a bit about what will be happening with DEX in the future.20:33
nhandlerFirst, the dashboard, as a GSoC project, should be done in about a month. This means that it will be available for all DEX projects to use.20:34
nhandlerWe are also working on ensuring that we have plenty of documentation about how to get involved with DEX and the individual DEX projects. This should make it trivial for people of any skill level to get involved.20:34
nhandlerAs you can see on http://dex.alioth.debian.org/gsoc2011/projects/dex-ubuntu-python2.7/graph.svg , the python2.7 project is slowly but steadily progressing. That project should finish up soon.20:35
nhandlerOnce it is done, we will be starting a large merges project.20:36
nhandlerThis project will find the Ubuntu packages that differ the most from their Debian counterparts and attempt to send as many of our changes upstream to Debian as possible.20:37
nhandlerThat will probably be the first project to rely entirely on the DEX dashboard.20:37
nhandlerOnce that project is underway, I hope to talk to some of the people involved with the census that I linked to earlier about getting some other derivatives involved with DEX. It will be great being able to see a long list of projects that are being worked on.20:39
nhandlerAny questions about any of the future plans?20:40
ClassBotrww asked: (sorry, I went afk so this is about something from earlier) For people looking to get into DEX, what sort of skillset are you looking for? Programming? Packaging? etc.20:40
nhandlerThe specific skills will depend on the project. For the large merges project, packaging knowledge will definitely prove useful. For the ancient-patches project, it was mainly triage work. So anyone able to navigate LP, the BTS, and changelogs was able to help out.20:41
nhandlerHowever, due to the nature of DEX, most of the tasks are fairly similar and repetitive. That is why we are going to spend a lot of time ensuring that projects are properly documented.20:42
nhandlerThis means that you should be able to work on a task, follow the documentation, ask a few questions, and get it sorted out. After doing that a few times, you will probably be able to handle most of the non-special tasks in a project.20:43
nhandlerFinally, before I conclude here, I want to make sure everyone is aware of some links and resources that might prove useful if you choose to get more involved.20:44
nhandlerFirst, there is #debian-ubuntu and #debian-derivatives on oftc (oftc is the irc network that most of the Debian channels live on). #debian-ubuntu is for the Ubuntu specific DEX stuff, and #debian-derivatives is more about DEX in general.20:45
nhandlerYou should be able to ask most of your questions there and get pointed in the right direction.20:46
nhandlerhttp://dex.alioth.debian.org/ is the main DEX website. http://dex.alioth.debian.org/ubuntu/ is the Ubuntu DEX Team website. They are slightly outdated right now, but still have some useful information.20:47
nhandlerhttp://dex.alioth.debian.org/gsoc2011/projects/dex.html is the current location of the DEX Dashboard. It is still a work in progress, and the URL will probably change once it is stable.20:48
nhandlerhttp://lists.debian.org/debian-derivatives/ is the debian-derivatives mailing list (this is @lists.debian.org, not @lists.ubuntu.com). That is where the projects will be discussed and announced. It is relatively low-volume, so I would suggest subscribing.20:49
nhandlerFinally, you can always email me or PM me on IRC (the same is true of most members of the DEX team) with any questions/comments you might have.20:50
nhandlerThat is all that I have. Does anyone have any last questions?20:50
ClassBotThere are 10 minutes remaining in the current session.20:50
nhandlerIn that case, thank you everyone who attended the session. This concludes my DEX session and the second day of Ubuntu Developer Week. I will stick around until the end of the hour in case anyone thinks of any more questions.20:52
ClassBotThere are 5 minutes remaining in the current session.20:55
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/07/12/%23ubuntu-classroom.html21:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat ||
=== skaet is now known as skaet_afk
=== skaet_afk is now known as skaet
=== datastream is now known as datastream_
=== Ursinha-lunch is now known as Ursinha

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!