Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 5th December 2009, 07:19 PM
erroneus's Avatar
erroneus Offline
Registered User
 
Join Date: Apr 2004
Posts: 595
linuxfedorafirefox
I want to make a simple RPM

The learning curve is making me dizzy. I am a terrible learner in that I need a good example of a starting point to tinker with before I move on to more complex things.

I have a custom created card face file that I have copied to:

/usr/share/gnome-games-common/cards/

This is the file I would like to wrap up into an RPM to share with friends.

The only dependency that I see should be gnome-games. I just want to be able to install this one file into its place and have it properly removed when the RPM is removed.

Can someone write up a spec file that does this and provide the command lines needed to make it into an RPM? From there, I think I should be able to figure out more complex things.
Reply With Quote
  #2  
Old 5th December 2009, 07:44 PM
RahulSundaram Offline
Registered User
 
Join Date: May 2005
Posts: 3,549
linuxfedorafirefox
# yum install rpmdevtools and run rpmdev-newspec and use the template or look at existing spec files at

http://cvs.fedoraproject.org/viewvc/rpms/

If it is a open source project, give me a link and I will take a look
__________________
Rahul
http://fedoraproject.org/wiki/RahulSundaram
Reply With Quote
  #3  
Old 5th December 2009, 07:55 PM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
macossafari
I have a tutorial on RPM building that you may find useful here: http://www.fedoraforum.org/forum/sho...d.php?t=126183

Below I've written a sample spec file, I've assumed the following:
  • Your card face file is uploaded online somewhere and contained in a tarball
  • All sources in the tarball are contained in a folder following the %{name}-%{version} format, so in this case "youname-0.1" for example.
  • You also included LICENSE and README files (if not, or if you have additional documentation files, change the %doc macro)
  • You have released the face under the GPLv2+ (if not, be sure to change the License tag in the spec)
Code:
Name:           yourname
Version:        0.1
Release:        1%{?dist}
Summary:        A custom card face for Gnome games

Group:          Amusements/Games
License:        GPLv2+
URL:            http://your-home-page.tld
Source0:        http://place-of-your-tarball
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires:       gnome-games

%description
This package installes a custom card face to use with the Gnome games.

%prep
%setup -q


%build


