=== nhandler changed the topic of #ubuntu-classroom to: Ubuntu Classroom || https://wiki.ubuntu.com/Classroom || https://lists.ubuntu.com/mailman/listinfo/ubuntu-classroom || Now: Testing your packages using pbuilder || Run 'date -u' in a terminal to find out the UTC time [01:00] Hello everyone. My name is Nathan Handler, and today we will be learning about pbuilder. [01:00] Can I have a quick show of hands from anyone who is here for the session? [01:00] \o [01:01] Howdy. [01:01] * mbt raises his hand [01:01] If at any point in the session you have a question, feel free to stop me in order to ask it. [01:01] \o [01:01] When packaging, it is very important to test that the package builds prior to uploading it to the official repositories. [01:02] Test building allows us to catch and fix mistakes before the package is made available to thousands of other users. [01:03] sorry I'm late [01:03] 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] No problem evanrmurphy ;) [01:03] This is where pbuilder comes into play. [01:04] pbuilder allows developers to create and manage a minimal Ubuntu chroot. [01:04] 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] This allows developers to package for the development release while still running the latest stable release on their computers. [01:05] A pbuilder chroot only contains the core essential packages. This allows developers to verify that their build dependencies are correct. [01:06] 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] Right about now, you should be starting to see why so many developers use pbuilder to test their packages prior to uploading. [01:07] 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] There are a few reasons you might want to do this. [01:08] 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] 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] pbuilder also has several other benefits that will be discussed later. [01:10] Earlier, I mentioned that pbuilder was for creating and managing Ubuntu chroots. That was only partially true. [01:10] 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] 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] 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] The ~/.pbuilderrc file is what you will use to configure pbuilder. [01:12] All developers have a slightly different system for handling multiple chroots with pbuilder. [01:13] 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] 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] 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] 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] 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] Any questions? [01:15] Yes, but I'll wait. ;) [01:16] Ok sdennie [01:16] Now we will take a look at pbuilder hooks. [01:16] I have a suggestion if you allow :P [01:16] Go ahead Quintasan [01:17] 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] 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] This is because you need to pass a dist option to pbuilder each time with that setup [01:19] Quintasan: However, thank you for linking them to the wiki page (I was going to do that later ;) ) [01:19] Now, back to hooks [01:19] Hooks allow us to extend the functionality of pbuilder to make our lives easier. [01:20] 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] I have created a bazaar for these hooks as well: lp:~nhandler/+junk/hooks [01:21] You can place them in /media/pbuilder/pbuilder/hooks. Be sure to leave the prefix on the filenames. [01:22] Hooks beginning with B are executed after the build system finishes building successfully and before copying back the build result. [01:22] C hooks are executed after build failures and before cleanup [01:23] D hooks are executed before unpacking the source inside the chroot. [01:23] There are several other prefixes that you can use for your hooks. You can read more about them in the pbuilder manpage. [01:24] Now, to test out using pbuilder, we are going to try and build the hello package. [01:24] 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] You can now do 'apt-get source hello' or 'pull-lp-source hello karmic' to download the hello source package. [01:26] 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] 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] 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] log since 00:01 UTC, for those who just came: http://paste.ubuntu.com/203246/ [01:27] You have successfully built the hello package in pbuilder! [01:28] Any questions/problems so far? [01:28] nhandler: Yes [01:28] Go ahead sdennie [01:28] 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] sdennie: That magic lies in the /usr/lib/pbuilder/pbuilder-createbuildenv file. [01:31] That file uses debootstrap to create the chroot [01:31] Excellent. That's answers the first part. [01:32] Or maybe both parts [01:33] Anyway, don't let me stop you. We can chat offline if I have more questions. :) [01:33] 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] Fair enough. Proceed. ;) [01:34] 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] nhandler: So pbuilder-createbuildenv installs both the toolchain and the other packages marked essential? [01:35] 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] Okay, thanks. [01:36] Now, I want to show you all a few more uses for pbuilder. [01:36] There are several instances where having a clean environment to run a script would be useful. [01:37] 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] 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] 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] Any more questions? [01:38] nhandler: Yes. [01:39] Go ahead evanrmurphy [01:39] nhandler: You made a comment about pbuilder-dist earlier. Do you recommend not using it? [01:40] 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] I personally do not use pbuilder-dist, but I know a lot of developers who love it. [01:40] nhandler: I got an error on the example you showed until I realized I had to replace "pbuilder-dist " with "pbuilder", so I can see it complicates examples. ;) [01:41] 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] Ampelbein: Yes, you can use 'sudo pbuilder create --debootstrapopts --variant=buildd' when creating the chroot [01:42] For those of you who are interested in pbuilder-dist, it is part of the ubuntu-dev-tools pacakge [01:42] * package [01:43] I would suggest reading the pbuilder-dist manpage to learn about it, as its usage is slightly different than pbuilder [01:43] ok, thanks. [01:43] nhandler: thanks [01:43] If you are interested in learning more about pbuilder, I would suggest reading: [01:44] The pbuilder manpage: http://manpages.ubuntu.com/manpages/karmic/en/man8/pbuilder.8.html [01:44] 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] mschafer: I would suggest using pbuilder over a VM [01:45] One reason is that it is more like the buildd's than a VM [01:45] You also have the ability to use pbuilder hooks with it, which really are useful for debugging FTBFS issues [01:45] Can you use pbuilder on an Ubuntu system to run a Debian chroot? [01:46] mschafer: Yes. As I said earlier, I have both Ubuntu chroots and a Debian sid chroot [01:47] mschafer: A pbuilder chroot is also generally faster and easier to use than a VM [01:47] 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] mschafer: pbuilder will *not* help you test that the applications actually runs. It just tests that it builds [01:48] Ah, gotcha. [01:48] And it will pull in any Build-Depends that it needs in order to build the package [01:48] That's a good point. Does the application build outside the chroot and install/deb inside the chroot? [01:48] 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] 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] all of the compilation happens in the chroot (which is why you can setup ccache in the pbuilder config) [01:49] 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] Let me give you guys a few more links that might help [01:49] ajmitch: Thanks. :) [01:50] The Kubuntu Ninja Build Environment wiki: https://wiki.kubuntu.org/Kubuntu/Ninjas/BuildEnvironment [01:50] sdennie: a clean chroot is used for each build, but a cache of previously downloaded build dependencies is kept [01:50] ajmitch: Very cool. Thanks. [01:50] The last link talks about creating an environment that takes advantage of multiple chroots and hooks. [01:51] All of the hooks I mentioned today can be found in lp:~kubuntu-members/pbuilder/pbuilder-hooks [01:52] Any last comments or questions? [01:52] Interesting stuff nhandler. Thanks a lot for the presentation. [01:53] You are welcome sdennie. Logs of this session will be available at https://wiki.ubuntu.com/Packaging/Training/Logs/2009-06-25 [01:53] Thank you, nhandler. [01:54] 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] Any topics that you would like to see covered? [01:54] 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] 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] I'm intrested in packaging core KDE things [01:55] mschafer: That is something that we should probably have. We do have a session on packaging Perl apps coming up as well ;) [01:55] Quintasan: There is a Kubuntu Tutorial Day next week you might like Quintasan [01:56] Quintasan: You also might be interested in JontheEchidna's packaging training session: https://wiki.ubuntu.com/Packaging/Training/Logs/2009-06-18 [01:56] Any other comments/suggestions? [01:57] nhandler: Thanks. I'm still wading through the tutorials and trying to get oriented in the Ubuntu dev world. [01:58] 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] Maybe a session for gnarly dependencies or something like that. [01:59] 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] 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] evanrmurphy: Is there a certain aspect in particular you are interested in? [02:00] 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] evanrmurphy: Pretty much, any topic related to Ubuntu development is fair game [02:01] mschafer: Is there a reason for not updating the versions of the dependencies currently in the Ubuntu archives? [02:02] 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] 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] 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] 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] nhandler: Thanks! And thank you for your time tonight. Very informative. [02:04] evanrmurphy: I think several people have touched on that in their sessions, but having a session dedicated to that wouldn't hurt [02:05] thanks again for the good session [02:05] You are welcome [02:05] Are there any more questions? [02:06] Ok then, thanks for coming everyone [02:07] Remember, you can always find details about the Packaging Training Sessions at https://wiki.ubuntu.com/Packaging/Training === nhandler changed the topic of #ubuntu-classroom to: Ubuntu Classroom || https://wiki.ubuntu.com/Classroom || https://lists.ubuntu.com/mailman/listinfo/ubuntu-classroom || Upcoming: || Run 'date -u' in a terminal to find out the UTC time [02:15] Thanks nhandler ! [02:37] nhandler: I don't know if you're still there. I hope you can answer this question when convenient: [02:39] 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] 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] evanrmurphy: Type 'hello' in a terminal [02:41] oh! [02:41] :) [02:42] It even did it in my chosen localization. [02:42] nhandler: Thank you very much! [02:47] You are welcome evanrmurphy [03:43] hi all [03:43] who can help me learn ubuntu? [03:44] oussama: the class schedule is in the topic [03:47] date -u === nizarus_ is now known as nizarus === yofel_ is now known as yofel [18:37] 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] i was looking at web for participating in ubuntu and i found this link to the irc.. === croppa_ is now known as croppa === olujicz_ is now known as olujicz