LinuxQuestions.org
Visit Jeremy's Blog.
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 06-20-2014, 09:53 AM   #1
hashbangbinbash
Member
 
Registered: Mar 2008
Posts: 106

Rep: Reputation: 16
RPM Spec File questions


Hello,

I have been following various guides on the internet to see how to build a simple RPM. I think I've got the general idea, but when it comes to editing the spec file they all seem to have a different idea, and some of them goive spec file examples that don't look like the skeleton specfile I have.

I am using rpmdevtools-7.5-2 (x86). My simple demo spec file is below:

Code:
Name:           Hello
Version:        1.0
Release:        1%{?dist}
Summary:        A script to shout a brother yo

Group:          Amusements/Games
License:        GPL
URL:            http://google.com
Source0:        /home/rpmbuilder/rpmbuild/SOURCES/hello.tar.gz
BuildArch:      noarch
BuildRoot      /tmp

#BuildRequires:  
#Requires:       

%description
My test rpm thing

%prep
%setup -q


%build
#%configure
#make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
#make install DESTDIR=$RPM_BUILD_ROOT
install -d 0755 $RPM_BUILD_ROOT/usr/bin
install -m 0755 hello.sh $RPM_BUILD_ROOT/usr/bin

%clean
rm -rf $RPM_BUILD_ROOT


%files
%dir /usr/bin
%defattr(-,root,root,-)
/usr/bin/hello.sh
%doc



%changelog
So what I've done here is-

rpmdev-setuptree to create the build tree (BUILD, SOURCES, SPECS and so on)

Wrote a bash script containing 'echo "Hello World"' and turn it into an executable called hello.sh

Then I've tar/gzipped that into SOURCES directory
tar -cvzf SOURCES/hello.tar.gz hello.sh

Then ran rpmdev-newspec and populated it with the basic information in the quote above. I'm not bothered about URL being google.com, and I think (at least rpmbuild hasn't compolained about using path to the SOURCE directory as Source0.

But two problems I see, BuildRoot- as there's no complilation required, can't I just have /tmp for this? Or does it have top be a string of Macros describing a path, and if so- path to where, to the SOURCE directory? The guides I have followed so far don't seem clear on this point at all.

Which means furthe down, where I've put...

install -d 0755 $RPM_BUILD_ROOT/usr/bin
install -m 0755 hello.sh $RPM_BUILD_ROOT/usr/bin


do those locations look ok (should result in /tmp/usr/bin) given what I've set as my BuildRoot? In some examples BuildRoot was a string of percentage symbols and curly brackets... Any pointers at all would be appreciated.

Last edited by hashbangbinbash; 06-20-2014 at 09:59 AM.
 
Old 06-20-2014, 10:02 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,836

Rep: Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360
As a maintainer of various RPM based software throughout the years, I will say that my favorite piece of software in many years is this:

https://github.com/jordansissel/fpm

No hassle RPM/Deb/etc.. making. Hope this changes your life like it did for me.

Last edited by szboardstretcher; 06-20-2014 at 10:03 AM.
 
  


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
LFS RPM SPEC files: Binutils RPM spec for x86 arch nocountryman Linux From Scratch 2 10-25-2010 10:09 AM
rpm spec file help AutoC Fedora 3 01-30-2008 09:25 AM
rpm spec file alrawab Linux - General 2 03-28-2007 07:39 AM
RPM Spec file adddy Linux - Software 8 11-07-2006 06:02 AM
questions on writing own rpm .spec file adrianmak Linux - Software 0 08-18-2005 07:03 AM


All times are GMT -5. The time now is 09:42 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