构建 Debian 软件包在 dh_auto_install 阶段失败

构建 Debian 软件包在 dh_auto_install 阶段失败

我正在尝试构建一个非常简单的 debian 包。我有两个文件,main_file它们functions都是 shell 脚本,functions来源为main_file.不依赖任何外部包,代码仅使用echo.

我有一个Makefile看起来像这样的:

install:
    cp main_file $(DESTDIR)/usr/bin/main_file
    cp functions $(DESTDIR)/usr/bin/functions

我在 debian 目录中还有一个控制文件,如下所示:

Source: ad
Section: unknown
Priority: extra
Maintainer: James Kelly <[email protected]>
Build-Depends: debhelper (>= 7)
Standards-Version: 3.8.3
Homepage: <insert the upstream URL, if relevant>
Package: ad
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Just messing around
 Playing with debian packages

我在包含代码的目录上方的目录中有一个 tar.gz 文件,以及包含代码和Makefile.

如果我运行$ dpkg-depcheck -d ./configure我会得到一个错误:

strace: ./configure: command not found
Running strace failed (command line:
strace -e trace=open,execve -f -q -o /tmp/depchwOSqtO ./configure

我认为这并不重要,因为没有依赖项,那么如果我运行dpkg-buildpackage -rfakeroot我会收到错误:

dh_auto_clean
dh_auto_clean: failed to write to debian/ad.debhelper.log: Permission denied
END failed--call queue aborted.
make: *** [clean] Error 13
dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2

最后,如果我运行sudo dpkg-buildpackage -rfakeroot该过程会进一步,但会出现错误:

dh_auto_install
make[1]: Entering directory `/home/james/Dummy_Debian/ad-1.0'
cp main_file /home/james/Dummy_Debian/ad-1.0/debian/ad/usr/bin/main_file
cp: cannot create regular file `/home/james/Dummy_Debian/ad-1.0/debian/ad/usr/bin/main_file': No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/james/Dummy_Debian/ad-1.0'
dh_auto_install: make -j1 install DESTDIR=/home/james/Dummy_Debian/ad-1.0/debian/ad returned exit code 2
make: *** [binary] Error 29
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

我一整天都在努力反对这个问题,我觉得这可能是我做错的简单事情,如果有人能给我一些帮助,我将永远感激不已!

编辑:

我的规则文件在这里:

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
    dh  $@

以及包含我的示例代码的 zip 文件的链接。

答案1

debhelper(7) 尝试使用损坏的Makefile来构建 ( dh_auto_build) 和安装 ( dh_auto_install) 文件,因此要么Makefile必须修复,要么我们可以通过添加覆盖来忽略它debian/rules

override_dh_auto_build override_dh_auto_install:  
        @

并制作debian/install包含以下内容的文件:

main_file  /usr/bin
functions  /usr/bin

阅读有关 Debian 打包的更多信息

相关内容