0

I am trying to build an RPM which will copy some directories which files in them, however, I am getting an error message saying that the directory doesn't exist.

My code is as follows:

Version: 1
Release: 0
Summary: Copy user dirs / files rpm
Source0: user-files-1.0.tar.gz
License: GPL
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
Write some descripton about your package.
%prep
%setup -q
%build
%install
install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/bin/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/config/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/lib64/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/var/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/usr/

cp $RPM_BUILD_ROOT/user_files-1/ $RPM_BUILD_ROOT/tmp/user-files

%clean
rm -rf $RPM_BUILD_ROOT
%post
echo . .
echo .I've finished copying the files!.
%files
%dir /tmp/user-files/*
#%dir /tmp/user-files/bin/
#%dir /tmp/user-files/config/
#%dir /tmp/user-files/lib64/
#%dir /tmp/user-files/var/
#%dir /tmp/user-files/usr/

The exact error is included below:

[sergiu@buildrpm rpmbuild]$ rpmbuild -ba SPECS/user-files.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.yL8Vqa
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/sergiu/rpmbuild/BUILD
+ rm -rf user-files-1
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/sergiu/rpmbuild/SOURCES/user-files-1.0.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd user-files-1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.6XiDeh
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.pox03n
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ '[' /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64 '!=' / ']'
+ rm -rf /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
++ dirname /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ mkdir -p /home/sergiu/rpmbuild/BUILDROOT
+ mkdir /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ install -m 0755 -d /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/tmp/user-files
+ /usr/bin /usr/etc /usr/games /usr/include /usr/lib /usr/lib64 /usr/libexec /usr/local /usr/sbin /usr/share /usr/src /usr/tmp
/var/tmp/rpm-tmp.pox03n: line 37: /usr/bin: is a directory
error: Bad exit status from /var/tmp/rpm-tmp.pox03n (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.pox03n (%install)
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ cp SPECS/user-files.spec SPECS/user-files.spec.old
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ ls
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS
[sergiu@buildrpm rpmbuild]$ ls SPECS/
dbbackup.spec  user-files.spec  user-files.spec.old
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ rpmbuild -ba SPECS/user-files.spec
error: Name field must be present in package: (main package)
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ rpmbuild -ba SPECS/user-files.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.YvFPtC
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/sergiu/rpmbuild/BUILD
+ rm -rf user-files-1
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/sergiu/rpmbuild/SOURCES/user-files-1.0.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd user-files-1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.2esSel
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.4Ccy13
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ '[' /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64 '!=' / ']'
+ rm -rf /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
++ dirname /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ mkdir -p /home/sergiu/rpmbuild/BUILDROOT
+ mkdir /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ install -m 0755 -d /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/tmp/user-files
+ cp /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/user_files-1/ /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/tmp/user-files
cp: cannot stat `/home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/user_files-1/': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.4Ccy13 (%install)


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

Will someone please tell me what I am doing wrong and how should I approach this problem?

Reaces
  • 5,597
  • 4
  • 38
  • 46
Sergiu
  • 113
  • 2
  • 6
  • can you also post the error message itself please? – Tom Aug 27 '15 at 13:06
  • Are you sure that's the spec file corresponding to the error? It looks incomplete, and there's nothing in there that looks reasonably related to the problem shown. – Michael Hampton Aug 27 '15 at 15:19
  • Hi Michael, Thank you for your reply. Well I am pretty sure it is. – Sergiu Aug 27 '15 at 15:28
  • you cannot use `cp` to copy a dir with `cp /dir/ /dest`. Is the trailing / a typo or are you missing a * or `cp -r`? – meuh Aug 27 '15 at 15:49
  • @meuh which line are you referring to? – Sergiu Aug 27 '15 at 15:59
  • `cp $RPM_BUILD_ROOT/user_files-1/ $RPM_BUILD_ROOT/tmp/user-files` – meuh Aug 27 '15 at 16:06
  • @meuh well I have tried to use cp -r directory/files $RPM_BUILD_ROOT/tmp/user-files/ but it didn't worked – Sergiu Aug 27 '15 at 16:20
  • Also I had another go meanwhile and this is what I have to do: http://pastebin.com/L5mXazDR And I am getting this error: http://pastebin.com/T49bWUgr So as you can see I am trying to copy all those files using cp or an alternative however, I am getting errors :( – Sergiu Aug 27 '15 at 16:23

0 Answers0