LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2012, 01:08 PM   #1
cluelessGoogler
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Rep: Reputation: Disabled
simple rpm


I am using Centos 6.2


I am trying to create a very simple RPM. All I want to do is take a directory of files and move it to a different directory.
I know there are other ways to do it, but let's say I have to do it via RPM.

I've been trying 2 different directions and so far neither works the way I want:


1) Treat .spec file as if it was a .sh file:------------------------------------------------

%prep
cd %{_topdir}
cd ..
tar -pczf myTarrball.tar.gz sourceDir
echo Created tarball


%build


%install
cd %{_topdir}
cd ..
mv sb2nms.tar.gz destDirPath
cd destDirPath
tar xvfz myTarrball
echo Tarball unpacked in destDirPath
rm -rf $RPM_BUILD_ROOT


%clean
rm -rf $RPM_BUILD_ROOT
cd sourceDir
rm -rf myTarrball


%files

When I run rpmbuild -ba spec1.spec (as a build user) it actually does what I want and creates an rpm file inside RPMS/
Then when I try to run that RPM as root, it executes and does nothing. I don't see any of the echos just a 100% progress bar. What am I doing wrong here?

2) Treat .spec file as if it was an archive:------------------------------------------------
I am not sure if it is accurate but I found some examples that led me to believe that rpm files case basically behave like archives. So I did this next:

%prep
#cd %{_topdir}
#cd ..
#tar -pczf sb2nms.tar.gz sb2nms
#echo Created tarball


%build

%install

%clean

