日期:2014-05-16  浏览次数:20694 次

linux RPM打包时出错,求助!!!
spec文件内容:
C/C++ code

 1 Summary: A test spec file for build rpm package
  2 Name: php_rpm_test
  3 Version: 1.0.1
  4 Release: 1%{?dist}
  5 License: Commercial
  6 Group: Development/Languages
  7 Source0: %{name}-%{version}.tar.gz
  8 BuildRoot: %{_tmppath}/%{name}-root
  9 Requires: php >= 5.2-
 10 %define www /home/qianhaiqing/
 11 %define pear /usr/lib/php/pear
 12
 13 %description
 14 php_rpm_test is a test package. It only show vistor's ip address.
 15
 16 %prep
 17 %setup -q
 18
 19 %build
 20
 21 %install
 22 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
 23 install -d $RPM_BUILD_ROOT%{www}
 24 install -d $RPM_BUILD_ROOT%{pear}
 25 cp -rf index.tar.gz $RPM_BUILD_ROOT%{www}
 26
 27 %files
 28 %defattr(-, root, root)
 29 %{www}
 30
 31 %changelog
~



出错信息
C/C++ code

$ rpmbuild -bb test.spec


Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.94011
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf php_rpm_test-1.0.1
+ /bin/gzip -dc /usr/src/redhat/SOURCES/php_rpm_test-1.0.1.tar.gz
+ tar -xf -
tar: index.php: Cannot open: File exists
tar: Error exit delayed from previous errors
error: Bad exit status from /var/tmp/rpm-tmp.94011 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.94011 (%prep)
[qianhaiqing@nginx+tomcat SPECS]$ sudo rpmbuild -bb test.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.53914
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf php_rpm_test-1.0.1
+ /bin/gzip -dc /usr/src/redhat/SOURCES/php_rpm_test-1.0.1.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd php_rpm_test-1.0.1
/var/tmp/rpm-tmp.53914: line 36: cd: php_rpm_test-1.0.1: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.53914 (%prep)


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




------解决方案--------------------
Cannot open: File exists 文件不存在 ,,或者路径写错,,建议使用 checkinstall工具,自习写specs太痛苦了,,看你的错误都是路径写错了,,,