我想打包一个包含 .so 文件的第三方应用程序。 当我使用 dpkg-buildpackage 构建包时,.so 文件从生成的源包中排除
。我没有 .orig 文件。所以,我在 debian/source 中使用了"3.0(原生)"。
首先,我收到了以下消息:
dpkg-shlibdeps: error: cannot find library...
因此,我在 debian/rules 文件中包含了 "override_dh_makeshlibs" 和 "override_dh_shlibdeps"。
man dpgk-source 建议在 debian/source 中使用"3.0(quilt)",但我没有 .orig 文件,只有一个包含文件的 tar。
我试图设置一个debian/include-binaries文件(里面有"path_to.so"),但这没有帮助。
Debian/rules:
%:
dh $@
override_dh_strip:
@echo "Not running dh_strip"
override_dh_makeshlibs:
@echo "Not running dh_makeshlibs"
override_dh_shlibdeps:
@echo "Not running dh_shlibdeps"
Debian/source/format:
3.0 (native)
构建命令:
dpkg-buildpackage -aamd64 -us -uc
我希望源包包含所有文件,但它缺少 .so 文件。
deb 文件已正确构建。
[编辑:部分解决方案]
通过在构建 deb 之前手动创建原始文件,我设法使用上游源代码创建了一个 deb。
在源目录中:
更新日志:
make sure that the version number has a revision.
来源/格式:
3.0 (quilt)
源/包含二进制文件:
path_to.so
命令:
VERSION=$(dpkg-parsechangelog -S Version | sed -rne 's,([^-+]+)+(+dfsg)*.*,1,p'i)
SOURCE=$(dpkg-parsechangelog -S Source)
UPSTREAM_PACKAGE=${SOURCE}_${VERSION}.orig.tar.gz
rm -f ../${UPSTREAM_PACKAGE}
tar czvf ../${UPSTREAM_PACKAGE} --exclude=debian --exclude=Makefile
dpkg-buildpackage -rfakeroot -aamd64 -us -uc
有没有办法自动化?
我不知道这在 debian/rules 文件或 Makefile 中是否或如何实现。
这就是我想出的解决方案。
按照要打包的方式创建项目。我假设你知道成功打包你的项目需要哪些 debian 文件。
这些文件被创建或改编:
debian/source/format:
3.0 (quilt)
Debian/rules:
#!/usr/bin/make -f
# -*- makefile -*-
# https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules
# https://manpages.debian.org/stretch/debhelper/debhelper.7.en.html
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
version := $(shell dpkg-parsechangelog -S Version | sed -rne 's,([^-+]+)+(+dfsg)*.*,1,p'i)
source := $(shell dpkg-parsechangelog -S Source)
upstreampck := $(source)_$(version).orig.tar.gz
clean:
@ echo CLEAN
rm -f ../$(upstreampck)
tar czf ../$(upstreampck) --exclude=debian --exclude=.pc .
dh_testdir
dh_auto_clean
dh_clean
build:
@ echo BUILD: nothing to do here
#dh_testdir
#dh_auto_configure
#dh_auto_build
#dh_auto_test
binary:
@ echo BINARY
dh_testroot
dh_prep
dh_install
dh_installdocs
dh_installchangelogs
dh_installexamples
dh_installman
dh_link
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
.PHONY: build clean binary
更新 cangelog 并确保向上游版本添加修订号:
dch -i -D stable -u low -M -p
构建包:
dpkg-buildpackage -rfakeroot -us -uc -aamd64 --source-option=--include-binaries
这将生成原始文件和 debian/source/include-binaries 文件。
所有后续构建都可以通过以下方式完成:
dpkg-buildpackage -rfakeroot -us -uc -aamd64