%files
sourceDir/*


I get a ton of warnings like:
Provides: perl(constants) perl(dbModule) perl(decisionModule) perl(formattedLog) perl(mainModule) perl(metricModule)
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /usr/bin/perl perl(CGI) perl(CGI::Carp) perl(Data:umper) perl(Data::Types) perl(Exporter) perl(Fcntl) perl(IO::Socket::INET) perl(POSIX) perl(SOAP::Lite) perl(SOAP::Transport::HTTP) perl(Switch) perl(Text::CSV) perl(attributes) perl(constants) perl(dbModule) perl(decisionModule) perl(formattedLog) perl(lib) perl(mainModule) perl(metricModule) perl(strict) perl(vars) perl(warnings)

and it creates an RPM. Next I try to run the RPM:
rpm -Uvh myRPM.rpm --nodeps <- had to suppress some dependencies related to warnings above
and nothing happens:
Preparing... ########################################### [100%]
1:myRPM ########################################### [100%]

Expected to see some files get unpacked into dir i was running rpm from, but nothing happens.


Any pointers would very appreciated.
 
Old 11-15-2012, 02:57 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Quote:
Originally Posted by cluelessGoogler View Post
All I want to do is take a directory of files and move it to a different directory. (..) What am I doing wrong here?
RPM is for package management, not for trivial and arbitrary file ops.


Quote:
Originally Posted by cluelessGoogler View Post
I found some examples that led me to believe that rpm files case basically behave like archives.
In essence, yes: RPM header, cpio archive, section shell scripts. So basically you can unpack a tarball into a build root, install contents in a temporary directory, populate the files section and be done with it. But again, arbitrary move ops are not what RPM is for.
 
Old 11-16-2012, 01:04 AM   #3
cluelessGoogler
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Ok I already said that I know RPM isn't needed for this, but had to do this this way anyway, so let's move on from what RPM is or is not for etc.

Your second comment is halfway helpful. Could you please explain in a bit more detail maybe with code lines as well?
There is no tarball to begin with. Assume a regular uncompressed directory is what we start with. Are you suggesting that I use say %prep section to do:
%prep
1) a manual tarring of the starting dir: tar someDefaultLocation/dirTObeMoved
2) move the resulting tarball to BUILDROOT directory (what for? because %files section requires them to be there??)
3) untar the tarball manually inside BUILDROOT
%files
4) list the topmost directory BUILDROOT/dirTobeMoved in the files section (x/y/z/* notation works here?)
done?

Will it then unpack all the files listed in 4 wherever I run rpm -Uvh createdRpm.rpm?
Because so far that is not working...
What all those warnings I got (see my OP)?

When I run the rpm -Uvh without dependency suppression I get these:
error: Failed dependencies:
perl(Data::Types) is needed by myRPM-1-1.el6.noarch
perl(SOAP::Lite) is needed by myRPM-1-1.el6.noarch
perl(SOAP::Transport::HTTP) is needed by myRPM-1-1.el6.noarch
perl(Text::CSV) is needed by myRPM-1-1.el6.noarch
Do I need these packages? All I am trying to do is move a directory, what do I need perl stuff for?
Thanks in advance. If there is a better forum where to post this, please let me know.



Edit:

So I tried following your other post here: http://www.linuxquestions.org/questi...c-file-648210/
and moved all the operations in the spec such as moving all the files from the sourceDir to topDir/BUILD into %prep.
Still when it gets to %install section I get:

+ /usr/lib/rpm/brp-compress
/usr/lib/rpm/brp-compress: line 8: cd: /home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386: No such file or directory
+ /usr/lib/rpm/brp-strip
find: `/home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386': No such file or directory
+ /usr/lib/rpm/brp-strip-static-archive
find: `/home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386': No such file or directory
+ /usr/lib/rpm/brp-strip-comment-note
find: `/home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386': No such file or directory

currently only %prep and %files are not blank. What am I doing wrong here?

Last edited by cluelessGoogler; 11-16-2012 at 02:34 AM.
 
Old 11-16-2012, 05:46 AM   #4
cluelessGoogler
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Never mind I figured it out.
Here is a source the finally helped: http://www.techrepublic.com/article/...-files/5032728
 
Old 11-16-2012, 10:14 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
For completeness sake, just in case anyone else comes across this thread:

Quote:
Code:
Provides: perl(constants) perl(dbModule) perl(decisionModule) perl(formattedLog) perl(mainModule) perl(metricModule)
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /usr/bin/perl perl(CGI) perl(CGI::Carp) perl(Data::Dumper) perl(Data::Types) perl(Exporter) perl(Fcntl) perl(IO::Socket::INET) perl(POSIX) perl(SOAP::Lite) perl(SOAP::Transport::HTTP) perl(Switch) perl(Text::CSV) perl(attributes) perl(constants) perl(dbModule) perl(decisionModule) perl(formattedLog) perl(lib) perl(mainModule) perl(metricModule) perl(strict) perl(vars) perl(warnings)
These weren't warnings but part of regular dependency checking.


Quote:
Code:
error: Failed dependencies:
	perl(Data::Types) is needed by myRPM-1-1.el6.noarch
	perl(SOAP::Lite) is needed by myRPM-1-1.el6.noarch
	perl(SOAP::Transport::HTTP) is needed by myRPM-1-1.el6.noarch
	perl(Text::CSV) is needed by myRPM-1-1.el6.noarch
Do I need these packages?
Simply put: yes.


Quote:
Code:
+ /usr/lib/rpm/brp-compress
/usr/lib/rpm/brp-compress: line 8: cd: /home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386: No such file or directory
+ /usr/lib/rpm/brp-strip
find: `/home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386': No such file or directory
+ /usr/lib/rpm/brp-strip-static-archive
find: `/home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386': No such file or directory
+ /usr/lib/rpm/brp-strip-comment-note
find: `/home/mockbuild/rpm/BUILDROOT/myRPM-1-1.el6.i386': No such file or directory
Probably wrong usage of %{_buildroot}, %{_tmppath} or "%{name}-%{version}.%{release}.%{arch}" variables. The script driving this stage (which the error log shows the location of) holds the clues.


Quote:
Originally Posted by cluelessGoogler View Post
Ok I already said that I know RPM isn't needed for this, but had to do this this way anyway (..) All I am trying to do is move a directory
It's not practical use that's the problem but a fundamental misunderstanding and violation of everything that RPM stands for.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Build Simple RPM of SMB malcmcmul Fedora 5 05-16-2012 09:46 AM
Query regarding buiding a simple rpm Rohit_4739 Linux - Software 1 10-13-2011 09:55 PM
RPM installation via simple user arm74 Linux - Software 10 04-30-2009 10:25 PM
Simple RPM problem radonski Linux - Newbie 3 10-22-2004 11:08 PM
Simple RPM Question f1uke Linux - Newbie 3 06-05-2003 04:12 PM


All times are GMT -5. The time now is 12:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration