Debian打包中rules文件的目的和作用是什么

Nec*_*twi 7 packaging debian netbeans c++

我正在尝试 debian 打包我在 Netbeans 7.3 的帮助下开发的 C++ 应用程序。这是Makefile其中的一部分。

APPNAME=remotedevicecontroller
install:
    install config.xml /etc/${APPNAME}.conf.xml
    install devices.rules /etc/udev/rules.d/${APPNAME}.rules
    install error.log /var/log/${APPNAME}.log
    install init.conf /etc/init/${APPNAME}.conf
    install init.d /etc/init.d/${APPNAME}
    install ${CND_ARTIFACT_NAME_${CONF}} /usr/local/bin/${APPNAME}
    chmod u+x ${CND_ARTIFACT_NAME_${CONF}}
    ./${CND_ARTIFACT_NAME_${CONF}} -i
Run Code Online (Sandbox Code Playgroud)

我正在关注如何创建 .DEB 包Debian 新维护者指南。当我dpkg-buildpackage -rfakeroot成功完成上述所有步骤后运行时,我遇到了以下错误

$ dpkg-buildpackage -rfakeroot
dpkg-buildpackage: source package remotedevicecontroller
dpkg-buildpackage: source version 1.0-1
dpkg-buildpackage: source changed by satya gowtham kudupudi (gowtham) <gowthamk@newmeksolutions.com>
dpkg-buildpackage: host architecture i386
 dpkg-source --before-build remotedevicecontroller-1.0
 fakeroot debian/rules clean
dh clean
dh: No packages to build.
 dpkg-source -b remotedevicecontroller-1.0
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building remotedevicecontroller using existing ./remotedevicecontroller_1.0.orig.tar.gz
dpkg-source: info: building remotedevicecontroller in remotedevicecontroller_1.0-1.debian.tar.gz
dpkg-source: info: building remotedevicecontroller in remotedevicecontroller_1.0-1.dsc
 debian/rules build
dh build
dh: No packages to build.
 fakeroot debian/rules binary
dh binary
dh: No packages to build.
 signfile remotedevicecontroller_1.0-1.dsc

You need a passphrase to unlock the secret key for
user: "satya gowtham kudupudi (gowtham) <gowthamk@newmeksolutions.com>"
2048-bit RSA key, ID 9A2853A0, created 2013-08-22

gpg: gpg-agent is not available in this session

 dpkg-genchanges  >../remotedevicecontroller_1.0-1_i386.changes
dpkg-genchanges: error: cannot read files list file: No such file or directory
dpkg-buildpackage: error: dpkg-genchanges gave error exit status 2
Run Code Online (Sandbox Code Playgroud)

http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#defaultrules没有解释rules文件的作用是什么。有什么作用

%:
    dh $@
Run Code Online (Sandbox Code Playgroud)

意思?为什么dpkg-buildpackage -rfakerootdh: No packages to build.

and*_*ing 4

rules文件负责实际创建包的所有工作。它是一个 Makefile,其目标是编译和安装应用程序,然后.deb从已安装的文件创建文件。它还具有清理所有构建文件的目标,以便您最终再次得到一个源包。正如Debian 政策手册所说:

该文件必须是可执行的 makefile,并且包含用于编译包和从源构建二进制包的特定于包的配方。

这很好,但这里实际上发生了什么:

%:
    dh $@
Run Code Online (Sandbox Code Playgroud)

dh是一个辅助命令,它调用其他 Make 目标并运行一系列debhelper命令。作为它的联机帮助页联机帮助页图标描述它:

   dh runs a sequence of debhelper commands. The supported sequences
   correspond to the targets of a debian/rules file: build-arch, build-
   indep, build, clean, install-indep, install-arch, install, binary-arch,
   binary-indep, and binary.
Run Code Online (Sandbox Code Playgroud)

再说一次,它只是一个帮助文件来简化事情。您实际上不需要使用它,但它使您的生活变得更加轻松。要查看每个目标中实际运行的命令,请运行:

dh binary-arch --no-act
Run Code Online (Sandbox Code Playgroud)

现在针对您的具体问题...我认为这与您的文件没有任何关系rules。在没有看到实际的源码包的情况下,很难确定问题是什么。尽管我冒险猜测您的文件中没有二进制包节debian/control。在以下代码片段中,第一个“节”描述了源包,而第二个“节”描述了它将构建的二进制包:

Source: hello
Section: devel
Priority: optional
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
XSBC-Original-Maintainer: Jane Doe <packager@example.com>
Standards-Version: 3.9.1
Build-Depends: debhelper (>= 7)
Homepage: http://www.gnu.org/software/hello/

Package: hello
Architecture: any
Depends: ${shlibs:Depends}
Description: The classic greeting, and a good example
 The GNU hello program produces a familiar, friendly greeting. It
 allows non-programmers to use a classic computer science tool which
 would otherwise be unavailable to them. Seriously, though: this is
 an example of how to do a Debian package. It is the Debian version of
 the GNU Project's `hello world' program (which is itself an example
 for the GNU Project).
Run Code Online (Sandbox Code Playgroud)