我想在我的稳定版 Ubuntu 中使用较新的软件包版本。请求反向移植耗时太长,而且没有明显的结果,所以我想也许我可以自己构建较新的版本。
有人能告诉我构建 Ubuntu 上已有软件包的较新版本的最佳实践是什么吗?
更新:我发现我需要pbuilder
保持系统不受构建依赖的影响。所以我做了:
sudo apt-get install pbuilder
sudo pbuilder create # create isolated environment for building packages
UPD2:我尝试检查是否可以构建当前版本,因此我获取了当前<version>
版本的源代码<package>
:
mkdir delme
cd delme
apt-get source <package>
UPD3:现在我尝试从源代码构建包,但找不到结果:
sudo pbuilder build *.dsc
日志显示:
...
0 packages upgraded, 94 newly installed, 0 to remove and 0 not upgraded.
Need to get 30.2 MB of archives. After unpacking 89.4 MB will be used.
The following packages have unmet dependencies:
pbuilder-satisfydepends-dummy : Depends: libjansson-dev which is a virtual package.
Depends: libudev-dev but it is not going to be installed.
Depends: ocl-icd-opencl-dev which is a virtual package. or
opencl-dev which is a virtual package.
Unable to resolve dependencies! Giving up...
The following NEW packages will be installed:
...
Need to get 30.2 MB of archives. After unpacking 89.4 MB will be used.
Abort.
E: pbuilder-satisfydepends failed.
I: Copying back the cached apt archive contents
...
UPD4:看来这些未满足的依赖项来自universe
软件包存储库,所以我必须启用它:
sudo pbuilder update --components "main universe" --override-config
如果不--override-config
pbuilder
设置,将会抱怨没有设置。一切都成功构建:
ls -la /var/cache/pbuilder/result/
UP5:找出可用的软件包版本并获取所需版本的源代码:
uscan --report --verbose
uscan --download-version <version>
UP6:找到uupdate
实用程序并使用它来为新包和更新创建目录debian/changelog
,这是生成新版本所需要的:
cd <package>-<old-version>
uupdate ../<package>_<version>.orig.tar.gz
cd ../<package>-<version>
vim debian/changelog
UP7:要构建源代码,pbuilder
我需要生成.dsc
文件。这通常使用debuild -S
命令或使用pdebuild -S
“pbuilder”来完成。
pdebuild -S
出现错误:
...
fakeroot debian/rules clean
dh clean --with autoreconf
dh: unable to load addon autoreconf: ..
BEGIN failed--compilation aborted at (eval 19) line 2.
make: *** [clean] Error 2
dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2
看起来没有 autoreconf 包,但pbiulder
应该自动获取它,并且似乎它使用.dsc
文件来执行此操作。catch22。
UPD8:构建文件的命令.dsc
是dpkg-source
。
cd ..
dpkg-source -b <package>-<version>
现在就可以越过pbuilder
它了。
sudo pbuilder build <package>_<version>.dsc
ls -la /var/cache/pbuilder/result/
UP9:上传到 PPA 非常简单,只需运行:
dput ppa:techtonik/backports /var/cache/pbuilder/result/<package>_<version>.changes
但它不起作用:
Checking signature on .changes
gpg: no valid OpenPGP data found.
gpg: the signature could not be verified.
...
No signature on /var/cache/pbuilder/result/<package>_<version>.changes
UP10:我不记得我是如何生成 GPG 密钥的,但我有一个。找到了一种对软件包进行签名的方法。编辑文件Maintaner:
中的字段.dsc
并使用debsign
。
sudo vim /var/cache/pbuilder/result/<package>_<version>.dsc
sudo debsign /var/cache/pbuilder/result/<package>_<version>.changes
尝试上传失败:
Error: uploading files for distribution UNRELEASED to ppa not allowed.
UP11:从步骤 6 开始重做所有操作。我怎么知道我需要编辑以debian/changes
替换并在字段中设置我的电子邮件?UNRELEASED
saucy
Maintainer:
debian/control
vim <package>-<version>/debian/changelog
vim <package>-<version>/debian/control
dpkg-source -b <package>-<version>
sudo pbuilder build <package>_<version>.dsc
sudo debsign /var/cache/pbuilder/result/<package>_<version>.changes
sudo dput ppa:techtonik/backports /var/cache/pbuilder/result/<package>_<version>.changes
UPD12:我仍然无法上传到 PPA。首先是Unable to find distroseries: unstable
,因为我指定了unstable
而不是saucy
作为UNRELEASED
替换。重复第 11 步后,它抱怨 ,使用键Already uploaded to ...
修复了。现在有一封邮件说上传被拒绝,因为-f
dput
Source/binary (i.e. mixed) uploads are not allowed.
在新内容中某处据说我需要用它来构建我的包debuild -S
,但我不知道如何告诉它pbuilder
。
UPD14:看来罪魁祸首是dh-autoreconf
软件包,这是构建前清理源所必需的,但和都pbuilder
忽略debuild
了这一事实,无法恢复。dh-autoreconf
在主机系统上安装允许构建源包,即使没有pbuilder
构建也可以对其进行签名和上传。
cd <package>-<version>
debuild -S
cd ..
dput ppa:techtonik/backports <package>_<version>_source.changes
完毕。