LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cannot stat 'test.h': No such file or directory why? (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-stat-test-h-no-such-file-or-directory-why-4175599459/)

Merh 02-10-2017 12:24 PM

cannot stat 'test.h': No such file or directory why?
 
Hi
I'm a new linux user and use ubuntu. I have tried to build a RPM package and followed the steps at http://searchenterpriselinux.techtar...kages-in-Linux

and I removed the following lines from spec
BuildRequires: /bin/rm, /bin/mkdir, /bin/cp
Requires: /bin/bash, /bin/date

But when Im building RMP I get "cannot stat 'test.h': No such file or directory"

Thanks in advane
Merh

szboardstretcher 02-10-2017 12:28 PM

sounds like a typo somewhere.

isnt it supposed to be 'test.sh'? so search your thing for 'test.h' and change it to 'test.sh'

Also - why are you building an RPM on a Ubuntu system?

r3sistance 02-10-2017 12:31 PM

Just before we go anyfurther, want to confirm that you know that RPM packages are generally meant for Red Hat or SUSE variants of Linux? whereas ubuntu is branched off from the Debian side. deb or dpkg would be the alternatives for ubuntu I believe.

Merh 02-10-2017 12:45 PM

Quote:

Originally Posted by r3sistance (Post 5668437)
Just before we go anyfurther, want to confirm that you know that RPM packages are generally meant for Red Hat or SUSE variants of Linux? whereas ubuntu is branched off from the Debian side. deb or dpkg would be the alternatives for ubuntu I believe.

Hi
I correct the type to .sh. but the same problem. I test in both Redhat and ubuntu. In Redhat I'm not root user.

Merh 02-10-2017 12:51 PM

Hi
I correct the type to .sh. but the same problem. I'm testing in the both Redhat and ubuntu. In Redhat I'm not root user.

r3sistance 02-10-2017 12:52 PM

Ok, so is this the redhat box or the ubuntu box you are testing this on? also can you supply the command you are running for when you see the issues? With output.

Merh 02-10-2017 12:56 PM

I have changed from ubuntu to Redhat so Im testing in Redhat which I'm not user.

I use the commond rpmbuild -ba demo.spec

Merh 02-10-2017 01:11 PM

Redhat which I'm not root user. Command is rpmbuild -ba demo.spec

Merh 02-10-2017 01:12 PM

I have changed from ubuntu to Redhat so Im testing in Redhat which I'm not root user.

I use the commond rpmbuild -ba demo.spec

Merh 02-10-2017 01:15 PM

I have changed from ubuntu to Redhat so Im testing in Redhat which I'm not roo user.

I use the commond rpmbuild -ba demo.spec
and get

cp test.sh /home/Merh/rpmbuild/BUILDROOT/test-1.0-1.el7.x86_64/home/Merh/bin
cp: cannot stat 'test.sh': No such file or directory

r3sistance 02-10-2017 01:26 PM

there is an edit button. What does `tar -tf ~/rpmbuild/SOURCES/test-1.0.tar.gz` return?

Merh 02-10-2017 01:29 PM

It returns
test-1.0/
test-1.0/test.sh

szboardstretcher 02-10-2017 01:59 PM

Primary reason for the issue is that the article is crap. Its wrong. The spec file he uses is wrong.

So here. Here is my re-interpretation.

Code:

(Log in as a non-root user)
mkdir ~/test-1.0
cd ~/test-1.0
echo echo this is a test > test.sh
chmod +x test.sh
echo just launch the script > README
cd
mkdir -p ~/rpmbuild/SOURCES
mkdir -p ~/rpmbuild/SPECS
tar -cvzf ~/rpmbuild/SOURCES/test-1.0.tar.gz test-1.0
cp test-1.0/* ~/rpmbuild/BUILD
vim ~/rpmbuild/SPECS/demo.spec

The demo.spec file contents:
Code:

Name:              test
Version:            1.0
Release:          1%{?dist}
Summary:        A test package
Group:              Test Packages
License:            GPL
URL:                http://test.example.com
Source0:          %{name}-%{version}.tar.gz
BuildRoot:        %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires:  /bin/rm, /bin/mkdir, /bin/cp
Requires:          /bin/bash, /bin/date

%description

Demo package for deployment of one single file

%prerp
%setup -q

%build
#configure
#make %{? _smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT


#make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
cp test.sh $RPM_BUILD_ROOT/usr/local/bin

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(755,root,root,755)
#%doc
%attr(0755,root,root)/usr/local/bin/test.sh

%changelog

Build the thing:
Code:

rpmbuild -ba rpmbuild/SPECS/demo.spec
You can see all of my output here:
Code:

[user@tools ~]$ rpmbuild -ba rpmbuild/SPECS/demo.spec
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.jYpa1I
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.fxKNN2
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ '[' /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64 '!=' / ']'
+ rm -rf /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
++ dirname /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ mkdir -p /home/user/rpmbuild/BUILDROOT
+ mkdir /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ rm -rf /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ mkdir -p /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64/usr/local/bin
+ cp test.sh /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64/usr/local/bin
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: test-1.0-1.el7.centos.x86_64
Provides: test = 1.0-1.el7.centos test(x86-64) = 1.0-1.el7.centos
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
Wrote: /home/user/rpmbuild/SRPMS/test-1.0-1.el7.centos.src.rpm
Wrote: /home/user/rpmbuild/RPMS/x86_64/test-1.0-1.el7.centos.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.2fuu20
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ rm -rf /home/user/rpmbuild/BUILDROOT/test-1.0-1.el7.centos.x86_64
+ exit 0

Done.

Merh 02-10-2017 02:47 PM

Thanks a lot. But when I install it nothing happens, I mean the directory bin under home/merh/ is not created and so on. I appreciate your help.

Name: test
Version: 1.0
Release: 1%{?dist}
Summary: A test package
Group: Test Packages
License: GPL
URL: http://test.example.com
Source0: %{name}-%{version}.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: /bin/rm, /bin/mkdir, /bin/cp
Requires: /bin/bash, /bin/date

%description

Demo package for deployment of one single file

%prerp
%setup -q

%build
#configure
#make %{? _smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT


#make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/home/mehr/bin
cp test.sh $RPM_BUILD_ROOT/home/mehr/bin

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(755,root,root,755)
#%doc
%attr(0755,root,root)/home/mehr/bin/test.sh

%changelog


All times are GMT -5. The time now is 01:00 AM.