%install
rm -rf $RPM_BUILD_ROOT
install -m 0644 file1 %{_datadir}/gnome-games-common/cards/file1

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc COPYING README
%{_datadir}/gnome-games-common/cards/*

%changelog
* Fri Nov 27 2009 Stewart Adam <s.adam at diffingo.com> - 0.1-1
- Skeleton SPEC file created
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #4  
Old 5th December 2009, 08:45 PM
erroneus's Avatar
erroneus Offline
Registered User
 
Join Date: Apr 2004
Posts: 595
linuxfedorafirefox
Talking way over my head. All the stuff in the empty spec file is a lot of gobbledeegook to me.

The title could be "new card face." The description would be "a new card face I made for you." The file is "newcardface.svg" and the location to install it is "/usr/share/gnome-games-common/cards/" The only dependency that should be listed is "gnome-games."

Based on this, is it enough to write a working spec file?

---------- Post added at 08:45 PM CST ---------- Previous post was at 07:55 PM CST ----------

Okay, I pretty much copied your spec file and have an error to resolve.

Code:
Name:           CustomCards
Version:        0.1.0
Release:        1%{?dist}
Summary:        This is a custom built card set using Cartoon characters on the card faces.  Many long hours were spent in creating this set.

Group:          Amusements/Games
License:        Creative Commons
#URL:
Source0:        file://home/daniel/rpmbuild/SOURCES/CustomCards-0.1.0.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

#BuildRequires:
Requires:       gnome-games

%description
This package installes a custom card face to use with the Gnome games.

%prep
%setup -q


%build
%configure

%install
rm -rf $RPM_BUILD_ROOT
install -m 0644 CustomCards.svg %{_datadir}/gnome-games-common/cards/CustomCards.svg


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
#%doc COPYING README
%{_datadir}/gnome-games-common/cards/*

%changelog
* Fri Nov 27 2009 Stewart Adam <s.adam at diffingo.com> - 0.1-1
- Skeleton SPEC file created
What I get returned after issuing:

Code:
$ rpmbuild -bb SPECS/SouthparkCards.spec
is

Code:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.eIgQtq
+ umask 022
+ cd /home/daniel/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/daniel/rpmbuild/BUILD
+ rm -rf CustomCards-0.1.0
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/daniel/rpmbuild/SOURCES/CustomCards-0.1.0.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd CustomCards-0.1.0
/var/tmp/rpm-tmp.eIgQtq: line 34: cd: CustomCards-0.1.0: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.eIgQtq (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.eIgQtq (%prep)
Do you see anything that sticks out as obvious? If it helps to know, I only have the CustomCards.svg file in the tarball.
Reply With Quote
  #5  
Old 5th December 2009, 10:05 PM
Dies Offline
Registered User
 
Join Date: Oct 2006
Posts: 4,752
linuxubuntufirefox
Here's what I would do, drop the svg into ~/rpmbuild/SOURCES, and use something like

Code:
Name:           CustomCards
Version:        0.1.0
Release:        1%{?dist}
Summary:        This package installs custom card faces for use with the Gnome games.

Group:          Amusements/Games
License:        Creative Commons

Source0:        CustomCards.svg

Requires:       gnome-games

%description
This is a custom built card set using Cartoon characters on the card faces. Many long hours were spent in creating this set.

%prep
%build
%configure

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_datadir}/gnome-games-common/cards/
cp %{SOURCE0} $RPM_BUILD_ROOT%{_datadir}/gnome-games-common/cards/


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_datadir}/gnome-games-common/cards/*.svg

%changelog
* Fri Nov 27 2009 South Park fan - 0.1-1
- Initial Release
If you get an error post back, not on Fedora right now but pretty sure we can work it out anyways. Oh yeah and if you don't mind posting the South Park cards that would be pretty sweet too.
Reply With Quote
  #6  
Old 5th December 2009, 10:23 PM
PabloTwo's Avatar
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,126
linuxfedorafirefox
The %setup -q command in the %prep section, by default, expects that the source code .tar.gz file will extract to a directory named name-version, or in rpm speak, %{name}-%{version}.. The directory name should be "CustomCards-0.1.0" and it should contain your single file, "CustomCards.svg".

This is the standard format. So create a directory named "CustomCards-0.1.0" and put the CustomCards.svg file into it, then:
tar czvf CustomCards-0.1.0.tar.gz CustomCards-0.1.0/ and that is your 'correct' source code tarball package.

If a source code tarball package deviates from the 'standard', and some do, you can specify the actual directory structure of the 'untarred' source code package on the %setup line by using the -n option followed by the actual directory name.

Also, the error "no such file or directory' is your fist clue for troubleshooting. Your second step, the first being to read what the error message is saying, is to have a look at the rpm-tmp.xxxxxx file. That will often times show you exactly what the error is, such as a file path that is cockeyed, non-existent, contains a double "//", etc..

Each run of the attempted and failed rpmbuild creates a new /var/tmp/rpm-tmp.xxxx file. With a successful build, the associated rpm-tmp.xxxx file is automatically deleted, but all those from failled build attempts will remain, until you delete them yourself.

Edit: Yeah, Dies solution, posted while I was composing mine, will work also, and a bit simpler as well.

Last edited by PabloTwo; 5th December 2009 at 10:27 PM.
Reply With Quote
  #7  
Old 5th December 2009, 11:15 PM
erroneus's Avatar
erroneus Offline
Registered User
 
Join Date: Apr 2004
Posts: 595
linuxfedorafirefox
What command line should I be issuing? It now wants to compile it with a C compiler?? I think I should be getting a "noarch" RPM out of it. How do I make it do that?
Reply With Quote
  #8  
Old 5th December 2009, 11:23 PM
PabloTwo's Avatar
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,126
linuxfedorafirefox
If your using the Dies suggested method, you need to comment out or remove the %prep %configure and %build sections because your not compiling anything. If your using the method I suggested, then leave the %prep section in but remove the %configure and %build sections of the spec file.

rpmbuild will by default create an rpm package with '.i386" or ".i686" or ".x86_64" depending on the host machine your doing the build on. To specify something else, such as ".noarch", which is what this package should be using, do

rpmbuild -bb --target=noarch specfile

Edit: Actually, checking more carefully, having %prep and %build headings with nothing below them should not cause any problem. %prep and %build by themselves do absolutely nothing, but %configure does. Run "rpm --eval %configure" in a terminal to see how it sets the enviroment. So just make sure the %configure line is commented out or removed.

Last edited by PabloTwo; 5th December 2009 at 11:34 PM.
Reply With Quote
  #9  
Old 5th December 2009, 11:45 PM
erroneus's Avatar
erroneus Offline
Registered User
 
Join Date: Apr 2004
Posts: 595
linuxfedorafirefox
Okay, success! Here's what I have and what I did:

Spec file:
Code:
Name:           SouthparkCards
Version:        0.1.0
Release:        1%{?dist}
Summary:        This package installs custom card faces for use with the Gnome games.

Group:          Amusements/Games
BuildArch:	noarch
License:        Creative Commons

Source0:        CustomCards.svg

Requires:       gnome-games

%description
This is a custom built card set using Cartoon characters on the card faces. Many long hours were spent in creating this set.


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_datadir}/gnome-games-common/cards/
cp %{SOURCE0} $RPM_BUILD_ROOT%{_datadir}/gnome-games-common/cards/


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_datadir}/gnome-games-common/cards/*.svg

%changelog
* Fri Nov 27 2009 South Park fan - 0.1-1
- Initial Release
I issued the following command:

Code:
rpmbuild -bb --target=noarch SPECS/CustomCards.spec
And it resulted in the RPM file that I wanted.
Reply With Quote
  #10  
Old 6th December 2009, 12:17 AM
PabloTwo's Avatar
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,126
linuxfedorafirefox
Great, the learning curve just got a wee bit shallower.

Now, for the fun of it, run: rpmlint ~/rpmbuild/RPMS/noarch/CustomCards-0.1.0.fc12.noarch.rpm

..or whatever is the actual location of the rpm package now and it's name, and behold in wonder all the "W"'s (warnings) and possible "E"'s (errors). rpmlint if very persnickity.

---------- Post added at 07:17 PM CST ---------- Previous post was at 06:52 PM CST ----------

Just one small observation with the spec file that could be improved. No specific "permissions" were set for the .svg file that was installed, so it used whatever was default (same as if you had done, as root: "cp CustomCards.svg /usr/share//gnome-games-common/cards/".

You could have set the permissions on that file in one of two ways:

instead of using: cp %{SOURCE0} $RPM_BUILD_ROOT%{_datadir}/gnome-games-common/cards/

you could use: install -m 0644 %{SOURCE0} $RPM_BUILD_ROOT%{_datadir}/gnome-games-common/cards/

or, leaving the "cp" method intact, add this to the %files section:

%attr(0644,root,root) CustomCards.svg

Just trying to help flatten the "curve" a bit more

Last edited by PabloTwo; 5th December 2009 at 11:56 PM.
Reply With Quote
Reply

Tags
make, rpm, simple

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto make a simple Avi File play mkFedoraBetter Installation and Live Media 14 22nd September 2009 12:38 PM
How do I make a simple network program? zacharysturgeon Servers & Networking 2 24th April 2008 10:34 AM
how to make a simple xmms playlist tlviewer Using Fedora 0 13th January 2008 08:05 AM
simple make question gold Using Fedora 3 10th January 2008 01:16 AM
Please Just make it simple walter_b_marvin Installation and Live Media 21 5th October 2007 12:47 AM


Current GMT-time: 05:57 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat