[01:00] <nhandler> Hello everyone. My name is Nathan Handler, and today we will be learning about pbuilder.
[01:00] <nhandler> Can I have a quick show of hands from anyone who is here for the session?
[01:00] <Quintasan> \o
[01:01] <mschafer> Howdy.
[01:01]  * mbt raises his hand
[01:01] <nhandler> If at any point in the session you have a question, feel free to stop me in order to ask it.
[01:01] <sdennie> \o
[01:01] <nhandler> When packaging, it is very important to test that the package builds prior to uploading it to the official repositories.
[01:02] <nhandler> Test building allows us to catch and fix mistakes before the package is made available to thousands of other users.
[01:03] <evanrmurphy> sorry I'm late
[01:03] <nhandler> The majority of uploads for Ubuntu are for the development release (currently Ubuntu 9.10, Karmic Koala). However, due to the unstable nature of the development release, many developers prefer to stick with a slightly more stable release.
[01:03] <nhandler> No problem evanrmurphy ;)
[01:03] <nhandler> This is where pbuilder comes into play.
[01:04] <nhandler> pbuilder allows developers to create and manage a minimal Ubuntu chroot.
[01:04] <nhandler> The great thing about pbuilder is that the chroot can be for any version of Ubuntu, not just the one you are currently running.
[01:05] <nhandler> This allows developers to package for the development release while still running the latest stable release on their computers.
[01:05] <nhandler> A pbuilder chroot only contains the core essential packages. This allows developers to verify that their build dependencies are correct.
[01:06] <nhandler> Once a package is done building in pbuilder, the chroot is left untouched. This means that it can be used to build multiple packages without worrying about it getting cluttered with extra files and applications.
[01:06] <nhandler> Right about now, you should be starting to see why so many developers use pbuilder to test their packages prior to uploading.
[01:07] <nhandler> For those of you who attended Dustin Kirkland's session about Personal Package Archives (https://wiki.ubuntu.com/Packaging/Training/Logs/2009-05-07), you might be wondering why you would want to use pbuilder instead of simply uploading to your PPA on Launchpad.
[01:07] <nhandler> There are a few reasons you might want to do this.
[01:08] <nhandler> First, PPAs only support building packages for amd64, i386, and lpia. However, Ubuntu builds packages for several other architecutres. You can use pbuilder to test that your package will build on these archs.
[01:09] <nhandler> Since Launchpad PPAs are used by thousands of users, there is a delay between the time you upload your package and the time it begins to build. This delay does not exist with pbuilder (you also do not need to upload the package).
[01:09] <nhandler> pbuilder also has several other benefits that will be discussed later.
[01:10] <nhandler> Earlier, I mentioned that pbuilder was for creating and managing Ubuntu chroots. That was only partially true.
[01:10] <nhandler> pbuilder can also be used to create and manage Debian chroots. This is very useful for users who contribute to both Ubuntu and Debian.
[01:11] <nhandler> You can also have multiple chroots for different Ubuntu and Debian versions. I personally have a chroot for intrepid, jaunty, karmic, and sid.
[01:11] <nhandler> Finally, for those of you running amd64, you can also use pbuilder to build i386 packages. However, you can't build amd64 packages on i386.
[01:12] <nhandler> The ~/.pbuilderrc file is what you will use to configure pbuilder.
[01:12] <nhandler> All developers have a slightly different system for handling multiple chroots with pbuilder.
[01:13] <nhandler> I keep all of my pbuilder stuff on an external hard drive, and I have a special script to help me switch between my multiple ~/.pbuilderrc files. I have made these files available in a bazaar branch: lp:~nhandler/+junk/pbuilder
[01:13] <nhandler> If you decide to use my scripts, be sure to modify the varaible at the top of the files so that it has the correct path.
[01:14] <nhandler> You can then do '/media/pbuilder/switchPbuilder karmic' to switch to the karmic pbuilderrc file. Note that this will cause you to lose your current ~/.pbuilderrc file (if it exists). You might want to back it up first.
[01:14] <nhandler> The above command assumes that you places the pbuilder files at /media/pbuilder. If they are anywhere else, your command will be slightly different
[01:15] <nhandler> If this is the first time using the pbuilderrc file, you will need to do a 'sudo pbuilder create' before you can do anything.
[01:15] <nhandler> Any questions?
[01:15] <sdennie> Yes, but I'll wait.  ;)
[01:16] <nhandler> Ok sdennie
[01:16] <nhandler> Now we will take a look at pbuilder hooks.
[01:16] <Quintasan> I have a suggestion if you allow :P
[01:16] <nhandler> Go ahead Quintasan
[01:17] <Quintasan> if you are new to pbuilder and need many chroots, try using .pbuilderrc form ubuntu wiki -> https://wiki.ubuntu.com/PbuilderHowto#Multiple pbuilders
[01:18] <nhandler> Quintasan: I link to that later. The issue with that is that the setup on the wiki does not work well for other scripts that run pbuilder for you.
[01:18] <nhandler> This is because you need to pass a dist option to pbuilder each time with that setup
[01:19] <nhandler> Quintasan: However, thank you for linking them to the wiki page (I was going to do that later ;) )
[01:19] <nhandler> Now, back to hooks
[01:19] <nhandler> Hooks allow us to extend the functionality of pbuilder to make our lives easier.
[01:20] <nhandler> I use 3 hooks with pbuilder: B10list-missing (list missing files), C10shell (drops to shell upon FTBFS), and D10aptupdate (run apt-get update before anything).
[01:21] <nhandler> I have created a bazaar for these hooks as well: lp:~nhandler/+junk/hooks
[01:21] <nhandler> You can place them in /media/pbuilder/pbuilder/hooks. Be sure to leave the prefix on the filenames.
[01:22] <nhandler> Hooks beginning with B<digit><digit><name> are executed after the build system finishes building successfully and before copying back the build result.
[01:22] <nhandler> C<digit><digit><name> hooks are executed after build failures and before cleanup
[01:23] <nhandler> D<digit><digit><name> hooks are executed before unpacking the source inside the chroot.
[01:23] <nhandler> There are several other prefixes that you can use for your hooks. You can read more about them in the pbuilder manpage.
[01:24] <nhandler> Now, to test out using pbuilder, we are going to try and build the hello package.
[01:24] <nhandler> Before doing this, make sure you have 'deb-src http://archive.ubuntu.com/ubuntu/ karmic main' in your /etc/apt/sources.list (This line for other Ubuntu versions should work as well) or the ubuntu-dev-tools package installed.
[01:25] <nhandler> You can now do 'apt-get source hello' or 'pull-lp-source hello karmic' to download the hello source package.
[01:26] <nhandler> This should consist of a .diff.gz, a .dsc, and a .orig.tar.gz. We will now build the binary package using pbuilder.
[01:26] <nhandler> Type 'sudo pbuilder build hello_*.dsc' to start building the binary. You can use 'sudo pbuilder build --logfile build.log hello_*.dsc' if you want to store the build log to a file.
[01:27] <nhandler> If you are using my pbuilder files, you should now look in /media/pbuilder/pbuilder/result/karmic, and you should see a nice .deb that you can install (if you want).
[01:27] <evanrmurphy> log since 00:01 UTC, for those who just came: http://paste.ubuntu.com/203246/
[01:27] <nhandler> You have successfully built the hello package in pbuilder!
[01:28] <nhandler> Any questions/problems so far?
[01:28] <sdennie> nhandler: Yes
[01:28] <nhandler> Go ahead sdennie
[01:28] <sdennie> nhandler: You didn't describe how pbuilder was creating the toolchain for the distro you planned to build against or what the technology was to allow that to happen.  I'm assuming some fakeroot magic for the latter.
[01:30] <nhandler> sdennie: That magic lies in the /usr/lib/pbuilder/pbuilder-createbuildenv file.
[01:31] <nhandler> That file uses debootstrap to create the chroot
[01:31] <sdennie> Excellent.  That's answers the first part.
[01:32] <sdennie> Or maybe both parts
[01:33] <sdennie> Anyway, don't let me stop you.  We can chat offline if I have more questions.  :)
[01:33] <nhandler> sdennie: debootstrap is the technology that allows it to happen. If you want to get more detailed, feel free to take a look at the debootstrap source, but that is a little more advanced than we will go tonight ;)
[01:34] <sdennie> Fair enough.  Proceed.  ;)
[01:34] <nhandler> If you are not using the D10aptupdate script. be sure to run 'sudo pbuilder update' prior to building a package. This will make sure that your chroot has access to the latest packages in the repositories.
[01:34] <mschafer> nhandler:  So pbuilder-createbuildenv installs both the toolchain and the other packages marked essential?
[01:35] <nhandler> mschafer: Yes, it will take care of creating a chroot with all of the packages you need for a very minimal Ubuntu/Debian installation which resembles the build daemons
[01:35] <mschafer> Okay, thanks.
[01:36] <nhandler> Now, I want to show you all a few more uses for pbuilder.
[01:36] <nhandler> There are several instances where having a clean environment to run a script would be useful.
[01:37] <nhandler> You can login to a pbuilder chroot using 'sudo pbuilder login'. Once you exit (Ctrl+d), the chroot will go back to the way it was, just like when building a package.
[01:37] <nhandler> If for some reason you want to save your changes to the chroot (i.e. If you update the /etc/apt/sources.list file), you can pass the --save-after-login option to the pbuilder command.
[01:38] <nhandler> A few weeks ago, Daniel T Chen showed us how to use piuparts to test our packages (https://wiki.ubuntu.com/Packaging/Training/Logs/2009-04-23). By using the --basetgz or --pbuilder flags, you can have piuparts use your pbuilder chroot for testing packages.
[01:38] <nhandler> Any more questions?
[01:38] <evanrmurphy> nhandler: Yes.
[01:39] <nhandler> Go ahead evanrmurphy
[01:39] <evanrmurphy> nhandler: You made a comment about pbuilder-dist earlier. Do you recommend not using it?
[01:40] <nhandler> evanrmurphy: I didn't mention pbuilder-dist earlier. I was talking about the method described on the wiki page for handling mulitple pbuiler chroots
[01:40] <nhandler> I personally do not use pbuilder-dist, but I know a lot of developers who love it.
[01:40] <evanrmurphy> nhandler: I got an error on the example you showed until I realized I had to replace "pbuilder-dist <version>" with "pbuilder", so I can see it complicates examples. ;)
[01:41] <Ampelbein> nhandler: yes. there are cases where pbuilder won't fail to build, yet the buildd's will. I was given the advice to add pkgbinarymangler as extra build-dep to resemble more closely the buildds. are there any more tweaks like that?
[01:42] <nhandler> Ampelbein: Yes, you can use 'sudo pbuilder create --debootstrapopts --variant=buildd' when creating the chroot
[01:42] <nhandler> For those of you who are interested in pbuilder-dist, it is part of the ubuntu-dev-tools pacakge
[01:42] <nhandler> * package
[01:43] <nhandler> I would suggest reading the pbuilder-dist manpage to learn about it, as its usage is slightly different than pbuilder
[01:43] <Ampelbein> ok, thanks.
[01:43] <evanrmurphy> nhandler: thanks
[01:43] <nhandler> If you are interested in learning more about pbuilder, I would suggest reading:
[01:44] <nhandler> The pbuilder manpage: http://manpages.ubuntu.com/manpages/karmic/en/man8/pbuilder.8.html
[01:44] <mschafer> nhandler:  I had been using a fresh install in a virtual machine to do builds in the past.  Sounds like pbuilder is better because it gives the minimal set of other packages.  Would you recommend pbuilder over a VM?  Any other reasons for or against?
[01:44] <nhandler> mschafer: I would suggest using pbuilder over a VM
[01:45] <nhandler> One reason is that it is more like the buildd's than a VM
[01:45] <nhandler> You also have the ability to use pbuilder hooks with it, which really are useful for debugging FTBFS issues
[01:45] <mschafer> Can you use pbuilder on an Ubuntu system to run a Debian chroot?
[01:46] <nhandler> mschafer: Yes. As I said earlier, I have both Ubuntu chroots and a Debian sid chroot
[01:47] <nhandler> mschafer: A pbuilder chroot is also generally faster and easier to use than a VM
[01:47] <mschafer> Though I would imagine that I would still need a Debian VM to actually run the application, since I'm pretty sure that Gnome is not an essential package and therefore not in the pbuilder chroot.
[01:47] <nhandler> mschafer: pbuilder will *not* help you test that the applications actually runs. It just tests that it builds
[01:48] <mschafer> Ah, gotcha.
[01:48] <nhandler> And it will pull in any Build-Depends that it needs in order to build the package
[01:48] <sdennie> That's a good point.  Does the application build outside the chroot and install/deb inside the chroot?
[01:48] <nhandler> sdennie: It doesn't install the binary .deb file that it builds. However, the file is placed outside of the chroot so that you can access it later
[01:49] <sdennie> nhandler: Right.  That's what I mean.  But, does the building happen in the chroot or does it download every dep you may need every time within the clean chroot?
[01:49] <ajmitch> all of the compilation happens in the chroot (which is why you can setup ccache in the pbuilder config)
[01:49] <nhandler> If you want, you can login to a pbuilder chroot and modify the /etc/apt/sources.list file to use your PPA in order to satisfy Build-Depends as well
[01:49] <nhandler> Let me give you guys a few more links that might help
[01:49] <sdennie> ajmitch: Thanks.  :)
[01:50] <nhandler> The Kubuntu Ninja Build Environment wiki: https://wiki.kubuntu.org/Kubuntu/Ninjas/BuildEnvironment
[01:50] <ajmitch> sdennie: a clean chroot is used for each build, but a cache of previously downloaded build dependencies is kept
[01:50] <sdennie> ajmitch: Very cool.  Thanks.
[01:50] <nhandler> The last link talks about creating an environment that takes advantage of multiple chroots and hooks.
[01:51] <nhandler> All of the hooks I mentioned today can be found in lp:~kubuntu-members/pbuilder/pbuilder-hooks
[01:52] <nhandler> Any last comments or questions?
[01:52] <sdennie> Interesting stuff nhandler.  Thanks a lot for the presentation.
[01:53] <nhandler> You are welcome sdennie. Logs of this session will be available at https://wiki.ubuntu.com/Packaging/Training/Logs/2009-06-25
[01:53] <mschafer> Thank you, nhandler.
[01:54] <nhandler> Since we have a few minutes, does anyone have any comments/suggestions about the series of Packaging Training Sessions we have been holding?
[01:54] <nhandler> Any topics that you would like to see covered?
[01:54] <Quintasan> Thanks for session nhandler, I'm not so new to pbuilder but I learned lot's of intresting things (super ultra top secret ninja hooks :>)
[01:55] <mschafer> I noticed there was a recent session on packaging Java apps, but I haven't read the logs.  A session on Python apps would be good for me.
[01:55] <Quintasan> I'm intrested in packaging core KDE things
[01:55] <nhandler> mschafer: That is something that we should probably have. We do have a session on packaging Perl apps coming up as well ;)
[01:55] <nhandler> Quintasan: There is a Kubuntu Tutorial Day next week you might like Quintasan
[01:56] <nhandler> Quintasan: You also might be interested in JontheEchidna's packaging training session: https://wiki.ubuntu.com/Packaging/Training/Logs/2009-06-18
[01:56] <nhandler> Any other comments/suggestions?
[01:57] <evanrmurphy> nhandler: Thanks. I'm still wading through the tutorials and trying to get oriented in the Ubuntu dev world.
[01:58] <mschafer> I'm currently working with a package that depends on other packages, but the dependencies are heavily patched.  Perhaps this is just something that I should learn from an experienced packager, but if it's meaty enough for a training session, that would be good.
[01:58] <mschafer> Maybe a session for gnarly dependencies or something like that.
[01:59] <nhandler> mschafer: I'm not sure I understand what your suggestion is.
[01:59]  * Quintasan scans thorugh the LP branches he got, lots of reading
[02:00] <evanrmurphy> nhandler: Are there sessions for other aspects of developer work or is it focused on packaging? Or does packaging just about cover it?
[02:00] <nhandler> evanrmurphy: Is there a certain aspect in particular you are interested in?
[02:00] <mschafer> Probably because I'm too clueless.  Let's see.  How does one package a software project when upstream has altered other software that are already in packages but don't have the upstream alterations?  As I said, this may be something that isn't of general interest.  But it's something I'm currently working through.
[02:01] <nhandler> evanrmurphy: Pretty much, any topic related to Ubuntu development is fair game
[02:01] <nhandler> mschafer: Is there a reason for not updating the versions of the dependencies currently in the Ubuntu archives?
[02:02] <mschafer> The dependency upstream doesn't have those changes.  The upstream of the package that I'm working on described their changes as so extensive, they're just shy of a fork.
[02:03] <evanrmurphy> nhandler: Perhaps a panorama of how everything in the developer community fits together, a more zoomed-out overview. Then again, there's a good bit of that in the documentation.
[02:03] <mschafer> Well, this may not be a widespread problem.  It's just my current challenge, so I thought I'd mention it.  Don't want to take up any more of your night (morning).
[02:04] <nhandler> mschafer: Yeah, that is a little too specific in my opinion for a session, but feel free to ask questions in #ubuntu-motu about it
[02:04] <mschafer> nhandler:  Thanks!  And thank you for your time tonight.  Very informative.
[02:04] <nhandler> evanrmurphy: I think several people have touched on that in their sessions, but having a session dedicated to that wouldn't hurt
[02:05] <evanrmurphy> thanks again for the good session
[02:05] <nhandler> You are welcome
[02:05] <nhandler> Are there any more questions?
[02:06] <nhandler> Ok then, thanks for coming everyone
[02:07] <nhandler> Remember, you can always find details about the Packaging Training Sessions at https://wiki.ubuntu.com/Packaging/Training
[02:15] <itnet7> Thanks nhandler !
[02:37] <evanrmurphy> nhandler: I don't know if you're still there. I hope you can answer this question when convenient:
[02:39] <evanrmurphy> I just installed the hello*.deb we made during the session, and I'm trying to figure out if it does anything I can test.
[02:40] <evanrmurphy> Reading through the README right now... is there a hello world binary or something I should be able to find on the system and execute?
[02:41] <nhandler> evanrmurphy: Type 'hello' in a terminal
[02:41] <evanrmurphy> oh!
[02:41] <evanrmurphy> :)
[02:42] <evanrmurphy> It even did it in my chosen localization.
[02:42] <evanrmurphy> nhandler: Thank you very much!
[02:47] <nhandler> You are welcome evanrmurphy
[03:43] <oussama> hi all
[03:43] <oussama> who can help me learn ubuntu?
[03:44] <pleia2> oussama: the class schedule is in the topic
[03:47] <oussama> date -u
[18:37] <truthordare> hy all.. i am new to this.. i have been using ubuntu since a long time.. and befor that was using debian and slackware..
[18:38] <truthordare> i was looking at web for participating in ubuntu and i found this link to the irc..