40

If I want to make minor changes to the source code of a Debian package, how do I go about downloading, incrementing the package version, building the (modified) source, and installing it on my computer?

sashoalm
  • 5,241

1 Answers1

48

Here are two ways to do it. The first one is the classic form, you'll get the source with apt-get. The second is the new [ubuntu] way uses the bzr command.

Classic

 $ apt-get source package

Then you'll be able to modify it:

 $ cd package
 $ vim some_file

Rebuild it:

$ sudo apt-get build-dep package
$ dch -i (which will open your editor to edit the changefile, here's where you can increment the package version)

$ debuild -us -uc -b

And install it:

$ sudo dpkg -i ../package.deb


New Ubuntu Approach

The new way (the Ubuntu way) is by using bzr branches, you'll get the code by using:

$ bzr branch lp:ubuntu/package #which will download the latest ubuntu package (the precise one)

$ bzr branch lp:ubuntu/oneiric/package #to get the package in oneiric

You can also get the code using:

$ pull-lp-source package #lp-source is part of the ubuntu-dev-tools pkg

pull-lp-source used to be called just lp-source in older versions.

Then you'll be able to edit it:

$ cd package 
$ vim some_file

Rebuild it:

$ dch -i 
$ debcommit
$ bzr bd -- -b -us -uc

And install it:

$ sudo dpkg -i ../package.deb

I recommend that you check the Ubuntu packaging guide out to know the details.

Also you might encounter problems if the package depends of others.

Alexis Wilke
  • 2,787