Penguicon 2008 : Packaging Jam
Step 1: About
- Packaging What?
- I'm a developer, what's packaging have to do with me?
- I'm a sys admin...
- But I heard packaging is hard and complicated.
Step 2: The Docs
Step 3: The Tools
Packages You'll Need
sudo apt-get install build-essential devscripts debhelper dh-make diff patch gnupg fakeroot lintian linda pbuilder wget fakeroot cdbs patchutils
Setting up pbuilder environment
# Create your pbuilder environment (uses it's own sources; config in /etc/pbuilder/pbuilderrc) sudo pbuilder create --distribution gutsy --othermirror "deb http://archive.ubuntu.com/ubuntu gutsy universe multiverse"
Other Environment Help
Add these lines to your `~/.bashrc`
export DEBEMAIL="your.email@host.com" export DEBFULLNAME="First Last"
Then
source ~/.bashrc
Let's Fix a Bug
Launchpad small bugs Bitesize tag
Example (Silly) Bug report
The description is misspelled in the xicc package. It should say "This utility lets you set an ICC *color* profile..."
First let's verify
apt-cache show xicc
Sure enough, the line is colour in the description. Let's fix it.
Get the existing package
Remember those deb-src lines in your /etc/apt/sources.list file? Time to put it to use.
apt-get source xicc
Let's look at what we have here.
- original tarball
- .dsc file describing the package and giving md5sums for the source package
- .diff.gz file containing patches applied against the source code with the packaging information
- The modified source directory where our debian directory lives
Where to we fix our bug with the color spelling
cd xicc-0.2/debian/
The control file
The big daddy file giving us all the info you see in `apt-cache show xicc`
Notice the Description field. There's our spelling error.
While we're in here check out the other fields
- Source:
- Priority
- Maintainer
- Build-Depends
Let's fix our spelling of color.
Changelog
Next we need to note what we changed and why. See the changelog file? It's got a very specific format and there's a shortcut to matching it:
dch -i
Gives us a skeleton. Should auto fill in the name/email from our export commands earlier.
Notice the version string
Add our message after the `*`
Corrected the goofy spelling of the word color.
Build Time
Time to put the tools to work to build our updates
debuild -S # or if you don't have your gpg key setup debuild -S -us -uc
GPG Sidenote
# This worked for me: debuild -k<YourKeyID> -S # put in ~.bashrc # gpg key export GPGKEY=$YOURGPGNUM
signfile xicc_0.2-3ubuntu1_source.changes Richard T Harding <rharding@mitechie.com> Successfully signed dsc and changes files
Cool, now where did the files go?
View our debdiff file
cd ../ debdiff xicc_0.2-2.dsc xicc_0.2-3ubuntu1.dsc | less
Now let's save our debdiff to fix the bug
debdiff xicc_0.2-2.dsc xicc_0.2-3ubuntu1.dsc > xicc_0.2.3ubuntu1.debdiff
This can then be attached to the bug report for a MOTU to apply/commit.
Not so bad, notice the similarity to a diff in code terms.
Upgrade time!
Our next try is to update a package. The devs have released a new shiny version. Yes, we're still in pretend land
The patient: Brasero
Gutsy version: 0.6.1-0ubuntu1
Latest Stable Version: 0.7.1
Get the current package (from our holbach inspired time machine)
dget -x http://people.ubuntu.com/~dholbach/motu/brasero_0.5.2-0ubuntu1.dscLooking at the brasero/debian directory should look a little familiar.
Let's get the update
wget http://people.ubuntu.com/~dholbach/motu/brasero-0.6.1.tar.gzUnpack the new tarball and rename the new source tarball:
tar zxf brasero-0.6.1.tar.gz mv brasero-0.6.1.tar.gz brasero_0.6.1.orig.tar.gz
Note the underscore instead of - and the orig in the filename
Jumpstart
Why dupe all the work already done from the last version?
cp -r brasero-0.5.2/debian brasero-0.6.1/
Changelog Time
cd brasero-0.6.1 dch -iUsing our uber cool `dch` shortcut. Let's make a note that we're upgrading to a new upstream version of the package and update the version string.
And finally build it
debuild -SShould end up with files in dir above in particular
brasero_0.6.1-0ubuntu2.dsc
This is all well and good, but we can't install a .dsc file. Everyone knows we need a .deb file!
Remember our friend pbuilder to the rescue
Chroot environment that installs all the packages required for base Ubuntu install and the required deps.
sudo pbuilder --build brasero_0.6.1-0ubuntu2.dsc
Need sudo to build the chroot environment
Let's see what we have now:
ls /var/cache/pbuilder/result/ --------------------- brasero_0.6.1-0ubuntu2.diff.gz brasero_0.6.1-0ubuntu2.dsc brasero_0.6.1-0ubuntu2_i386.changes brasero_0.6.1-0ubuntu2_i386.deb brasero_0.6.1.orig.tar.gz
Hey, there's a .deb we can now apt-get install (if we had the permissions and such)
Where to go from here?
- Updates can also be made with uupdate
- We've not gone into everything here. There's a LOT LOT more.
- Use launchpad and PPAs as a great place for learning and working on your packaging
- Get on the MOTU mailing list and irc channel Some really great people!
- Help out, start small, learn, and work on improving.
- Go do it, be a MOTU. Check out these checklist guides: https://wiki.ubuntu.com/EfrainValles/MOTUJourney



