LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   RPM Spec File questions (https://www.linuxquestions.org/questions/linux-newbie-8/rpm-spec-file-questions-4175508626/)

hashbangbinbash 06-20-2014 08:53 AM

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.

szboardstretcher 06-20-2014 09:02 AM

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.


All times are GMT -5. The time now is 09:05 PM.