尝试构建自定义包失败,如下所示:
~/deploy# dpkg-buildpackage -us -uc
dpkg-buildpackage: info: source package deploy
dpkg-buildpackage: info: source version 1.0-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Foo Bar <[email protected]>
dpkg-buildpackage: info: host architecture amd64
dpkg-source --before-build .
debian/rules clean
dh clean --builddirectory=_build --buildsystem=golang --with=golang
dh_auto_clean -O--builddirectory=_build -O--buildsystem=golang
dh_autoreconf_clean -O--builddirectory=_build -O--buildsystem=golang
dh_clean -O--builddirectory=_build -O--buildsystem=golang
dpkg-source -b .
dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../deploy_1.0.orig.tar.{bz2,gz,lzma,xz}
dpkg-buildpackage: error: dpkg-source -b . subprocess returned exit status 255
以下是我的“debian/control”内容。
Source: deploy
Maintainer: Foo Bar ([email protected])
Standards-Version: 4.6.1
Section: utils
Priority: optional
Homepage: https://gitlab.co toso.com/contoso/deploy
Rules-Requires-Root: no
Build-Depends: debhelper-compat (= 12),
debhelper (>=12),
dh-golang,
golang-any
Package: deploy
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Command used to send Docker webhooks.
Command used to send Docker webhooks.
我的“debian/rules”文件:
#!/usr/bin/make -f
#export DH_GOLANG_EXCLUDES := internal
%:
dh $@ --builddirectory=_build --buildsystem=golang --with=golang
最后是我的仓库结构:
# ls -la
total 39
drwxr-xr-x 5 root root 6 Feb 17 00:23 .
drwx------ 9 root root 18 Feb 17 00:46 ..
drwxr-xr-x 3 root root 7 Feb 17 00:46 debian
drwxr-xr-x 7 root root 10 Feb 16 22:41 .git
-rw-r--r-- 1 root root 841 Feb 16 23:52 main.go
有什么提示说明为什么它会因为缺少 tarball 而崩溃?
答案1
找到解决方案,需要将我的规则文件更改为以下内容:
#!/usr/bin/make -f
%:
dh $@ --buildsystem=golang --with=golang
override_dh_auto_build:
go build -v ./...
override_dh_auto_install:
mkdir -p debian/deploy/usr/bin
install deploy debian/deploy/usr/bin
override_dh_auto_test:
echo "Skpping dh_auto_test"