如何下载,修改,构建和安装Debian源包?

如果我想对Debian软件包的源代码进行微小的更改,我该如何下载,增加软件包版本,构建(修改过的)源代码并将其安装到我的计算机上?

基本上有两种方法可以做到,第一种方法是经典forms,你将得到以下来源:

经典

  $ apt-get source package 

然后你就可以修改它了:

  $ cd package $ vim some_file 

重建它:

 $ 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 

并安装它:

 $ sudo dpkg -i ../package.deb 


新的Ubuntu方法

新的方式(Ubuntu方式)是通过使用bzr分支,您将通过使用以下方式获取代码:

 $ 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 

您还可以使用以下代码获取代码:

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

pull-lp-source曾经在旧版本中被称为lp-source

然后你就可以编辑它了:

 $ cd package $ vim some_file 

重建它:

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

并安装它:

 $ sudo dpkg -i ../package.deb 

我建议您查看Ubuntu包装指南 ,了解详细信息。

如果包依赖于其他包,您也可能会遇到问题