/srv/irclogs.ubuntu.com/2009/05/28/#ubuntu-classroom.txt

* nhandler is almost done preparing his packaging training session00:32
nhandlerHello everyone. My name is Nathan Handler. Today, we will be learning about creating packages using CDBS.01:00
* asomething waves01:00
nhandlerCould I get a quick show of hands to get a feel for who is here for the packaging training session?01:00
* asomething looks around01:01
nhandlerBefore I begin, I would like to mention that this session is only going to cover the basics of using CDBS. It will not cover the advanced or special usage.01:01
nhandlerNow, what exactly is CDBS?01:02
nhandlerTo quote https://wiki.ubuntu.com/PackagingGuide/Howtos/CDBS...01:02
nhandler"CDBS is a set of Makefile includes that uses debhelper to make building and maintaining Debian packages even easier. It uses advanced features of Makefiles to abstract the build process, so rules files end up primarily as a series of include statements."01:02
nhandlerNow, when might you want to use CDBS?01:03
nhandlerI often see people in #ubuntu-motu trying to learn how to package a small bash script that they put together.01:04
nhandlerThey look at the default debian/rules file created by dh_make, and they get a little nervous.01:05
nhandlerUsing CDBS, you can create a working package that has a debian/rules file only a couple of lines long.01:05
nhandlerIn order to demonstrate this, why we take a look at how easy it is to package a simple bash script using CDBS.01:06
nhandlerStart by creating a directory to hold all of the files we will be dealing with. You can do this with: mkdir ~/cdbs-packaging01:07
nhandlerNow, enter that new directory: cd ~/cdbs-packaging01:07
nhandlerI have created a small script that we will attempt to package. You can download it to your current directory using: bzr branch lp:~nhandler/+junk/starwars.upstream01:08
nhandlerYou should now have a starwars.upstream folder01:08
nhandlerIf you enter this folder (cd starwars.upstream), you will see three files. There is 'starwars', the bash script. There is also a .desktop file and a .xpm icon.01:09
nhandlerIf you look at the bash script (cat ./starwars), you will see that it simply shows the all too familiar telnet star wars movie.01:10
nhandlerJust to be clear, I did not create Star Wars or that telnet movie. I am simply using them for this educational demonstration.01:10
nhandlerNow, it is time to start creating the package. You can download the necessary files using: bzr branch lp:~nhandler/+junk/starwars.debian debian01:11
nhandlerFor those of you who might have some experience packaging, you will notice that this newly created debian directory is missing a copyright file. It also has a few other issues that would prevent it from entering the repositories.01:11
nhandlerThis was done intentionally to try and keep the package as simple as possible.01:12
nhandlerIf you want to have your package enter the official repositories, you will want to read through the packaging guide (https://wiki.ubuntu.com/PackagingGuide/Complete) and Debian policy (http://www.debian.org/doc/debian-policy/)01:12
nhandlerNow, going back to the package. Take a look at the rules file: cat debian/rules01:13
nhandlerYou might be surprised to notice that it only has two lines.01:13
nhandlerThe first line simply says that this is a Makefile. All debian/rules files need to have this line.01:14
nhandlerThe second line says that we want to use the debhelper.mk script provided by CDBS. This script will make the packaging of this script much easier.01:14
nhandlerIf you are interested in learning more about debhelper.mk, I would suggest that you open up /usr/share/cdbs/1/rules/debhelper.mk (you will need to have 'cdbs' installed).01:15
nhandlerThe file has lots of comments that explain exactly what it does.01:16
nhandlerNow, you might be wondering how debhelper will know where to install all of our files. This is specified in debian/install.01:16
nhandlerIf you look at this file (cat debian/install), you will see that it lists the three files we want to install, and where we want them installed to.01:17
mib_bjx1mnoqhi01:18
nhandlerNow, in order to use cdbs, you need to list it as a Build-Depends in debian/control. You can see that I have included this by doing: cat debian/control01:18
nhandlerThat is it. debian/changelog and debian/compat have nothing cdbs-specific in them. If you want to learn more about them, read some of the references I linked to earlier.01:19
nhandlerWe can now attempt to build the source package. However, you need to have some packages installed: sudo apt-get install devscripts cdbs01:20
nhandlerNow, to build the source package, enter: debuild -S -us -uc01:21
Ampelbeinquestion: are the .install files specific to cdbs? so, if i want to use them i have to build-depend on cdbs? or is it debhelper that provides this support?01:21
nhandlerAmpelbein: debhelper is what uses the .install files. We need the cdbs build-depends because we are including debhelper.mk in debian/rules (which is provided by cdbs)01:22
Ampelbeinok, thanks.01:22
nhandlerRunning the command above will create an unsigned source package01:23
nhandlerYou will get some lintian warnings about the package containing .bzr directories. For our purposes, you can ignore that warning.01:24
nhandlerNow, if you do a 'cd .. ; ls' you will see that you have four new files: starwars_0.1.dsc, starwars_0.1_source.build, starwars_0.1_source.changes, and starwars_0.1.tar.gz01:24
nhandlerIf you have pbuilder installed and configured properly, you can build the binary package using: pbuilder build starwars_0.1.dsc01:25
nhandlerOtherwise, you can build the binary package in your PPA (https://help.launchpad.net/Packaging/PPA)01:26
nhandlerI have already uploaded this package to my PPA: https://launchpad.net/~nhandler/+archive/ppa01:26
nhandlerIf you examine the the binary .deb file using 'dpkg --contents /path/to/deb', you will see that all of the files are getting installed to the correct locations.01:28
nhandlerYou can install the package using 'sudo dpkg -i /path/to/deb' to get the application to appear under Applications->Sound and Video->Star Wars. Clicking on it will run the bash script we looked at earlier.01:29
nhandlerWe have now successfully packaged a simple application using cdbs.01:30
nhandlerAre there any questions about anything we have done?01:30
nhandlerThere is one more thing that I would like to mention01:31
nhandlerWhen using dh_make to help create a package, you can actually have it make the necessary changes to use CDBS for you01:33
nhandlerTo do this, enter 'b' when it asks you about the "Type of package".01:34
nhandlerThis will create a debian/rules file similar to the one we saw earlier. It will also take care of adding a Build-Depends on 'cdbs' in debian/control01:35
nhandlerAny last questions about CDBS?01:36
nhandlerHow about some feedback on these Packaging Training sessions in general. Any comments, suggestions, or feedback?01:37
nhandlerWell, if nobody has any questions or comments, I think we can end a little early.01:40
PollywogWill this be available later (logs)?01:40
mib_bjx1mnoqand when?01:40
asomethingyes at https://wiki.ubuntu.com/Packaging/Training/Logs01:40
Pollywogty01:41
nhandlerThanks for coming everyone01:41
Pollywogthanks for the session01:41
=== nhandler changed the topic of #ubuntu-classroom to: Ubuntu Classroom || https://wiki.ubuntu.com/Classroom || https://lists.ubuntu.com/mailman/listinfo/ubuntu-classroom || Upcoming: 29 May, 00:00 UTC: Q&A: To the source (Installing packages from source) || Run 'date -u' in a terminal to find out the UTC time
asomethinglogs are now up at https://wiki.ubuntu.com/Packaging/Training/Logs/2009-05-2801:51
* nhandler hugs asomething 01:53
=== Hodge is now known as Hodgestar
=== MaWaLe1 is now known as MaWaLe
=== MaWaLe1 is now known as MaWaLe
=== Grasping_Kulak is now known as Trotsky
=== Trotsky is now known as Trotskys_Icepick
=== nizarus_ is now known as nizarus

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