Guy Rutenberg

Keeping track of what I do

Creating a Deb for an Updated Version

with 3 comments

Say you’ve an existing package like gitg and you want to use the new version of gitg or even apply your own patches. You could directly make install but you will probably regret it as soon as you’ll want to upgrade/uninstall, and you want to create a better package than the one created by checkinstall. Apperantly, creating a deb package for a new version of already packaged deb isn’t complicated.

Getting Started

Start by pulling the sources for the already available package. I’ll by using gitg as an example throughout this tutorial.

apt-get source gitg

This will create a folder according to the version of the package, something like gitg-0.2.4. Extract the new version besides it and cd into its directory. The next step is to copy the debian/ directory from the old source package the code you’ve just extracted.

cp -R ../gitg-0.2.4/debian/ .

Update debian/ Files

The next step is to update the files under the debian/ sub-directory.

DEBEMAIL="Guy Rutenberg <myemail@domain.com>" debchange --nmu

This will update the debian/changelog and set the new version. --nmu will create a new “non maintainer upload” version, meaning if the current version was 0.2.4-0ubuntu1, it will change it to 0.2.4-0ubuntu1.1. This will make sure that there won’t be any collision between your package and an official one. If you update to a new upstream version. It might be more suitable to use something like this:

debchange --newversion 0.2.5+20111211.git.20391c4

If necessary, update the Build-Depends and Depends sections of debian/control.

Building the Package

If your building a package directly from version control and not part of an official release, you may need to run

./autogen

at this point.

Now to the actual building:

debuild -us -uc -i -I -B

-us -uc tells the script not to sign the .dsc and .changes files accordingly. -i and -I makes the script ignore common version control files. -B tells debuild to only create binary packages. You can also pass -j followed by the number of simultaneous jobs you wish to allow (e.g. -j3, like in make) which an significantly speed things up.

Installing the Package

The package will reside in the parent directory, for example:

../gitg_0.2.5+20111211.git.20391c4_amd64.deb

At this point you’re basically done. If you want to install the package you can use

sudo debi

while you’re still inside the build directory.

References

  • UpdatingADeb
  • Man pages for debuild, dpgk-genchanges, dpgk-buildpackage.
    Share and Enjoy:
    • del.icio.us
    • StumbleUpon
    • Digg
    • Facebook
    • Mixx
    • Google Bookmarks
    • Simpy

Written by Guy

December 17th, 2011 at 6:16 pm

Posted in Linux,Tutorials

Tagged with

3 Responses to 'Creating a Deb for an Updated Version'

Subscribe to comments with RSS or TrackBack to 'Creating a Deb for an Updated Version'.

  1. It’s worth mentioning that debchange is found in devscripts package.

    Orgad

    18 Dec 11 at 22:07

  2. Another handy script in devscripts is debcheckout.

    Tzafrir Cohen

    19 Dec 11 at 09:45

  3. @Orgad, you’re right. One has to apt-get install devscripts in order to follow the tutorial.

    To elaborate on what Tzafrir said, debcheckout is a tool that automatically checkout the code from maintainer’s version control. Thus, you can get the latest debian/ files, and more recent code that what is available via apt-get source, but probably not as recent as the one you can get directly from the project’s version control.

    Guy

    19 Dec 11 at 22:52

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">