在邮箱里突然发现一个RFP 1007025:
发现这又是一个python包,果断直接找 Debian python packaging wiki:
为了Debian中的python包容易维护(不只是python,还有其他),Debian创建了多个语言或者框架相关的team,尽管每个包都是自己owner,但是统一都放到 https://salsa.debian.org/python-team/packages/ 下面,这样做的好处:
注意一点: debian python team不使用 git-gdm,这一点尤其注意。
Set up a new repository visit https://salsa.debian.org/python-team/packages/ and follow the ‘new project’ link (the link will not be accessible unless you have joined the team). Enter the source package name as the project name and leave the visibility set to public.
但是需要python team给你加权限才可以幺。
$ uscan # Download your package's upstream original tarball
$ tar -xvf srcpkgname_1.0.orig.tar.gz
$ cd srcpkgname_1.0
$ git init
$ git checkout -b upstream
$ git add .
$ git commit -m "import srcpkgname_1.0.orig.tar.gz"
$ git tag -s upstream/1.0
$ pristine-tar commit ../srcpkgname_1.0.orig.tar.gz upstream ##
$ git checkout -b debian/master
这里重点介绍下 pristine-tar命令: pristine-tar commit tarball [upstream] pristine-tar commit generates a pristine-tar delta file for the specified tarball, and commits it to version control.
The upstream parameter specifies the tag or branch that contains the same content that is present in the tarball。
python team自己维护了一套tool,叫做 git-dpm,需要安装一下。
git branch -D foo # make sure there is no branch foo
git-dpm import-tar ../foo_0.0.0.orig.tar.gz
git checkout -b upstream-foo # 会创建一个upstream的分支
git-dpm init ../foo_0.0.0.orig.tar.gz # 创建一个master 分支,有debian目录,然而upstream是没有的。
</del>
首先使用 dch --create去创建一个changelog文件,然后再通过dch -i或者dch -e去编辑相关的信息,可以去看看别的package怎么写的。
这儿我的例子如下:
git-multimail (0.15-1) unstable; urgency=medium
* Initial release of git-multimail to Debian. (Closes: #1007025)
-- Add myself as Maintainer.
-- Bo YU <[email protected]> Thu, 31 Mar 2022 10:58:24 +0800
这个命令可以让你从头开始创建打包所需的原料脚本。refer to
The debmake command is the helper script for the Debian packaging.
我们使用debmake命令看一下:
(sid-amd64-sbuild)root@debian-local:/home/vimer/git/git-multimail/git-multimail# debmake
I: set parameters
I: sanity check of parameters
I: pkg="git-multimail", ver="1.5.0", rev="1"
I: *** start packaging in "git-multimail". ***
W: parent directory should be "git-multimail-1.5.0". (If you use pbuilder, this may be OK.)
I: provide git-multimail_1.5.0.orig.tar.gz for non-native Debian package
I: pwd = "/home/vimer/git/git-multimail"
I: Use existing "git-multimail_1.5.0.orig.tar.gz" as upstream tarball
I: pwd = "/home/vimer/git/git-multimail/git-multimail"
I: parse binary package settings:
I: binary package=git-multimail Type=bin / Arch=any M-A=foreign
I: analyze the source tree
I: build_type = Python distutils
I: scan source for copyright+license text and file extensions
...
I: check_all_licenses
I: ........................................................................W: Non-UTF-8 char found, using latin-1: t/email-content.d/accent-python2
...........
I: check_all_licenses completed for 83 files.
I: bunch_all_licenses
I: format_all_licenses
I: make debian/* template files
I: found "debian/changelog"
I: debmake -x "0" ...
I: creating => debian/control
I: creating => debian/copyright
I: substituting => /usr/share/debmake/extra0/rules
I: creating => debian/rules
I: substituting => /usr/share/debmake/extra0/changelog
I: skipping :: debian/changelog (file exists)
I: run "debmake -x1" to get more template files
I: $ wrap-and-sort
这个时候,已经自动为你创建了一些debian/目录下的文件(之前已有的文件不会覆盖)。
主要是看一下d/rules文件:
#!/usr/bin/make -f
# You must remove unused comment lines for the released package.
#export DH_VERBOSE = 1
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@ --with python2
下面是 d/control 文件:
(sid-amd64-sbuild)root@debian-local:/home/vimer/git/git-multimail/git-multimail/debian# cat control
Source: git-multimail
Section: unknown
Priority: optional
Maintainer: root <>
Build-Depends: debhelper-compat (= 12),
dh-python,
python-all,
python-setuptools,
python3-all
Standards-Version: 4.5.0
Homepage: <insert the upstream URL, if relevant>
X-Python-Version: >= 2.6
Package: git-multimail
Architecture: any
Multi-Arch: foreign
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: auto-generated package by debmake
This Debian binary package was auto-generated by the
debmake(1) command provided by the debmake package.
这里有几项是最关键的,比如,section maintainer什么的,这块需要根据自己的实际情况来,当然,我这里是python package,那就先抄一个 control .
这里有一个比较棘手的文件是 d/copyright文件,不太清楚如何去修改它。可以参考这里copyright-format
这里应该对每一个文件的copyright进行检查并说明,Files, Copyright, License为一组,最后是lisence的解释说明。
如果使用deb_make命令的话。可以直接使用那个模板不是问题的。对于python的包来说,这应该是是注意python2和3版本的区别。 还有就是支持rst格式的doc支持。这个上面的链接都有提及。
#!/usr/bin/make -f
export DH_VERBOSE = 1
export PYBUILD_NAME=git-multimail
%:
dh $@ --with python3 --buildsystem=pybuild
使用 d/watch文件可以用来监控upstream有无更新的release,使用下面的命令可以解决大部分github的监控。
version=4
opts=\
repacksuffix=+ds,\
repack,compression=xz,\
dversionmangle=s/\+(debian|dfsg|ds|deb)(\.?\d+)?$//,\
filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%<project>-$1.tar.gz% \
https://github.com/git-multimail/git-multimail/tags \
(?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate
在主目录中可以使用uscan命令进行测试。
uscan --no-download --verbose
这里有一些需要fix的问题对于新的itp包:
Dsc failed to parse
dsc is missing from changes Make sure you include the full source (if you are using sbuild make sure to use the –source option or the equivalent configuration item; if you are using dpkg-buildpackage directly use the default flags or -S for a source only upload)
方案说的也很清楚哈。
gbp buildpackage --git-upstream-tree=upstream/1.5.0 --git-upstream-branch=upstream/1.5.0 --git-builder=sbuild -d unstable --git-debian-branch=debian/main --git-export-dir=../build-area/ --git-ignore-new --verbose
#!/usr/bin/make -f
export DH_VERBOSE = 1
export PYBUILD_NAME=git-multimail
%:
dh $@ --with python3 --buildsystem=pybuild
override_dh_auto_clean:
rm -rf .pytest_cache
dh_auto_clean
override_dh_auto_build:
PYTHONPATH=. http_proxy='127.0.0.1:9' python3 -m sphinx -N -bhtml doc/ build/html
override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_PROFILES)),)
dh_auto_test
endif
https://sources.debian.org/src/util-linux/2.38-4/debian/rules/?hl=77#L77
TBD
export DH_VERBOSE = 1
export PYBUILD_SYSTEM=flit
# 使用与 setup.py不同的打包方式
%:
dh $@ --with python3 --buildsystem=pybuild
TBD
Please visit the link and follow the instructions to install Debian 11 on D1 boards.
But if you have problems to download those files that the above url mentioned, you can download those files from my google drive.
Conditions: windows 10+, SD card reader
Once we have downloaded those file: RVBoards_D1_Debian_img_v0.6.1.zip 和PhoenixCardv4.2.7.7z.
Prequirements: A card reader that insertd into pc with a sd card(16GB+), better 32GB or nore.
We first untar PhoenixCardv4.2.7.7z file to get PhoneixCard exe program. Open it and we push button as “固件”(fireware) to choose image file that we downloaded RVBoards_D1_Debian_img_v0.6.1.zip (untar it first please).
Then we choose “启动卡”(boot card) as card flashing category.
At last to choose “烧卡” (flash card) to start flash process.
And wait a few minutes we can see the flashing task have beed finished.
Then we can connect D1 boards with HDMI monitor and sd card insert into boards and power in on, at last we to login:
user: rvboards/root passwd: rvboards
ps: The Serial Port Connection has issue to debug the boards I encountered.
以下是nodejs 支持 riscv64的例证. github nodejs1 nodejs2 riscv.org riscv
建议1 在社区大佬的帮助下,目前有很多试验是需要记录下来的。后面复盘总结一下。
You will probably need to use the "build profiles" documented in debian/README.source.
这个文件是可以解决依赖关系的。当时我使用sbuildbuild时,有一个依赖, 就是我想build A, 但是依赖B,而build B时也需要A的支持。这个就需要某些特殊的配置的。
建议2
node 16.14.0 is available on master-16.x branch.
Doing a local build right now.
The documentation generator prints some errors, nothing to be alarmed of.
This is the command i'm using for the build:
sbuild -d experimental '--extra-repository=deb http://deb.debian.org/debian experimental main' --build-dep-resolver=aspcud
然后我的步骤:
sudo sbuild --arch=riscv64 -d sid-riscv64-sbuild
```The following information may help to resolve the situation:
The following packages have unmet dependencies:
sbuild-build-depends-main-dummy : Depends: libicu-dev (>= 70.1~) but 67.1-7 is to be installed
Depends: node-acorn (>= 6.2.1~) but it is not going to be installed
Depends: pkg-js-tools (>= 0.8.2~) but it is not going to be installed
Depends: node-js-yaml (>= 4.1.0+dfsg+~4.0.5-6) but it is not going to be installed
Depends: node-marked (>= 4~) but it is not going to be installed
Depends: node-highlight.js but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
apt-get failed.
E: Package installation failed
This may be a common error on Debian riscv arch. I am thinking that I have to build from a package without node-*dependencies? Below is my operations step how to build(please point to me wrong as I am newbie to gbp also):
然后大佬给的建议:
You can do it a bit simpler because of the debian/gbp.conf file, so no need to rename any branch at all.
git checkout master-16.x
gbp buildpackage --git-pbuilder --git-ignore-new -sa
...
Also you really will want to use the DEB_BUILD_PROFILES="nodoc nocheck nobuiltin"
最后build成功:
sudo sbuild --arch=riscv64 -d sid-riscv64-sbuild --build-dep-resolver=aspcud
这只是工作的第一步,下面需要分解任务。
That failure is not fatal and happens on some other archs too, you don't really need to fix it.
Anyway once you built nodejs on riscv64 with DEB_BUILD_PROFILES as above,
you should now try to build all the build-dependencies of nodejs that themselves depend on nodejs
(they have the <!nocheck> or <!nodoc> flag in debian/control).
Once that is done, you can rebuild nodejs without DEB_BUILD_PROFILES at all, and upload it to experimental.
node_acorn 需要 nodejs, 标志禁不掉 – todo
sudo sbuild --arch=riscv64 -d sid-riscv64-sbuild --build-dep-resolver=aspcud
dh clean --with nodejs
dh: error: unable to load addon nodejs: Can't locate Debian/Debhelper/Sequence/nodejs.pm in @INC (you may need to install the Debian::Debhelper::Sequence::nodejs module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0 /usr/local/share/perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34 /usr/local/lib/site_perl) at (eval 13) line 1.
BEGIN failed--compilation aborted at (eval 13) line 1.
sudo sbuild --arch=riscv64 -d sid-riscv64-sbuild --extra-repository='deb http://deb.debian.org/debian experimental main' --build-dep-resolver=aspcud --extra-package=/home/vimer/no_del_debs/nodejs_16.14.0~dfsg-1_riscv64.deb
I repeat that to bootstrap nodejs you need to build first the arch-dependent packages (nodejs, libnode..) –build=any DEB_BUILD_PROFILES=”nodoc nocheck nobuiltin”
Once that is done, you can install all arch-independent packages that depend on nodejs, and that are already available in debian, and rebuild nodejs fully (with nodejs-doc and tests too).
DEB_BUILD_PROFILES="nodoc nocheck nobuiltin" dpkg-buildpackage --build=any
Yes, the command is DEB_BUILD_PROFILES=”nodoc nocheck nobuiltin” dpkg-buildpackage –build=any
不用移除d/control的标签。
BTW, We have sole cmd execute after dh_missing phrase? if not rebuilt again it will save many times.
Either add –no-pre-clean to dpkg-buildpackage or add –debbuildopt=”–no-pre-clean” to sbuild. That might work…
If you happen to reach the “building deb” stage, you can disable -dbgsym package creation,which is very long, with another build profile: noautodbgsym.
http://ftp.kr.debian.org/debian-ports//pool-riscv64/main/i/icu/libicu-dev_70.1-2_riscv64.deb
http://ftp.kr.debian.org/debian-ports//pool-riscv64/main/i/icu/libicu70_70.1-2_riscv64.deb
http://ftp.kr.debian.org/debian-ports//pool-riscv64/main/i/icu/icu-devtools_70.1-2_riscv64.deb
简而言之,Debian作为一个稳定的发行版,那么依靠什么作为release的质量保证呢?随着对Debian了解的深入,现在才发现Debian有一个很意思的项目 buildd和buildd. 那么,本篇文章的目标就是描述如何搭建buildd,更具体一点就是如何做一些针对 riscv64 的buildd.
从这里我们知道,buildd其实是由几部分组成的:
wanna-build: 类似一个数据库,决定了编译什么package以及其构建状态;
buildd: 这是一个守护进程,当我们配置好了一切,就可以在规定的时间内build出来并将package上传到某个位置;
sbuild: 这个不用多说了,和手工操作一样的。 build log status.
在build log status中,针对于riscv64的buildd在sid release里面才有的,如果你再仔细看一下failed就能找到当前在 sid中build fail的package了,这就是我们应该重点关注的地方。
未完待续。。。
在探索pbuilder的用法时,不小心突然在Debian(bulleye)上把riscv qemu安装上了,效果体验还是不错的,故在这里记录一下,以备使用时方便参考。
创建riscv64 的chroot有很多种方式:
sudo apt-get install debootstrap qemu-user-static binfmt-support debian-archive-keyring
sudo debootstrap --arch=riscv64 --keyring /usr/share/keyrings/debian-archive-keyring.gpg --include=debian-archive-keyring unstable /tmp/riscv64-chroot http://deb.debian.org/debian
稍等几分钟,就会创建 /tmp/riscv64-chroot目录,顾名思义,是一个riscv64 的chroot。
debootstrap创建的chroot针对unstable 版本的软件,如果你要使用的软件是来自于unrelease, 则可以参考下面的mmdebstrap.
$ sudo apt install mmdebstrap qemu-user-static binfmt-support debian-archive-keyring
$ sudo mmdebstrap --architectures=riscv64 --include="debian-archive-keyring" sid /tmp/riscv64-chroot "deb http://deb.debian.org/debian/ sid main" "deb http://deb.debian.org/debian/ unreleased main"
创建好了 /tmp/riscv64-chroot后,可以开始准备qemu的环境了:
$ sudo chroot /tmp/riscv64-chroot
# Update package information
apt-get update
# Set up basic networking
cat >>/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
EOF
# Set root password
# root的登录密码
passwd
# Disable the getty on hvc0 as hvc0 and ttyS0 share the same console device in qemu.
ln -sf /dev/null /etc/systemd/system/[email protected]
# Install kernel and bootloader infrastructure
apt-get install linux-image-riscv64 u-boot-menu
# Install and configure ntp tools
apt-get install openntpd ntpdate
sed -i 's/^DAEMON_OPTS="/DAEMON_OPTS="-s /' /etc/default/openntpd
# Configure syslinux-style boot menu
cat >>/etc/default/u-boot <<EOF
U_BOOT_PARAMETERS="rw noquiet root=/dev/vda1"
U_BOOT_FDT_DIR="noexist"
EOF
u-boot-update
exit
sudo apt install qemu-system-misc opensbi u-boot-qemu
这个chroot就是上文阐述的riscv64 chroot
sudo apt-get install libguestfs-tools
sudo virt-make-fs --partition=gpt --type=ext4 --size=10G /tmp/riscv64-chroot/ rootfs.img
sudo chown ${USER} rootfs.img
qemu-system-riscv64 -nographic -machine virt -m 1.9G \
-bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \
-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \
-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \
-append "console=ttyS0 rw root=/dev/vda1" \
-device virtio-blk-device,drive=hd0 -drive file=rootfs.img,format=raw,id=hd0 \
-device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::22222-:22
默认用户是root, 密码就是上面 passwd命令确认的。
root@debian-local:~# uname -a
Linux debian-local 5.16.0-3-riscv64 #1 SMP Debian 5.16.11-1 (2022-02-25) riscv64 GNU/Linux
qemu: For -nographic just enter:
Ctrl-A X for exit
which means
first press Ctrl + A (A is just key a, not the alt key)->then release the keys->afterwards press(X key)
根据Debian社区大佬的要求,如果想成为一个package maintainer的话,仅仅修改这个field是不够的,还必须有其他的改动。 一开始还确实不太理解,觉得对方是在双标,然而等自己真正实践起来才发现,大佬的想法没错。如果连最基本的都操作不了,如果出了问题怎么解决?
丢人也好,受气也罢,最关键的一点是,是自己太菜。目前的工作完全支持我在这一块全身心的投入,还有什么理由做不好呢?
为什么说Debian社区比较geek呢(其他发行版我用的也不多),就是debian自己的工具,什么都能给你造一个出来,这不,社区给你打早了一个封装git的命令 gbp,对,应该就是 git-buildpackage的缩写。
最权威的参考手册莫过于这里. 这里有个中文的文章也是非常的精彩。
首先介绍下目前git-buildpackage的一些workflow。
Debian开发人员为了自己管理代码与upstream方便的进行交互,一般来说会在 salsa.debian.org创建一个repo。这个repo与upstream的区别就是,摒除git的概念,只从代码的角度来看,就是在salsa repo中添加了一个 debian的名录。看到这里,你应该就明白这是怎么一回事了吧。
我首先 forked https://salsa.debian.org/debian/jimtcl到自己名下https://salsa.debian.org/vimerbf-guest/jimtcl.其实,这里也就是说明了一件事,如果salsa上面已经存在一个你想维护的包,可以直接fork下来使用。
下面的操作参考这里
我们看一下fork出来的branch情况:
vimer@debian-local:~/git/jimtcl/jimtcl$ git branch -a
* debian/main
remotes/origin/HEAD -> origin/debian/main
remotes/origin/debian/experimental
remotes/origin/debian/main
remotes/origin/pristine-tar
remotes/origin/upstream/latest
remotes/origin/upstream/latest-repack
我们看到,除了本地有一个debian/main, upstream/latest分支没有本地分支,pristine-tar我们暂时不用管,gbp会自己创建。 那么,我们得首先创建 upstream/latest 分支(这一块我也不是特别明白,如果有误解,请指正)。
vimer@debian-local:~/git/jimtcl/jimtcl$ git branch upstream origin/upstream/latest
分支 'upstream' 设置为跟踪来自 'origin' 的远程分支 'upstream/latest'。
vimer@debian-local:~/git/jimtcl/jimtcl$ git branch pristine-tar origin/pristine-tar
分支 'pristine-tar' 设置为跟踪来自 'origin' 的远程分支 'pristine-tar'。
然后upstream,可以使用指定。
gbp import-orig https://github.com/msteveb/jimtcl/archive/refs/tags/0.81.tar.gz
如果这个时候报这个错误,可以使用下面的方式:
vimer@debian-local:~/git/jimtcl/jimtcl$ gbp import-orig https://github.com/msteveb/jimtcl/archive/refs/tags/0.81.tar.gz
gbp:error:
Repository does not have branch 'upstream/latest' for upstream sources. If there is none see
file:///usr/share/doc/git-buildpackage/manual-html/gbp.import.html#GBP.IMPORT.CONVERT
on howto create it otherwise use --upstream-branch to specify it.
如果github抽风,还可以使用--pristine-tar指定tar文件:
$ gbp import-orig --pristine-tar ../0.81.tar.gz --debian-branch=debian/main -u 0.81 gbp:info: Importing '../0.81.tar.gz' to branch 'upstream/latest'...
gbp:info: Source package is jimtcl
gbp:info: Upstream version is 0.81
Branch 'pristine-tar' set up to track remote branch 'pristine-tar' from 'origin'.
gbp:info: Replacing upstream source on 'debian/main'
gbp:info: Successfully imported version 0.81 of ../jimtcl_0.81.orig.tar.gz
其中, --debian-branch就是我们的本地分支, -u指定版本。
或者:
gbp import-orig https://github.com/msteveb/jimtcl/archive/refs/tags/0.81.tar.gz --debian-branch=debian/main --upstream-branch=upstream -u 0.81
现在我们可以看下branch的情况:
vimer@debian-local:~/git/jimtcl/jimtcl$ git branch -a
* debian/main
pristine-tar
upstream/latest
remotes/origin/HEAD -> origin/debian/main
remotes/origin/debian/experimental
remotes/origin/debian/main
remotes/origin/pristine-tar
remotes/origin/upstream/latest
remotes/origin/upstream/latest-repack
接着看一下 git log:
commit 0d9289c68cca547ee4815b0d9ea2e0aaab57a7e0 (HEAD -> debian/main)
Merge: b8edd3d 8e5bb80
Author: vimer <[email protected]>
Date: Wed Mar 9 11:29:43 2022 +0800
Update upstream source from tag 'upstream/0.81'
Update to upstream version '0.81'
with Debian dir 49f71ac6d713ed89146f5f7525bad4ba5855b69f
commit 8e5bb802b183ce511f70dc9978d4a1bb797b4cf7 (tag: upstream/0.81, upstream/latest)
Author: vimer <[email protected]>
Date: Wed Mar 9 11:29:30 2022 +0800
New upstream version 0.81
commit b8edd3d0e96e36089dcf78be01702692c0f92f43 (tag: debian/0.79+dfsg0-3, origin/debian/main, origin/HEAD)
Author: Didier Raboud <[email protected]>
Date: Fri Sep 3 16:22:09 2021 +0200
jimtcl 0.79+dfsg0-3 Debian release
假设有的话。
# 1. 先处理debian/patches/下的文件
gbp pq import
# 2.
gbp pq export
# 3. commit
git add xx && git commit --amend
gbp buildpackage --git-debian-branch=debian/main --git-export-dir=/tmp/build-area/jimtcl -S
因为有很多用法没有搞明白,导致出现了很多的error。下面这个是我试验OK的。
gbp buildpackage --git-debian-branch=debian/main --git-upstream-tree=upstream --git-pristine-tar-commit --git-export-dir=/tmp/build-area/jimtcl -S --git-verbose
--git-debian-branch=debian/main 指明debian branch。
--git-upstream-tree=upstream也很关键: How to find the upstream sources used to generate the tarball,因为我是使用的pristine来引入upstream的源码,如果是其他的,估计不会使用这个选项了。请参考这里,主要是,我这里没有把标签打上去。
--git-pristine-tar-commit: Commit the pristine-tar delta to the pristine-tar branch if a new tarball was generated and the pristine-tar data isn’t already there. 这段话的意思其实我是拿捏不准的。
--git-export-dir=/tmp/build-area/jimtcl -S是把该tarball的dsc文件放在这个位置,方便后面的build。
--git-verbose是可以详细的把执行过程打印出来,方便debug使用。
如果已经有了 debian目录,我们可以暂时不必使用(debmake)命令去自动生成debian目录下的东西;如果没有的话,需要执行。
如果已经有了debian目录,我们的工作就是查漏补缺。第一步就是更新版本号,这里注意一下:
vimer@debian-local:~/git/jimtcl/jimtcl-0.81$ dch -i
dch warning: neither DEBEMAIL nor EMAIL environment variable is set
dch warning: building email address from username and mailname
dch: Did you see those 2 warnings? Press RETURN to continue...
然后使用dch -i去更改changelog文件。有几个地方需要改一下:
unknown 要改成 unstable(或者experimential),bug number 要改為自己的 ITP number,修改自己的名字與 email.
`debmake只会生成模板,实质性的内容并不会起作用。
这里的dsc就是debian source control文件,可以参考这里
gbp buildpackage --git-export-dir=/var/tmp/build-area/packagename -S
pbuilder build --basetgz /var/cache/pbuilder/lucid.tgz /var/tmp/build-area/packagename/packagename_version.dsc
gbp import-orig https://github.com/msteveb/jimtcl/archive/refs/tags/0.81.tar.gz
gbp:error:
Repository does not have branch 'upstream/latest' for upstream sources. If there is none see
file:///usr/share/doc/git-buildpackage/manual-html/gbp.import.html#GBP.IMPORT.CONVERT
on howto create it otherwise use --upstream-branch to specify it.
# 需要 checkout -b 一个
vimer@debian-local:~/git/jimtcl/jimtcl$ git checkout -b upstream/latest
切换到一个新分支 'upstream/latest'
vimer@debian-local:~/git/jimtcl/jimtcl$ gbp import-orig https://github.com/msteveb/jimtcl/archive/refs/tags/0.81.tar.gz
What is the upstream version? [] 0.81
gbp:info: Importing '../0.81.tar.gz' to branch 'upstream/latest'...
gbp:info: Source package is jimtcl
gbp:info: Upstream version is 0.81
Branch 'pristine-tar' set up to track remote branch 'pristine-tar' from 'origin'.
gbp:info: Merging to 'debian/master'
gbp:error: Import of ../jimtcl_0.81.orig.tar.gz failed: Error running git checkout: error: 路径规格 'debian/master' 未匹配任何 git 已知文件
gbp:error: Error detected, Will roll back changes.
gbp:info: Rolling back branch upstream/latest by resetting it to a86b79ef1858b0ab651302dd1f4bcf9190bfdf73
gbp:info: Rolling back branch 'pristine-tar' by deleting it
gbp:info: Rolling back tag 'upstream/0.81' by deleting it
gbp:info: Rolling back branch 'debian/master' by deleting it
gbp:error: Rolled back changes after import error.
你看,上面又报了这个错,我们接着拆招吧~
vimer@debian-local:~/git/jimtcl/jimtcl$ git checkout -b debian/master
切换到一个新分支 'debian/master'
vimer@debian-local:~/git/jimtcl/jimtcl$ gbp import-orig https://github.com/msteveb/jimtcl/archive/refs/tags/0.81.tar.gz --debian-branch=debian/master -u 0.81
gbp:error: Failed to download https://github.com/msteveb/jimtcl/archive/refs/tags/0.81.tar.gz: ../0.81.tar.gz already exists
vimer@debian-local:~/git/jimtcl/jimtcl$ gbp import-orig --pristine-tar ../0.81.tar.gz --debian-branch=debian/master -u 0.81 gbp:info: Importing '../0.81.tar.gz' to branch 'upstream/latest'...
gbp:info: Source package is jimtcl
gbp:info: Upstream version is 0.81
Branch 'pristine-tar' set up to track remote branch 'pristine-tar' from 'origin'.
gbp:info: Replacing upstream source on 'debian/master'
gbp:info: Successfully imported version 0.81 of ../jimtcl_0.81.orig.tar.gz
这些参考命令放在这里,逐渐加深印象。
# 1
gbp buildpackage --git-ignore-new --git-no-pristine-tar --verbose
#2
gbp config buildpackage
假设co-team上传了一个远程分支,你可以更简单的使用:
git checkout master-16.x
gbp buildpackage --git-pbuilder --git-ignore-new -sa # 补充完全
也就是没有tarball的情况下怎么办?
sudo gbp buildpackage --git-submodules --git-no-pristine-tar --git-upstream-tree=tag --git-ignore-new -sa --git-export-dir=../
但是这个也会有问题,需要第一次把 -u说明正确。
原来是旧的 0.79.symbols, 现在是新的0.81.symbols
sudo dpkg-deb -x libjim0.81_0.81+dfsg0-1_amd64.deb /tmp/jimctl # 解包
sudo dpkg-gensymbols -v0.81 -plibjim -P/tmp/jimctl/ -Olibjim.symbols # 得到符号表
上面的信息不全, 正确的做法: 以升级 0.84 为例, 首先把原来的 libjim0.83.symbols 重命名为 libjim0.84.symbols, 接着把对应libfoo 包解析出来, 例如上面的命令, 然后使用下面的命令:
dpkg-gensymbols -plibjim0.84-1 -P/tmp/jimtcl -Odebian/libjim0.84.symbols
这样就会形成新的 symbols diff 文件了. https://wiki.debian.org/UsingSymbolsFiles