debian/rules 错误“没有制定目标的规则”

debian/rules 错误“没有制定目标的规则”

我在使用 debuild 创建 .deb 文件时遇到了一些问题

在阅读一些教程之前,我设法制作了该文件,但我总是收到此错误:

    make: *** No rule to make target «build». Stop.
    dpkg-buildpackage: failure: debian/rules build gave error exit status 2
    debuild: fatal error at line 1329:
    dpkg-buildpackage -rfakeroot -D -us -uc -b failed

有什么帮助吗?

这是我的 Debian 规则文件:

    #!/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

    build-stamp: configure-stamp 
        dh_testdir
        touch build-stamp

    clean:
        dh_testdir
        dh_testroot
        rm -f build-stamp configure-stamp
        dh_clean

    install: build
        dh_testdir
        dh_testroot
        dh_clean -k 
        dh_installdirs
        $(MAKE) install DESTDIR=$(CURDIR)/debian/pycounter
        mkdir -p $(CURDIR)/debian/pycounter

        # Copy .py files
        cp pycounter.py $(CURDIR)/debian/pycounter/opt/extras.ubuntu.com/pycounter/pycounter.py
        cp prefs.py $(CURDIR)/debian/pycounter/opt/extras.ubuntu.com/pycounter/prefs.py

        # desktop copyright and others (not complete, check)
        cp extras-pycounter.desktop $(CURDIR)/debian/pycounter/usr/share/applications/extras-pycounter.desktop

答案1

build正如错误消息所示,规则文件中没有目标。您的install目标将其列为要求。debian/rules文件是 Makefile。您可能需要阅读一些相关内容。

但是你可以使用简单的帮助程序来简化这个过程dh。你的规则文件看起来应该像这样:

#!/usr/bin/make -f

%:
        dh $@

override_dh_auto_install:
    # Copy .py files
    cp pycounter.py $(CURDIR)/debian/pycounter/opt/extras.ubuntu.com/pycounter/pycounter.py
    cp prefs.py $(CURDIR)/debian/pycounter/opt/extras.ubuntu.com/pycounter/prefs.py

    # desktop copyright and others (not complete, check)
    cp extras-pycounter.desktop $(CURDIR)/debian/pycounter/usr/share/applications/extras-pycounter.desktop
    dh_auto_install

我还建议您研究使用dh_install而不是cpIe:

dh_install prefs.py /opt/extras.ubuntu.com/pycounter/

参见命令手册dh手册页图标命令手册dh_install手册页图标

相关内容