bash RPM 构建错误:来自 /var/tmp/rpm-tmp.32XJLX (%install) 的错误退出状态

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27340598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 21:46:18  来源:igfitidea点击:

RPM build errors:Bad exit status from /var/tmp/rpm-tmp.32XJLX (%install)

bashcentosrpmrpmbuildrpm-spec

提问by Aravinda

Im trying to create a simple rpm package on centos 6.5.. But i cannot finish it as its giving me errors.. I have already followed these two threads.. Bad exit status from /var/tmp/rpm-tmp.b1DgAt (%build)and Bad exit status from /var/tmp/rpm-tmp.ajKra4 (%prep).. yet no luck...

我试图在 centos 6.5 上创建一个简单的 rpm 包.. 但我无法完成它,因为它给了我错误.. 我已经关注了这两个线程.. /var/tmp/rpm-tmp.b1DgAt (% build)来自 /var/tmp/rpm-tmp.ajKra4 (%prep) 的错误退出状态......但没有运气......

I cannot figure out what i'm missing here.. please help me to fix this..

我不知道我在这里遗漏了什么..请帮我解决这个问题..

this is my

这是我的

Name:   test
Version: 1.0    
Release:    1%{?dist}
Summary: A test package 

Group:      Testing
License:    GPL
URL:        http://www.yahoo.com
Source0:        test-1.0.tar.gz
BuildRoot:  %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

BuildRequires:  /bin/rm, /bin/mkdir, /bin/cp
Requires:   /bin/bash, /bin/date

%description
this is the test package build for rhche

%prep
%setup -q

%build
./configure
%install
rm -rf $RPM_BUILD_ROOT
make -p $RPM_BUILD_ROOT/usr/local/bin
cp myscriptdate $RPM_BUILD_ROOT/usr/local/bin

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%attr(0755,root,root)/usr/local/bin/myscriptdate

%changelog
* Thu Dec 09 2010 Forrest <[email protected]> 1.0-1
-Initial RPM
-Added /usr/local/bin/myscript

Source directory is /test1

源目录是/test1

[ara@catshit test1]$ pwd
/test1
[ara@catshit test1]$ ls -ls
total 12
4 drwxrwxrwx. 2 ara ara 4096 Dec  7 00:02 test-1.0
4 -rw-rw-r--. 1 ara ara  210 Dec  7 00:09 test-1.0.tar.gz
4 -rwxrwxrwx. 1 ara ara  742 Dec  7 00:17 test.spec
[ara@catshit test1]$

test-1.0 is compressed as test-1.0.tar.gz. Inside test-1.0 I have script called myscriptdate which is having following simple code..

test-1.0 被压缩为 test-1.0.tar.gz。在 test-1.0 中,我有一个名为 myscriptdate 的脚本,它具有以下简单代码。

'#!/bin/bash

'#!/bin/bash

date

日期

when i try rpmbuild -ba test.specit gives me

当我尝试时rpmbuild -ba test.spec它给了我

# Not a target:
.f:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
    $(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@

# Not a target:
.f.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
    $(COMPILE.f) $(OUTPUT_OPTION) $<

# files hash-table stats:
# Load=70/1024=7%, Rehash=0, Collisions=278/1660=17%
# VPATH Search Paths

# No `vpath' search paths.

# No general (`VPATH' variable) search path.

# # of strings in strcache: 0
# # of strcache buffers: 0
# strcache size: total = 0 / max = 0 / min = 4096 / avg = 0
# strcache free: total = 0 / max = 0 / min = 4096 / avg = 0

# Finished Make data base on Sun Dec  7 00:51:01 2014

error: Bad exit status from /var/tmp/rpm-tmp.ZFlmeu (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.ZFlmeu (%install)

/var/tmp/rpm-tmp.ZFlmeu content is below

/var/tmp/rpm-tmp.ZFlmeu 内容如下

#!/bin/sh

  RPM_SOURCE_DIR="/home/ara/rpmbuild/SOURCES"
  RPM_BUILD_DIR="/home/ara/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-O2 -g"
  RPM_ARCH="x86_64"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="test"
  RPM_PACKAGE_VERSION="1.0"
  RPM_PACKAGE_RELEASE="1.el6"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/home/ara/rpmbuild/BUILDROOT/test-1.0-1.el6.x86_64"
  export RPM_BUILD_ROOT

  PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH

  set -x
  umask 022
  cd "/home/ara/rpmbuild/BUILD"
cd 'test-1.0'
rm -rf $RPM_BUILD_ROOT
make -p $RPM_BUILD_ROOT/usr/local/bin
cp myscriptdate $RPM_BUILD_ROOT/usr/local/bin





    /usr/lib/rpm/brp-compress 
    /usr/lib/rpm/brp-strip 
    /usr/lib/rpm/brp-strip-static-archive 
    /usr/lib/rpm/brp-strip-comment-note 

回答by Etan Reisner

The make -p $RPM_BUILD_ROOT/usr/local/binline is your problem.

make -p $RPM_BUILD_ROOT/usr/local/bin行是你的问题。

While not the problem you almost certainly don't want -pon that line. As it doesn't do anything useful for you during compilation and your rpm build process has no need to see the make database of rules.

虽然不是您几乎肯定不希望-p在那条线上出现的问题。因为它在编译期间对您没有任何用处,并且您的 rpm 构建过程不需要查看规则的 make 数据库。

The real problem is that you are telling make that you would like it to build the $RPM_BUILD_ROOT/usr/local/bintarget which it is incrediblyunlikely that make actually knows how to build (thus causing make to fail to build it and giving you an error). Removing the -pwill help you see the actualerror that make is spitting out as it will not also spit out the rule database stuff.

真正的问题是,你告诉化妆,你会喜欢它打造的$RPM_BUILD_ROOT/usr/local/bin目标,它是令人难以置信的可能性不大,让真正懂得如何构建(从而造成化妆失败来构建它,并给你一个错误)。删除-p将帮助您查看make 吐出的实际错误,因为它也不会吐出规则数据库的内容。

I thinkyou meant mkdir -pthere instead. (Which should be available as the %{__mkdir_p}macro.)

你的意思是mkdir -p在那里。(应该可以作为%{__mkdir_p}宏使用。)