1.安装环境
sudo apt update
sudo apt install dh-make
sudo apt install devscripts
sudo apt install build-essential
2.创建一个二级目录
mkdir ~/test/hello-1.0 -p
cd ~/test/hello-1.0
3.创建文件
hello.c 文件内容
//cat hello.c
#include <stdio.h>
int main(void)
{
printf("%s\n","Hello");
return 0;
}
Makefile 文件内容
# cat Makefile
hello:hello.o
gcc -o hello hello.o
hello.o:hello.c
gcc -o hello.o -c hello.c
.PHONY:rebuild clean
rebuild:clean hello
clean:
rm -f hello hello.o
4.⽣成debian⽬录
dh_make --createorig -e liruijian@kylinos.cn
5.在debian目录下创建install文件
vi debian/install
install 文件内容
hello /bin
6.编译出changelog
debuild -S -sa -Inothing
会有一个报错,说没有gpg秘钥
处理方法,给hello_1.0-1_source.changes文件进行gpg签名,先查看签名秘钥:
jian@jian-PC:~/src/jian2$ gpg --fingerprint
/home/jian/.gnupg/pubring.kbx
-----------------------------
pub rsa2048 2021-05-12 [SC]
59AE 3230 0CE3 FA53 33F0 2EFB 3F34 25D2 AE35 8214
uid [ 绝对 ] liruijian <liruijian@kylinos.cn>
sub rsa2048 2021-05-12 [E]
debsign -k 59AE32300CE3FA5333F02EFB3F3425D2AE358214 ../hello_1.0-1_source.changes
7.推到launchpad.dev编译
dput devppa:liruijian/kylinos-desktop/test hello_1.0-1_source.changes
会推送失败,处理如下:
修改debian/control文件:
Source: hello
Section: unknown
Priority: optional
Maintainer: unknown <liruijian@kylinos.cn>
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.4.1
Homepage: <insert the upstream URL, if relevant>
#Vcs-Browser: https://salsa.debian.org/debian/hello
#Vcs-Git: https://salsa.debian.org/debian/hello.git
Package: hello
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>
为:
Source: hello
Section: libs
Priority: optional
Maintainer: liruijian <liruijian@kylinos.cn>
Build-Depends: debhelper
Standards-Version: 4.4.1
Homepage: <insert the upstream URL, if relevant>
#Vcs-Browser: https://salsa.debian.org/debian/hello
#Vcs-Git: https://salsa.debian.org/debian/hello.git
Package: hello
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>
修改debian/changelog文件:
hello (1.0-1) unstable; urgency=medium
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-- unknown <liruijian@kylinos.cn> Wed, 12 May 2021 16:46:10 +0800
为:
hello (1.0-2) v100; urgency=medium
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-- liruijian <liruijian@kylinos.cn> Wed, 12 May 2021 16:46:10 +0800
新建一个的debian/compat文件
9
就可以上传成功并且编译通过。