2009-05-28

   1 <@nhandler> Hello everyone. My name is Nathan Handler. Today, we will be learning about creating packages using CDBS.
   2 * asomething waves
   3 <@nhandler> Could I get a quick show of hands to get a feel for who is here for the packaging training session?
   4 * asomething looks around
   5 <@nhandler> Before 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.
   6 <@nhandler> Now, what exactly is CDBS?
   7 <@nhandler> To quote https://wiki.ubuntu.com/PackagingGuide/Howtos/CDBS...
   8 <@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."
   9 <@nhandler> Now, when might you want to use CDBS?
  10 <@nhandler> I often see people in #ubuntu-motu trying to learn how to package a small bash script that they put together.
  11 <@nhandler> They look at the default debian/rules file created by dh_make, and they get a little nervous.
  12 <@nhandler> Using CDBS, you can create a working package that has a debian/rules file only a couple of lines long.
  13 <@nhandler> In order to demonstrate this, why we take a look at how easy it is to package a simple bash script using CDBS.
  14 <@nhandler> Start by creating a directory to hold all of the files we will be dealing with. You can do this with: mkdir ~/cdbs-packaging
  15 <@nhandler> Now, enter that new directory: cd ~/cdbs-packaging
  16 <@nhandler> I 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.upstream
  17 <@nhandler> You should now have a starwars.upstream folder
  18 <@nhandler> If 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.
  19 * brianchidester has quit (Read error: 60 (Operation timed out))
  20 <@nhandler> If you look at the bash script (cat ./starwars), you will see that it simply shows the all too familiar telnet star wars movie.
  21 <@nhandler> Just to be clear, I did not create Star Wars or that telnet movie. I am simply using them for this educational demonstration.
  22 <@nhandler> Now, it is time to start creating the package. You can download the necessary files using: bzr branch lp:~nhandler/+junk/starwars.debian debian
  23 <@nhandler> For 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.
  24 <@nhandler> This was done intentionally to try and keep the package as simple as possible.
  25 <@nhandler> If 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/)
  26 <@nhandler> Now, going back to the package. Take a look at the rules file: cat debian/rules
  27 <@nhandler> You might be surprised to notice that it only has two lines.
  28 <@nhandler> The first line simply says that this is a Makefile. All debian/rules files need to have this line.
  29 * brianchidester (n=brianchi@80.67.104.110) has joined #ubuntu-classroom
  30 * brianchidester has quit (Read error: 104 (Connection reset by peer))
  31 * DoruHush has quit ("Leaving.")
  32 <@nhandler> The 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.
  33 <@nhandler> If 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).
  34 <@nhandler> The file has lots of comments that explain exactly what it does.
  35 <@nhandler> Now, you might be wondering how debhelper will know where to install all of our files. This is specified in debian/install.
  36 <@nhandler> If 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.
  37 * mib_bjx1mnoq (i=d2d43004@gateway/web/ajax/mibbit.com/x-0baabdaee838da9c) has joined #ubuntu-classroom
  38 <mib_bjx1mnoq> hi
  39 * MiraiWarren0_0 (n=cairo@pool-71-164-178-119.dllstx.fios.verizon.net) has joined #ubuntu-classroom
  40 <@nhandler> Now, 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/control
  41 <@nhandler> That 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.
  42 <@nhandler> We can now attempt to build the source package. However, you need to have some packages installed: sudo apt-get install devscripts cdbs
  43 <@nhandler> Now, to build the source package, enter: debuild -S -us -uc
  44 <Ampelbein> question: 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?
  45 <@nhandler> Ampelbein: 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)
  46 <Ampelbein> ok, thanks.
  47 <@nhandler> Running the command above will create an unsigned source package
  48 <@nhandler> You will get some lintian warnings about the package containing .bzr directories. For our purposes, you can ignore that warning.
  49 * brianchidester (n=brianchi@80.67.104.110) has joined #ubuntu-classroom
  50 * brianchidester has quit (Read error: 104 (Connection reset by peer))
  51 <@nhandler> Now, 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.gz
  52 <@nhandler> If you have pbuilder installed and configured properly, you can build the binary package using: pbuilder build starwars_0.1.dsc
  53 <@nhandler> Otherwise, you can build the binary package in your PPA (https://help.launchpad.net/Packaging/PPA)
  54 <@nhandler> I have already uploaded this package to my PPA: https://launchpad.net/~nhandler/+archive/ppa
  55 <@nhandler> If 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.
  56 <@nhandler> You 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.
  57 <@nhandler> We have now successfully packaged a simple application using cdbs.
  58 <@nhandler> Are there any questions about anything we have done?
  59 <@nhandler> There is one more thing that I would like to mention
  60 * Pollywog (n=Pollywog@69-12-173-117.static.humboldt1.com) has joined #ubuntu-classroom
  61 <@nhandler> When using dh_make to help create a package, you can actually have it make the necessary changes to use CDBS for you
  62 <@nhandler> To do this, enter 'b' when it asks you about the "Type of package".
  63 * jdg (n=jgill@GE-Medical-Systems-Woodcock.s12-1-0-2-0.ar1.ROC1.gblx.net) has left #ubuntu-classroom
  64 <@nhandler> This 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/control
  65 <@nhandler> Any last questions about CDBS?
  66 <@nhandler> How about some feedback on these Packaging Training sessions in general. Any comments, suggestions, or feedback?
  67 * k0001 has quit (Read error: 54 (Connection reset by peer))
  68 <@nhandler> Well, if nobody has any questions or comments, I think we can end a little early.
  69 <Pollywog> Will this be available later (logs)?
  70 <mib_bjx1mnoq> and when?
  71 <asomething> yes at https://wiki.ubuntu.com/Packaging/Training/Logs
  72 <Pollywog> ty
  73 <@nhandler> Thanks for coming everyone


CategoryPackaging

Packaging/Training/Logs/2009-05-28 (last edited 2009-06-04 07:15:03 by i59F71954)