Makefile rpmbuild正在退出,错误为:找不到文件

Makefile rpmbuild正在退出,错误为:找不到文件,makefile,rpm,rpmbuild,rpm-spec,Makefile,Rpm,Rpmbuild,Rpm Spec,我正在尝试构建我的第一个RPM包,并与rpmbuild过程进行斗争 这是我必须面对的环境: cat /home/rpmadm/.rpmmacros %_topdir /export/standardbuild %_tmppath /export/standardbuild/tmp %_sourcedir /export/standardbuild/SOURCES %_rpmdir /export/standardbuild/RPMS %_srcrpmdir /export/standardbu

我正在尝试构建我的第一个RPM包,并与rpmbuild过程进行斗争

这是我必须面对的环境:

cat /home/rpmadm/.rpmmacros

%_topdir /export/standardbuild
%_tmppath /export/standardbuild/tmp
%_sourcedir /export/standardbuild/SOURCES
%_rpmdir /export/standardbuild/RPMS
%_srcrpmdir /export/standardbuild/SRPMS
%_builddir /export/standardbuild/COMP_BUILDS/%{name}
我的Makefile如下所示:

packagename = metricconf

%_sourcedir = /export/standardbuild/SOURCES


# version number of package: make sure you also update the version
# number in the spec file
version = 1.0

all:
        @echo "usage: make dist | package"

install:
        if [ ! -d $(DESTDIR)/tmp/$(packagename) ]; \
        then \
                mkdir -p $(DESTDIR)/tmp/$(packagename); \
        fi
        
        cp mb_system_betrieb.yml        $(DESTDIR)/tmp/$(packagename)/mb_system_betrieb.yml
        cp metricbeat                   $(DESTDIR)/tmp/$(packagename)/metricbeat
        cp metricbeat.yml               $(DESTDIR)/tmp/$(packagename)/metricbeat.yml

dist:
        tar cvf $(packagename)-$(version).tar ../$(packagename)-$(version)
        gzip $(packagename)-$(version).tar
        cp $(packagename)-$(version).tar.gz $(%_sourcedir) && rm $(packagename)-$(version).tar.gz

package:        rpm

rpm:
        rpmbuild -ba $(packagename).spec
        rm -rf $(packagename)-$(version).tar
这是我的.spec文件:

Summary:        configures Metricbeat for AIX
Name:           metricconf
Version:        1.0
Release:        0
Vendor:         Comp 
Source:         metricconf-1.0.tar.gz
BuildRoot:      %{_builddir}/%{name}-{version}

Requires: metricbeat

%description
metricconf prepares AIX for metricbeat
%prep
%setup -c
%build
%install
%files
%defattr(644,root,system)
/tmp/metricbeat.yml
/tmp/mb_system_betrieb.yml
/tmp/metricbeat
make dist
运行良好,将正确创建.tar.gz文件。 但是
make rpm
命令每次都失败,出现以下错误:

make rpm
        rpmbuild -ba metricconf.spec
Executing(%prep): /bin/sh -e /export/standardbuild/tmp/rpm-tmp.cIlqQa
+ umask 022
+ cd /export/standardbuild/COMP_BUILDS/metricconf
+ cd /export/standardbuild/COMP_BUILDS/metricconf
+ rm -rf metricconf-1.0
+ /usr/bin/mkdir -p metricconf-1.0
+ cd metricconf-1.0
+ /bin/gzip -dc /export/standardbuild/SOURCES/metricconf-1.0.tar.gz
+ /bin/tar -xvvof -
x ../COOPmetricbeat-1.0
x ../COOPmetricbeat-1.0/metricconf.spec, 2289 bytes, 5 tape blocks
x ../COOPmetricbeat-1.0/ChangeLog, 135 bytes, 1 tape blocks
x ../COOPmetricbeat-1.0/Makefile, 885 bytes, 2 tape blocks
x ../COOPmetricbeat-1.0/README, 74 bytes, 1 tape blocks
x ../COOPmetricbeat-1.0/mb_system_betrieb.yml, 1161 bytes, 3 tape blocks
x ../COOPmetricbeat-1.0/metricbeat, 1552 bytes, 4 tape blocks
x ../COOPmetricbeat-1.0/metricbeat.yml, 1240 bytes, 3 tape blocks
+ STATUS=0
+ [ 0 -ne 0 ]
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /export/standardbuild/tmp/rpm-tmp.dalqQb
+ umask 022
+ cd /export/standardbuild/COMP_BUILDS/metricconf
+ cd COOPmetricbeat-1.0
+ exit 0
Executing(%install): /bin/sh -e /export/standardbuild/tmp/rpm-tmp.delqQc
+ umask 022
+ cd /export/standardbuild/COMP_BUILDS/metricconf
+ cd metricconf-1.0
+ exit 0
Processing files: metricconf-1.0-0.ppc
error: File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat.yml
error: File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/mb_system_betrieb.yml
error: File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat


RPM build errors:
    File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat.yml
    File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/mb_system_betrieb.yml
    File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat
make: 1254-004 The error code from the last command is 1.## Heading ##
请,有人能解释一下为什么rpmbuild要为文件而不是“/export/standardconf/COMP BUILDS/metricconf/metricconf/COMP BUILDS/metricconf-1.0”查找“/export/standardconf-1.0”中的“/export/standardconf-1.0”中的原因吗


我读了很多关于构建RPM的书,尤其是在Fedora的文档页面上,但不管我在Makefile或.spec文件中做了什么更改,错误仍然存在。

您的
%build
%install
阶段都是空的,所以它什么都不做。您所拥有的就是
%prep
,它正在将其解压到一个临时暂存区域中

环顾四周寻找示例,例如,如果您使用的是
autoconf
,您可能需要
%configure


ETA:看起来您还试图将最终文件放入目标计算机上的
/tmp
,但这不会起作用,因为它们会在重新启动后消失<代码>%files应该列出要安装在目标上的文件,但没有任何前导临时路径。

嗨,Aaron,谢谢你的回答。文件移动到/tmp以在%post脚本中进一步处理它。到目前为止,这是正确的。我仍然不明白文件夹的变量在哪里设置为“/export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/”我将签出%configure宏。不要这样做。RPM列出了文件的去向。否则,您将导致诸如自动扫描仪之类的问题,这些扫描仪将在您的机器上运行
rpm-aV
,并列出大量丢失的文件。将它们放在已知的绝对位置。如果您需要在
%post
中删除一两个符号链接,则可以。