| @dholbach | Hello everybody! We'll move on to Packaging 101 now. If you have any questions, can you PLEASE move them to #ubuntu-classroom-chat and add "QUESTION: " to them, to make them easier readable |
| @dholbach | I'll have a look every now and then and answer them, if they refer to what I'm currently talking about, if not we can deal with them later. |
| @dholbach | If you want to become part of the MOTU team, or help out with packaging in general, apart from knowing how to write or debug code, it's good to know the tools the distribution uses. |
| Adri2000 | hi :) |
| @dholbach | This session won't make you a packaging expert, but afterwards you will have heard of some things, which will make it easier to find your way around. There'll be a MOTU session on Wednesday, 15.00 UTC and Saturday on 16.00 UTC, which will cover what the MOTU team does in more detail. |
| xeruno | why isn't this channel moderated? |
| @dholbach | Please run the following command, it will take some time to work in the background. |
| @dholbach | sudo apt-get install pbuilder; sudo pbuilder create |
| _tx | hi |
| @dholbach | rmjb: MOTUs are the "Master of the Universe", the team of maintainers that takes care of the package in Universe and Multiverse - that's where you start as a package maintainer. |
| @dholbach | rmjb: http://wiki.ubuntu.com/MOTU |
| @dholbach | Packaging - what does that involve? |
| @dholbach | * adding enough information to the Upstream source, to make it buildable on a minimal system. |
| @dholbach | * split the installed files up into separate packages depending on the target audience |
| xeruno | dholbach, could you please moderate this channel? |
| @dholbach | ^- example everybody uses libgtk2.0-0, but not everybody has an interest in libgtk2.0-dev |
| apokryphos | with +z would be better |
| @dholbach | come on guys, that's not necessary at the moment |
| @dholbach | move chatter and discussion to #ubuntu-classroom-chat please |
| jpetso | xeruno: it worked before, i think it's ok to trust everyone on being quiet |
| @dholbach | * make the packages work out of the box |
| @dholbach | * add copyright information, nice description, documentation, etc. |
| @dholbach | Package maintenance involves far more than that, Jordan Mantha (Laser_away) will give a talk about that later today at 21.00 UTC and Thursday at 20.00 UTC. |
| @dholbach | First we'll install some tools we'll need for the session: |
| @dholbach | sudo apt-get install devscripts dpkg-dev build-essential |
| _tx | what about complying programs in Ubuntu to be able to work on all the platforms (ppc, x86, and x86_64) |
| @dholbach | I also prepared an example package we'll use also: |
| @dholbach | mkdir 101; cd 101; wget http://daniel.holba.ch/temp/packaging101.tar.gz |
| jonh_wendell | dholbach: what does pbuilder create do? |
| @dholbach | jonh_wendell, _tx: #ubuntu-classroom-chat please and add "QUESTION:" to your questions |
| giskard | _tx, we have autotools for this kind of stuff (if i understand correctly your question)(btw, question on -chat) |
| nmsa | C(01:06) <@dholbach> mkdir 101; cd 101; wget http://daniel.holba.ch/temp/packaging101.tar.gz |
| nmsa | sorry :) |
| @dholbach | I learned most from looking at existing packages and trying to fix them, so let's take a look at the libsexy package. It's the one in feisty, I broke a bit to illustrate a few common problems you'll face in the daily work as a package maintainer or Ubuntu developer. |
| @dholbach | If you untar the packaging101 tarball, you'll find the following files: |
| @dholbach | libsexy_0.1.10-1ubuntu1.diff.gz libsexy_0.1.10-1ubuntu1.dsc libsexy_0.1.10.orig.tar.gz |
| _tx | Some things I write don't work well with ppc or x86 but work well on the x86_64 namely my system. |
| @dholbach | Together they make the source package. The .orig.tar.gz is called the 'original upstream tarball', the '.diff.gz' file is the changes we need to do to make the package buildable and working correctly in Ubuntu. The .dsc provides meta information like checksums, etc. |
| @dholbach | To unpack the source package run |
| @dholbach | dpkg-source -x libsexy_0.1.10-1ubuntu1.dsc |
| @dholbach | If you change into the directory and have a look into it, you'll find a debian/ directory, which contains the packaging information. |
| @dholbach | Let's try to build the package now. You can use dpkg-buildpackage, but running debuild is easier mostly. So to run a build, simply type |
| @dholbach | debuild |
| @dholbach | |
| @dholbach | in the directory. |
| _tx | Question:How well do users give you feedback here? |
| @dholbach | The friendly build script might now ask you to install some build dependencies, after you did that, it should be spitting out some interesting messages. |
| @dholbach | _tx: in #ubuntu-classroom-chat |
| mattl | jono: all set? |
| @dholbach | in my case the build is complaining (among other things) about the following: |
| @dholbach | sexy-tooltip.c: In function 'sexy_tooltip_new_with_label': |
| @dholbach | sexy-tooltip.c:143: warning: implicit declaration of function 'gtk_label_new' |
| @dholbach | sexy-tooltip.c:143: warning: assignment makes pointer from integer without a cast |
| @dholbach | sexy-tooltip.c:144: warning: implicit declaration of function 'gtk_label_set_markup' |
| @dholbach | sexy-tooltip.c:144: warning: implicit declaration of function 'GTK_LABEL' |
| @dholbach | It's a problem I added myself. :-) |
| jonh_wendell | :) |
| @dholbach | We will need to patch the source to make it build again. |
| @dholbach | If you have a look at debian/rules you will see that it mentions /usr/share/cdbs/1/rules/simple-patchsys.mk - after working with packages for a while that it means you can use cdbs-edit-patch to add a patch. Martin Pitt (pitti) will give a separate session on how to patch packages on Thursday, 18:00 UTC. |
| @dholbach | First we run fakeroot debian/rules clean to clean up our existing build again. |
| @dholbach | next we run cdbs-edit-patch 01-fix-gtk-breakage |
| @dholbach | as I said before, pitti will explain what happens then :-) |
| pitti | correction: patching source packages will be Tuesday 18:00 and Thursday 17:00 UTC |
| @dholbach | thanks pitti |
| @dholbach | (Note: cdbs-edit-patch needs cdbs installed.) |
| @dholbach | Once we're presented with a subshell, in a directory like /tmp/cdbs-new-patch.R29983/libsexy-0.1.10.new , we edit libsexy/sexy-tooltip.c with our editor of choice |
| @dholbach | and add a missing #include <gtk/gtk.h> |
| @dholbach | just below the existing #include |
| @dholbach | now save the file, and hit Ctrl-D |
| @dholbach | ls debian/patches/ should show our shiny new patch |
| @dholbach | Now we run debuild again and see if we fixed the package. |
| @dholbach | It looks like our attempt succeeded. |
| @dholbach | ls ../*.deb will show us the packages we made |
| @dholbach | I'll answer a bunch of questions after the next step. |
| @dholbach | As I explained above, part of the packaging work is trying to make sure that a package builds in a minimal environment also. Why? |
| @dholbach | Because on our build daemons, a minimal system will be created for each package build to make sure it works in every, even a fresh, scenario. |
| @dholbach | We will now generate a new source package with the changes we made earlier. |
| @dholbach | fakeroot debian/rules clean |
| @dholbach | debuild -S -sa |
| @dholbach | should take us there. |
| @dholbach | cd ..; sudo pbuilder build libsexy_0.1.10-1ubuntu1.dsc should give the pbuilder some work and we can take a look at a few questions. |
| guebay | What is the diff between debuild and dpkg-buildpackage? |
| @dholbach | <xeruno> QUESTION: what's cdbs |
| @dholbach | cdbs is a collection of scripts that make packaging, especially writing debian/rules (a Makefile to automate the package build) a lot easier, by simplifiying common tasks. |
| @dholbach | <TLE> QUESTION: Will the script disregard temporary editor files when it does the patch ? |
| @dholbach | TLE: I'm not sure what you mean with editor files |
| giskard | xeruno, and.. you can read the package Description: (apt-cache show cdbs) |
| giskard | dholbach, i guess .swp or file~ |
| @dholbach | It's better to get rid of them. They will show up in the .diff.gz and in case of binary files make the build fail. |
| @dholbach | <DraxNS> QUESTION: is there a short manual on how to make simple packages? like to create package for krusader from source? |
| @dholbach | I will later post some links to help with packaging, but I fear that packaging will always be a bit tough in the beginning. |
| @dholbach | <amarillion> QUESTIION: Will debuild automagically add all patches in the debian/patches directory |
| @dholbach | amarillion: the rules in debian/rules (namely simple-patchsys.mk) takes care of that |
| @dholbach | <bettsp> QUESTION/ASSERTION: It only succeeds if my name is Daniel Holback |
| giskard | ahah |
| @dholbach | bettsp: I'm sorry, yes you're right. Either disregard the message or run debuild with -k<your keyid> |
| @dholbach | <proppy> QUESTION: you refer to 'our build daemon' is that kind of pbuilderd ? |
| @seb128 | (it works too when it can't sign the package) |
| @seb128 | (that's just a warning) |
| bettsp | dholbach: You forgot to run the S-expression I added in the next line to fix my misspelling of your name :) |
| @dholbach | proppy: the build daemons ( https://launchpad.net/+builds ) use sbuild, which is very similar |
| @dholbach | bettsp: yes, I should have said "please add" |
| @dholbach | Ok, my pbuilder is 'finished' now - we'll get back to questions later again. |
| @dholbach | funnily enough the build fails with: |
| @dholbach | checking for PACKAGE... configure: error: Package requirements (pango >= 1.4.0, glib-2.0 >= 2.4.0, gtk+-2.0 >= 2.4.0, libxml-2.0) were not met: |
| @dholbach | No package 'gtk+-2.0' found |
| @dholbach | This is because libgtk2.0-dev is not installed in the minimal environment I was talking about, but how does pbuilder know what to install? |
| @dholbach | if you edit debian/control you will find the line Build-Depends |
| @dholbach | This line indicates the packages that need to be installed to build the package correctly. We'll just add libgtk2.0-dev |
| @dholbach | after that we'll run debuild -S again |
| @dholbach | please note that this time we don't need to run fakeroot debian/rules clean why? |
| proppy | (cause we build using pbuilder) |
| @dholbach | because the build happened in that clean environment, not in the source dir - another good point about using pbuilder |
| @dholbach | let's run sudo pbuilder build libsexy_0.1.10-1ubuntu1.dsc again and see if we get it working now |
| @dholbach | <levander> QUESTION: What all does fakeroot debian/rules clean do? |
| @dholbach | levander: it runs the clean target of the upstream source (so whatever the upstream maintainer thought should be cleaned), plus dh_clean and rules you set up yourself |
| @dholbach | <TLE> QUESTION UPDATE, if I edit the source with emacs, emacs creates a temp file, will the script disregard that when it makes the diff for the patch ? |
| @dholbach | TLE: I'm not sure which file you're referring to. I'm emacs illiterate - sombody else please answer. :-) |
| @dholbach | <daxelrod> QUESTION: How would we know from the error message mentioning 'gtk+-2.0' that the package we need is 'libgtk2.0-dev'? Is there a convention for figuring this out? |
| nmsa | j #ubuntu-classroom-chat |
| @dholbach | daxelrod: excellent question. |
| engla | Emacs will create a sexy-tooltip.c~ backup file, and that will be included in the diff if you don't remove it |
| engla | likewise will gedit by default |
| @dholbach | One answer to that is: experience with packaging. But there are also some indicators of where to look: |
| jordi | TLE: if you mean backup files, yes, the "debhelper" system is smartyt enough to not ignore them, but get rid of them when you "clean" the package. |
| @dholbach | In the configure script it failed, because it tried to look up in /usr/lib/pkgconfig |
| @dholbach | so if the build fails for you in pbuilder, but works if you run on your system, you can easily check that directory and find out, where and why it went wrong |
| @dholbach | apt-cache search <...> or apt-file search <...> can help also |
| @dholbach | The pbuilder build worked for me right now, but there are still some things that are weird: |
| giskard | check configure.ac is another solution ;) |
| @dholbach | If you run dpkg -c /var/cache/pbuilder/result/libsexy-doc_*.deb (which displays the contents of the package), you will find it's nearly empty |
| @dholbach | it merely contains a couple of changelogs and copyright notices - what went wrong? |
| @dholbach | If we look into the debian/ directory, you will see that it contains a couple of *.install files |
| @dholbach | these files mention which directories and files are supposed to be installed into which package |
| @dholbach | debian/libsexy-doc.install is empty |
| @dholbach | if you run debuild (to build the package again) and dh_install --list-missing afterwards, it will present you with a list of files that were not installed into any package |
| @dholbach | once we add debian/tmp/usr/share/gtk-doc/html to debian/libsexy-doc.install it will contain something |
| @dholbach | now we can run debuild binary to not have to go through the whole procedure again, but only rebuild the packages |
| @dholbach | You will find that if you run dpkg -c libsexy-doc*.deb again, it will contain the documentation |
| @dholbach | I introduced some more bugs into the package, but given that we only have 19 minutes left, we should probably move on to some more questions. |
| @dholbach | <proppy> QUESTION: debian/libsexy-doc.install doesn't exist |
| @dholbach | hum, it existed for me - anyway, it was supposed to be an empty file. |
| @dholbach | <nmsa> Q: install pbuilder is still on, slow connection, will it install a new env. will get all packages from net? is doing validation on retrieved packages ... 'thnx |
| @dholbach | nmsa: it's not installing all packages, but only a very minimal set, needed to build packages - cjwatson: which packages are considered by debootstrap? |
| @dholbach | build-essential will be contained in any case. |
| @dholbach | <Florob> QUESTION: Are *.install files cdbs specific? |
| @dholbach | Florob: no, they're not. They're scanned by dh_install. |
| @dholbach | <amarillion> QUESTION: which is the preferred format for documentation? Should you provide docs in a certain format if they aren't provided upstream? |
| @dholbach | manpages are a good example of documentation that sometimes does not exist. |
| @dholbach | It's always good to push it back to the upstream developers afterwards again. |
| @dholbach | I don't have a link on manpages handy, but I could find you one. I have a template I always use to get started on them. |
| at2000 | which packages are considered by debootstrap? the list is in the script /usr/lib/debootstrap/scripts/<version> |
| @dholbach | <rmjb> QUESTION: is the *.install file method the correct way for one source package to have multiple binary targets? like a lib, lib-dev, -doc and so on? |
| @dholbach | rmjb: some people use *.dirs files or run dh_install to debian/<binary package name> on their own, I personally prefer the .install file method |
| @dholbach | <xhaker> QUESTION: how about policy on packages. I read executables on /usr/bin must have manpages. |
| @dholbach | manpages are not a strict must have, but they come in very handy and users are gratefule for manpages |
| @dholbach | <somerville32> QUESTION: Is it possible to have pbuilder setup to work in multiple releases concurrently? |
| @dholbach | somerville32: there's a page on the MOTU wiki about that - if nobody finds it out in the next minutes, I can try after the talk |
| @dholbach | <xhaker> QUESTION: can i build for any version deboostrap supports? |
| sol | Should all packages install to /usr? What's the use of /usr/local? |
| sol | Should all packages install to /usr? What's the use of /usr/local? |
| @dholbach | xhaker: you can either set up a chroot for yourself (I think that's what most developers do), because that way you can test the resulting binary packages yourself, or you can have multiple differently configured pbuilders |
| gnomefreak | somerville32: https://wiki.ubuntu.com/PbuilderHowto?highlight=%28pbuilder%29 |
| @dholbach | sol: /usr/local is for software you install yourself (like if you use ./configure && make && sudo make install) |
| @dholbach | <xhaker> QUESTION: pbuilder extracts the minimal system and then downloads additional dependencies.. does it cache them? for how long? where? |
| @dholbach | xhaker: yes, it does in /var/cache/pbuilder/aptcache/ |
| xhaker | ;) |
| @dholbach | I think it stores the packages until they're superseded by a newer version |
| @dholbach | are there any other questions? |
| gnomefreak | dholbach: i grabbed the page for somerville32 |
| @dholbach | If you run into any other packaging related trouble and don't know where to look in the documentation, your first check could be similar packages, then ask the people on #ubuntu-motu or on ubuntu-motu@lists.ubuntu.com |
| rmjb | thanks for a great session dholbach |
| proppy | dholbach: 18:50 <proppy> <proppy> QUESTION(bis): can i chroot inside a pbuilder |
| proppy | environment to debug a packaging failure ? |
| jonh_wendell | do we have to do a clean before every debuild? even if we change just 1 char in some file? |
| engla | thanks, I learnt a lot (even though I built debs before) |
| @dholbach | proppy: yes, you can sudo pbuilder login can help with that |
| proppy | dholbach: thx |
| cjwatson | debuild cleans for you unless you use the -nc option |
| guebay | dholbach: thumbs up :) |
| @jono | ok five min break |
| @jono | till the next session |
| Jucato | yay! |
| @dholbach | jonh_wendell: no you don't - you can run debuild binary to benefit from a previous build and just restart from wherever the build failed |
| @dholbach | thanks everybody |
| amnesia | dholbach: thanks for the session, good job! |
| @dholbach | see you in #ubuntu-motu or on ubuntu-motu@lists.ubuntu.com |
| Florob | jono: great, now it really feels like school ;) |
| @dholbach | thanks a lot |
| sol | thanks :-) |
| fernando | dholbach: thanks |
| amarillion | Thanks dholbach. That is certainly a lot of information to absorb |
| nmsa | dholbach: thank you |
| ifmy | dholbach: thanks |
| scott | no thank you dholbach |
| xhaker | see you in motu |
| DraxNS | nice class dholbach |
| somerville32 | Thanks :) |
| amarillion | Florob, not unless you get homework |
| thekorn | thanks dholbach |
| @jono | :P |
| alfmatos | dholbach, nice, thanks a bunch. |
| somerville32 | The PBuilderHowto page is kind of confusing. |
| @dholbach | sorry, I forgot: https://wiki.ubuntu.com/MOTU/Documentation <========0 |
| berndl | a question which has partly to do with packaging: are there plans on creating a community driven repository (with really up to date packages) like arch-linux has? |
| engla | it would be nice with not only a log, but a cleaned-up summary on the wiki pages (with links). But you know, we could all help out with that if we get to start with the log |
| engla | that way this week could be saved in a box for all |
| @jono | engla, I am going to encourage people to summarise the sessions too |
| @jono | would be useful |
| LaserJock | berndl: that would be the Universe and Multiverse repository |
| siretart | berndl: sort of. I have plans to make REVU, a reviewing platform doing something similar |
| engla | jono: I'm thinking we could link the schedule items to subpages |
| @jono | right |
| engla | I'll help |
| @jono | :) |
| nalioth | engla: jono if you like, you can use w.u.c/ClassroomTranscripts |
| @jono | the sessions so far have been awesome |
| @jono | nalioth, :) |
| berndl | laserjock: yeah, sort of :) but i think it is much easier to get into packaging for everyone in arch than in ubuntu. but perhaps this is the reason we're here to make things easier... :) |
| elvstone | phew. |
| elvstone | ..and sneaks away for some nicotine. |
| berndl | siretart: do you have any specs online for revu? |
| @jono | ok, we all set? |
| Smiffeh | Wonder if Ask Mark tomorrow will end up being productive, or just an excuse for people to quiz him on his openSuSE post. |
| nalioth | probably be a +mz kind of day |