目前,debian有这么几个和build系统相关的东西:
总部wiki.
about这里云云了一大堆,看官可以自己去瞧一瞧,在此不必赘述(但是从项目背景的角度看,这个页面真的应该好好读一读,这样的话,你会更加明白rb的意义)。其实,这个项目的本身感觉是从安全的角度出发的。
Autotools是一个linux下使用广泛的build系统,尤其是在debian的packaging过程中需要大量遇到。所以,这篇文章根据https://earthly.dev/blog/autoconf/进行整理翻译,进行一些自己的积累。
Autotools主要由以下三大组件构成: autoconf
, automake
,aclocal
.
Autoconf是m4sh
写的,后者使用m4
宏。m4sh
提供了一些宏可以用来生成configure.ac
文件,然后接着可以自动产生configure
文件。
Debian的打包命令脚本中,最关键的其实 rules/
下的dh命令。
这里有一个wiki,需要好好滴进行学习。
convlit fails to cross build from source, because it uses the build architecture compiler. Letting dh_auto_build pass suitable CC to make mostly fixes that except for one bare gcc invocation. After making that substitutable as well, convlit cross builds successfully. Please consider applying the attached patch.
Helmut
diff -u convlit-1.8/debian/rules convlit-1.8/debian/rules
--- convlit-1.8/debian/rules
+++ convlit-1.8/debian/rules
@@ -21,8 +21,8 @@
build: build-stamp
build-stamp:
dh_testdir
- $(MAKE) -C $(CURDIR)/lib
- $(MAKE) -C $(CURDIR)/clit18
+ dh_auto_build --sourcedirectory=lib
+ dh_auto_build --sourcedirectory=clit18
touch [email protected]
clean:
diff -u convlit-1.8/debian/changelog convlit-1.8/debian/changelog
--- convlit-1.8/debian/changelog
+++ convlit-1.8/debian/changelog
@@ -1,3 +1,12 @@
+convlit (1.8-1.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix FTCBFS: (Closes: #-1)
+ + Let dh_auto_build pass cross tools to make.
+ + Make one plain gcc call substitutable.
+
diff -u convlit-1.8/clit18/Makefile convlit-1.8/clit18/Makefile
--- convlit-1.8/clit18/Makefile
+++ convlit-1.8/clit18/Makefile
@@ -7,3 +7,3 @@
clit: clit.o hexdump.o drm5.o explode.o transmute.o display.o utils.o manifest.o ../lib/openclit.a
- gcc -o clit $^ -ltommath
+ $(CC) -o clit $^ -ltommath
Subject: [PATCH 1/2] debian/rules: Pass -ffile-prefix-map in CFLAGS to avoid
embedding build paths.
https://reproducible-builds.org/docs/build-path/
---
debian/rules | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/debian/rules b/debian/rules
index 60c65ac..d18f93e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,6 +17,10 @@ ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
else
CFLAGS += -O2
endif
+
+# Avoid embedding the build path for reproducible builds
+CFLAGS += -ffile-prefix-map=$(CURDIR)=.
+
export CFLAGS
--
2.35.1
##
Subject: [PATCH 2/2] debian/rules: Finish conversion to dh.
---
debian/rules | 61 +++++++---------------------------------------------
1 file changed, 8 insertions(+), 53 deletions(-)
diff --git a/debian/rules b/debian/rules
index d18f93e..40ffb83 100755
--- a/debian/rules
+++ b/debian/rules
@@ -11,59 +11,14 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh [email protected]
-CFLAGS := -Wall -g
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
+override_dh_auto_build:
+ dh_auto_build --sourcedir=$(CURDIR)/lib
+ dh_auto_build --sourcedir=$(CURDIR)/clit18
-# Avoid embedding the build path for reproducible builds
-CFLAGS += -ffile-prefix-map=$(CURDIR)=.
+override_dh_auto_clean:
+ dh_auto_clean --sourcedir=$(CURDIR)/clit18
+ dh_auto_clean --sourcedir=$(CURDIR)/lib
+ dh_auto_clean
-export CFLAGS
-
-
-build: build-stamp
-build-stamp:
- dh_testdir
- $(MAKE) -C $(CURDIR)/lib
- $(MAKE) -C $(CURDIR)/clit18
- touch [email protected]
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
- $(MAKE) -C $(CURDIR)/clit18 clean
- $(MAKE) -C $(CURDIR)/lib clean
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_prep
- dh_install
-
-binary-indep:
-# do nothing
-
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
+override_dh_installman:
dh_installman debian/clit.1
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
--
目前还没有对debian rust进行打包,但是应该在不远的将来会打包。
<count_omega> capitol: how do I download the crate? With cargo ?
<capitol> curl -L https://crates.io/api/v1/crates/$name/$version/download | tar -xf -
<count_omega> K thanks
<f_g> count_omega: cargo doesn't expose it itself, but `debcargo extract $crate` does
<f_g> (it's basically just the first step of `debcargo package`, which is what get's called by update.sh
https://blog.hackeriet.no/packaging-a-rust-project-for-debian/
因为自己的等级所限,目前还不具备nmu upload的权限,但是这个在不久的未来一定会遇到。故现在就把list中大佬的message摘录下来,以方便后期查看。
Some thoughts about procedures: Jan is generally active (uploaded a package last month), but is in the LowNMU list [1] and the package is in the salsa Debian group [2]. Using the “LowNMU” procedure means that your package needs to be a NMU [3], but an NMU requires that the upload fixes bugs reported in the Debian BTS and a NMU limits the changes you are allowed to do in a package. You can of course file the bugs you fix in your changes in the Debian BTS (including a “please package the new upstream version where you can list all the problems with the old version.), but some changes will still be out of scope for an NMU.
The salsa Debian group is technically a Team upload [4] and team-uploads do not have restrictions on what to upload, so I guess this is an viable approach.
The third option is to adopt the package – either by an explicit OK to do from Jan or via the ITS procedure [5]. With that, you will become (co-)maintainer of the package, but that implies some kind of promise to also look after the package in the future. This is of course the best outcome for Debian and your project, but also means a commitment in maintaing the package.
[1] https://wiki.debian.org/LowThresholdNmu
[2] https://wiki.debian.org/Salsa/Doc#Collaborative_Maintenance:_.22Debian.22_group https://www.debian.org/doc/manuals/developers-reference/pkgs.en.html#collaborative-maint␆bib [3] https://wiki.debian.org/NonMaintainerUpload https://www.debian.org/doc/manuals/developers-reference/pkgs.en.html#non-maintainer-uploads-nmus
[4] https://wiki.debian.org/TeamUpload [5] https://www.debian.org/doc/manuals/developers-reference/pkgs.en.html#package-salvaging https://wiki.debian.org/PackageSalvaging (The “conservative” criterias are imho fulfilled: -::q open bugs, missing upstream releases, sourceful upload required, no visible activity on the package >6months)
本篇文章根据How to prepare patches for Debian packages和UsingQuilt整理而成。
quilt的历史非常悠久,具体可以追溯到Alro?(内核-mm tree的维护者)开发然后被应用到kernel开发中,所以说,Debian社区真的很厉害的。好了,废话不多说,直接说主题。
以下阐述是基于 apt source src-pkg
操作下进行的。apt source xx
会自动apply patch根据package里面的配置文件。
[email protected]:~/04/rust-ring/rust-ring-0.16.9$ cat ~/.quiltrc
QUILT_PATCHES=debian/patches
QUILT_NO_DIFF_INDEX=1
QUILT_NO_DIFF_TIMESTAMPS=1
QUILT_REFRESH_ARGS="-p ab"
QUILT_DIFF_ARGS="--color=auto" # If you want some color when using `quilt diff`.
QUILT_PATCH_OPTS="--reject-format=unified"
QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
d=. ; while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done
if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then
# if in Debian packaging tree with unset $QUILT_PATCHES
QUILT_PATCHES="debian/patches"
if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
fi
quilt push -a # applying all patches onto the source code tree
quilt new xx.patch # 这个意思是新建一个xx.patch
quilt add xx # for example, README, *.c, It can add multi files
quilt refresh # 更新xx.patch
quilt header -e # edits the header in $EDITOR
quilt pop -a # 退出所有的patch,包括刚才新建的patch
此时这个时候在 debian/patches
目录下就会有了刚才我们命名为xx.patch的patch,以及在series文件中也有当前的patch.
比如说,我们的前一个patch没有解决问题,那应该怎么办?当然是在前一个patch的基础上去搞定,而不需要新建一个patch。