自制 PPA
创建 PPA
-
注册 Ubuntu One 帐号。
-
在 Launchpad 上传 GPG 公钥。
解密你收到的邮件,并打开其中的验证链接:
pbpaste | gpg -d -
签名行为准则:
wget -O UbuntuCodeofConduct-2.0.txt https://launchpad.net/codeofconduct/2.0/+download gpg --clear-sign UbuntuCodeofConduct-2.0.txt cat UbuntuCodeofConduct-2.0.txt.asc | pbcopy上传签名:Codes of Conduct
-
在个人资料页找到
Create a new PPA,创建一个 PPA。
上传包
添加 Debian 打包文件
-
安装打包依赖:
sudo apt install build-essential devscripts debhelper -
获取你要上传的软件包的源码,如 hithere-1.0.tar.gz
mkdir build && cd build wget --content-disposition "https://wiki.debian.org/Packaging/Intro?action=AttachFile&do=get&target=hithere-1.0.tar.gz" -
将源码压缩包重命名为
pkgname_ver.orig.tar.gz的形式:mv hithere-1.0.tar.gz hithere_1.0.orig.tar.gz -
解压源码:
tar -xzf hithere_1.0.orig.tar.gz # 得到 hithere-1.0 目录 cd hithere-1.0 -
创建
changelog文件:export DEBFULLNAME="John Connor" DEBEMAIL="email@example.com" mkdir -p debian/source dch --create -v 1.0-1 -u low --package hithere sed -i "s/UNRELEASED/jammy/" debian/changelog -
创建
control文件:vim debian/controlSource: hithere Maintainer: Lars Wirzenius <liw@liw.fi> Section: misc Priority: optional Standards-Version: 4.7.0 Build-Depends: debhelper-compat (= 13) Package: hithere Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: greet user hithere greets the user, or the world.第一段描述源码包,剩下的段描述由源码构建的二进制包。
-
创建 copyright 文件:
touch debian/copyright -
创建
rules文件:vim debian/rules#!/usr/bin/make -f %: dh $@ override_dh_auto_install: $(MAKE) DESTDIR=$$(pwd)/debian/hithere prefix=/usr install构建规则
override_dh_auto_install用于将安装目录修改为./debian/hithere/usr -
创建
.dirs文件:vim debian/hithere.dirsusr/bin usr/share/man/man1.dirs文件用于创建目录 -
创建
source/format文件:echo "3.0 (quilt)" > debian/source/formatsource/format文件用于指定 Debian 软件包的源格式。
打包并上传到 PPA
-
构建包:
debuild -S -
上传包:
cd .. dput ppa:your-lp-id/ppa <source.changes> # 上传到 PPA
拷贝包
如果只是想拷贝其他人上传到 PPA 的包,那么无需自己构建 PPA。Launchpad 提供了拷贝其他包到自己 PPA 的功能。
-
打开你要拷贝的 PPA:
以 NeoVim Stable 为例:https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable
-
点击
View package details:Package Details:https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable/+packages

-
点击
Copy packagesCopy Packages:https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable/+copy-packages

-
选择需要拷贝的包,并拷贝到自己的 PPA:

Copy options 建议选择
Copy existing binaries,这样不用重新构建包,避免编译错误。
杂项
相关工具:
debsign:对软件包签名(主要是 .changes 文件)debmake:自动构建dh_make:一键搭建构建框架(较老)
参考:
- How do I create a PPA? | Ask Ubuntu
- Packaging/PPA | Launchpad Help
- Packaging/PPA/Uploading | Launchpad Help
- Packaging/Intro | Debian Wiki
- 发布你的开源软件到 Ubuntu PPA | hzSomthing
Troubleshooting
常见上传问题:Packaging/UploadErrors | Launchpad Help
No secret key
运行 debuild 时出现错误:
Now signing changes and any dsc files...
signfile dsc hithere_1.0-1.dsc Xiao Li <xiaoli3397@gmail.com>
gpg: skipped "Someone <someone@gmail.com>": No secret key
gpg: /tmp/debsign.bLUHk893/hithere_1.0-1.dsc: clear-sign failed: No secret key
debsign: gpg error occurred! Aborting....
debuild: fatal error at line 1114:
running debsign failed
原因是找不到指定名称的 GPG 私钥。检查私钥名和邮件地址。
Source/binary (i.e. mixed) uploads are not allowed
上传 PPA 后收到邮件提示被拒绝:
Rejected:
Source/binary (i.e. mixed) uploads are not allowed.
原因:上传了二进制包。
解决方法:只编译并上传源码包
debuild -S
参考:Source/binary (i.e. mixed) uploads are not allowed | Launchpad

浙公网安备 33010602011771号