无法创建RPM包

时间:2014-12-27 19:59:47

标签: linux rpm rpmbuild rpm-spec

我正在尝试创建RPM spec文件。很遗憾,我无法找到解决此问题的方法。

我使用命令rpmdev-setuptree创建了rpm构建目录,并创建了简单的spec文件。我将源文件放在SOURCES / test-one-1.0.tar.gz

这是spec文件:

Name:           test
Version:        1.0
Release:        1%{?dist}
Summary:        test installation script

Group:          Utilities
License:        GPL
URL:            http://oracle-base.com/articles/linux/linux-build-simple-rpm-packages.php
Source0:        test-one-1.0.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

#BuildRequires:  
#Requires:       

%description
test installation script

%prep
%setup -q


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

#install -d $RPM_BUILD_ROOT/opt/mytest


%clean
rm -rf $RPM_BUILD_ROOT


%files
%dir /opt/mytest
%defattr(-,root,root,-)
%doc



%changelog

当我运行命令rpmbuild -bb -v rpm/SPECS/kernel.spec

我得到了这个输出:

[user@laptop ~]$ rpmbuild -bb -v rpm/SPECS/kernel.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.Hqq4KB
+ umask 022
+ cd /home/rcbandit/rpm/BUILD
+ cd /home/rcbandit/rpm/BUILD
+ rm -rf test-1.0
+ /usr/bin/gzip -dc /home/rcbandit/rpm/SOURCES/test-one-1.0.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd test-1.0
/var/tmp/rpm-tmp.Hqq4KB: line 34: cd: test-1.0: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.Hqq4KB (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.Hqq4KB (%prep)
[user@laptop ~]$

你能帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:2)

%setup假设提取源会创建一个与%name同名的目录。如果不是这种情况,则应使用-n argument指定备用目录名称。