困扰一天的rpm打包问题

rpm打包咱们常常会遇到,经过直接拷贝的方式达来打包的状况。可是发现打包的时候并非想象中的那么顺利,好比你会遇到这种状况:mysql

wKiom1bpDefz7uLZAADU0CDrqco692.png

 一般赶上上面的警告以后,你仍是能打包完成的。可是你会发现打包完成的rpm包很不正常的,不管从大小和安装方面都不行。holy shit!,我只是简单的拷贝啊。咱们的rpmbuild代码也很简单:sql

# Disable the stupid stuff rpm distros include in the build process by default:
#   Disable any prep shell actions. replace them with simply 'true'
#%define __spec_prep_post true
#%define __spec_prep_pre true
#   Disable any build shell actions. replace them with simply 'true'
#%define __spec_build_post true
#%define __spec_build_pre true
#   Disable any install shell actions. replace them with simply 'true'
#%define __spec_install_post true
#%define __spec_install_pre true
#   Disable any clean shell actions. replace them with simply 'true'
#%define __spec_clean_post true
#%define __spec_clean_pre true
# Disable checking for unpackaged files ?
#%undefine __check_files

# Use md5 file digest method
#%define _binary_filedigest_algorithm 1

# Use gzip payload compression
#%define _binary_payload w9.gzdio

%preq
# noop
%setup -q

%build
# noop

%install
# noop
%{__mkdir_p} %{buildroot}%{_usr}/local/resin1414
%{__mkdir_p} %{buildroot}/tmp/mysql
%{__cp} -r %{_builddir}/%{name}-%{version}/* %{buildroot}/tmp/mysql/.

#%{__cp} -r $RPM_BUILD_DIR/%{name}-%{version}/* %{buildroot}/tmp/.
#%{__cp} -r /root/rpmbuild/BUILD/%{name}-%{version}/* %{buildroot}/tmp/mysql/.

%clean
# noop


%files
%defattr(-,root,root,-)

# Reject config files already listed or parent directories, then prefix files
# with "/", then make sure paths with spaces are quoted. I hate rpm so much.
/tmp/mysql/
/usr/local/resin1414

为这个问题我夜里睡不着,吃饭也不香。此问题不解决,迟早有一天也会再次困扰我。终于仍是找到了。shell

AutoReqProv: no

是的,就是这个参数。bash

The autoreqprov, autoreq, and autoprov Tags — Disable Automatic Dependency Processing
There may be times when RPM's automatic dependency processing is not desired. In these cases, the autoreqprov, autoreq, and autoprov tags may be used to disable it. This tag takes a yes/no or 0/1 value. For example, to disable automatic dependency processing, the following line may be used:
AutoReqProv: no

The autoreq and autoprov tags can be used to disable automatic processing of requirementsor "provides" only, respectively.