简体   繁体   中英

Cannot create RPM package

I'm trying to create RPM spec file. Unfortunately I can't find how to fix this issue.

I created the rpm build directories using the command rpmdev-setuptree and I created simple spec file. I placed the source file under SOURCES/test-one-1.0.tar.gz

This is the spec file:

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

When I run the command rpmbuild -bb -v rpm/SPECS/kernel.spec

I get this output:

[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 ~]$

Can you help me to fix this issue?

%setup assumes that extracting the source creates a directory with the same name as %name . If this is not the case then you should use the -n argument to specify an alternate directory name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM