LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 07-19-2006, 04:56 PM   #1
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Rep: Reputation: 15
.spec file: creating an RPM: Files don't appear in designated paths


Code:
Name: foo
Summary:  A bar of foo
Version: 1.0
Release: 334
License: GPL
Group: Amusements/Games
URL: http://foobar.net
Source0: %{name}-%{version}.tar.gz
Source1:start-foo
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires: python >= 2.4

%description
A bar made up of 100% foo.
%prep
%setup -q -c

%install
rm -fr %{buildroot}
mkdir -p %{buildroot}/usr/share/games
mkdir -p %{buildroot}/usr/games/bin

%clean
rm -fr %{buildroot}

%files
%defattr(-,root,root)

%changelog
I'm trying to create a binary rpm. The data files are supposed to go in /usr/share/games and an execuatable shell script in /usr/games/bin. For some reason I can't find any files in /usr/share/games and I can't find start-foo in /usr/games/bin.
Is there anything missing in my code?

[EDIT]I can't find a solution on Google (probably because I don't know what my problem is )

Last edited by CPUFreak91; 07-19-2006 at 05:01 PM.
 
Old 07-19-2006, 06:01 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,532
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
I think it would be easier for you if you post an actual spec file you work with (can test). If you run rpmbuild it no doubt will spit out informative messages. This rpm will contain no files (not even empty dirs since they're not mentioned in the files section).
 
Old 07-20-2006, 01:07 PM   #3
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
[QUOTE=unSpawn]I think it would be easier for you if you post an actual spec file you work with (can test).

OK. The actual spec file follows:
Code:
Name: bibledave
Summary:  A sidescroller game
Version: 0.6.6
Release: 2
License: GPL
Group: Amusements/Games
URL: http://bibledave.sourceforge.net
Source0: %{name}-%{version}.tar.gz
Source1:%{name}
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires: python >= 2.4

%description
A sidescroller game written in python involving a crashed pilot, scattered Bibles and a deadline.
This is a community project of ChristianCoders.com -- a site that connects people interested in
Christian video games
%prep
%setup -q -c

%install
rm -fr %{buildroot}
mkdir -p %{buildroot}/usr/share/games
mkdir -p %{buildroot}/usr/games/bin
%clean
rm -fr %{buildroot}

%files
%defattr(-,root,root)

%changelog

Quote:
Originally Posted by unSpawn
If you run rpmbuild it no doubt will spit out informative messages. This rpm will contain no files (not even empty dirs since they're not mentioned in the files section).
I have run rpmbuild but I have not gotten any usefull files.
I also have noticed some people mentioning some rpmrc file. Should I create one?

So, how would I mention the files in the files section?
Thanks for your help so far
 
Old 07-20-2006, 03:31 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,532
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
I have run rpmbuild but I have not gotten any usefull files.
Because the spec file doesn't do nothing yet ;-p


I also have noticed some people mentioning some rpmrc file. Should I create one?
You don't have to create (=copy from default) a ~/.rpmrc. You may want to build RPM's as unprivileged user to keep from poisoning your buildsystem. Set up your own ~/.rpmmacros. It deals with setting your local RPM root (%_topdir ~/somedir) under which you'll have the source, build, temp dirs, etc, etc. For details see the excellent IBM developerWorks: Building without root, patching software, and distributing RPMs. Other docs to read would be the RPM HOWTO and any distribution-specific RPM docs.


So, how would I mention the files in the files section?
Basically what you do first is unpack the tarball (in this case a zipfile so watch your source directive), read the README or INSTALL files, run configure with appropriate args, run make and "make -n install" to see where it all goes to.
0. Download and unpack bibledave and in the bibledave_v0.6.6 dir there's no default configure(.in) (and or Makefile) but a file called "run.sh" which executes the game (python main.py) and when done deletes any compiled files (rm *.pyc -f).
1. Also all files and dirs are used in the current structure so you can't have it installed in /usr/share/games or /usr/games/bin but in /usr/share/games/bibledave or /usr/games/bin/bibledave
2. with a symlink from say /usr/local/bin/bibledave to /usr/share/games/bibledave/run.sh.
3. Decide on which dir and make the run.sh a proper Bash script:
Code:
#!/bin/sh
cd /usr/share/games/bibledave
python main.py
rm *.pyc -f
exit 0
4. Before installing we need to remove the CVS entries, batch files, etc. cd into where you unpacked bibledave and:
Code:
find . -type d -name CVS|xargs -iD rm -rf 'D'
, then
Code:
find . -type f -iname \*.bat -o -iname \*.ico -o -iname \*.nsi|xargs -iF rm -f 'F'
.
5. Make a files listing:
Code:
find . | xargs -iX stat -c "attr(%a,root,root) %n" X|sed -e "s/^a/%\0/g" -e "s/) \./) \/usr\/share\/games\/bibledave/g" > spec_files
and add the contents of spec_files to your spec file.
6. There's some more stuff but I guess it's time to finish off with a spec file, as always, YMMV(VM). Since LQ has a post limit I'll try and post in below. Edit: the spec file is too large. It will be available at this URI for aprox seven days from now.

Please note: the build process and spec file described with all the kludges and workarounds are definately NONSTANDARD. Do not use this unless you are forced to. Also it's better to use well-packaged source tarballs ( bug your maintainers about packaging standards).

Last edited by unSpawn; 07-20-2006 at 03:36 PM. Reason: //spec file URI
 
Old 07-20-2006, 05:48 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,691

Rep: Reputation: 286Reputation: 286Reputation: 286
For the most in-depth word on rpm, especially .spec files, see the book Maximum-RPM at the Red Hat website (somewhere under Documentation). You can read it on-line or download it.
 
Old 07-20-2006, 10:31 PM   #6
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
Thanks for the links and getting me this far, but I have a few questions:

Code:
....
 inflating: bibledave_v0.6.6/dave/gettext.bat
  inflating: bibledave_v0.6.6/dave/LGPL-License
  inflating: bibledave_v0.6.6/dave/basegamelevel.py
  inflating: bibledave_v0.6.6/dave/setup.py
  inflating: bibledave_v0.6.6/dave/levelfile.py
  inflating: bibledave_v0.6.6/dave/ChangeLog.txt
+ mv bibledave_v0.6.6 bibledave-0.6.6
+ rm -rf ./bibledave-0.6.6
+ cd /home/therat/rpm/BUILD
+ rm -rf bibledave-0.6.6
+ /usr/bin/unzip -qq /home/therat/rpm/SOURCES/bibledave_v0.6.6.zip
replace dave/CVS/Root? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd bibledave-0.6.6
/var/tmp/rpm-tmp.10768: line 36: cd: bibledave-0.6.6: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.10768 (%prep)
I can't figure out why there is "No such file or directory".
 
Old 07-21-2006, 11:20 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,532
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
+ /usr/bin/unzip -qq /home/therat/rpm/SOURCES/bibledave_v0.6.6.zip
(..)
/var/tmp/rpm-tmp.10768: line 36: cd: bibledave-0.6.6: No such file or directory

"unzip -l /home/therat/rpm/SOURCES/bibledave_v0.6.6.zip" and you'll notice the directoryname is different. That's why I said:
Code:
%prep
# DO THIS MANUALLY:
#cd ${RPM_SOURCE_DIR}
#unzip -d bibledave-0.6.6 bibledave_v0.6.6.zip
#mv bibledave_v0.6.6 bibledave-0.6.6
#tar -czf bibledave-0.6.6.tar.gz bibledave-0.6.6 --remove-files
#rm -rf ./bibledave-0.6.6
 
Old 07-21-2006, 11:45 AM   #8
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
Oops. Sorry about that.
Well I fixed a few new errors on my own, but I was wondering why I'm getting a few strange errors:
Code:
... (huge list of duplicate names)
warning: File listed twice: /usr/share/games/bibledave/sounds/yeow.ogg
warning: File listed twice: /usr/share/games/bibledave/sounds/yeow.ogg
warning: File listed twice: /usr/share/games/bibledave/sounds/yeow.wav
warning: File listed twice: /usr/share/games/bibledave/sounds/yeow.wav
Provides: bibledave
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/sh /usr/bin/python python >= 2.4
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/therat/rpm/BUILD/bibledave
error: Installed (but unpackaged) file(s) found:
   /usr/share/games/bibledave/images/villager_3.png
   /usr/share/games/bibledave/pgu/gui/default/button.down.tga
   /usr/share/games/bibledave/pgu/gui/default/button.hover.tga
   /usr/share/games/bibledave/pgu/gui/default/button.normal.tga
I checked the source tar.gz file... these files exist but now I'm stumped. The I can also find all these files listed in the .spec file!

I'll continue to play around with this though. Thanks.

Last edited by CPUFreak91; 07-21-2006 at 11:46 AM.
 
Old 07-21-2006, 12:39 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,532
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
Well I fixed a few new errors on my own
I'm sure they are *your* errors because the rpm packaged w/o probs here.


... (huge list of duplicate names)
...well, yeah, OK, except for the duplicate names. But that won't keep rpm from building the package.


error: Installed (but unpackaged) file(s) found:
Sorry, you must have changed something because the rpm packaged w/o that specific prob here. IOW: find the differences.

BTW, are you going to be the rpm maintainer for that app?
 
Old 07-21-2006, 01:04 PM   #10
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
Wink

Quote:
Originally Posted by unSpawn
Well I fixed a few new errors on my own
I'm sure they are *your* errors because the rpm packaged w/o probs here.
Sorry typo. Yes they are my errors.


Quote:
BTW, are you going to be the rpm maintainer for that app?
Considering how we have not been able to get any packager for linux packages, I guess that does make me the the RPM maintainer.

Last edited by CPUFreak91; 07-21-2006 at 02:38 PM.
 
Old 07-21-2006, 02:34 PM   #11
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
Strange. I've started from the beginning, following your instructions to the letter and I come with errors (yes again ) This one feels familiar but I can't seem to solve it:
Code:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.96539
+ umask 022
+ cd /home/therat/rpm/BUILD
+ cd /home/therat/rpm/BUILD
+ rm -rf bibledave-0.6.6
+ /bin/gzip -dc /home/therat/rpm/SOURCES/bibledave-0.6.6.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd bibledave-0.6.6
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.37510
+ umask 022
+ cd /home/therat/rpm/BUILD
+ cd bibledave-0.6.6
+ find . -type d -name CVS
+ xargs -iD rm -rf D
+ find . -type f -iname '*.bat' -o -iname '*.ico' -o -iname '*.nsi'
+ xargs -iF rm -f F
+ find . -type d
+ xargs -iX stat -c 'mkdir -p ${RPM_BUILD_ROOT}%n' X
+ sed -e 's/}\./}\/usr\/share\/games\/bibledave/g'
+ echo 'mkdir -p ${RPM_BUILD_ROOT}/usr/local/bin'
+ find . -type f
+ egrep -ve '(installer.sh|SF.Comic.Script)'
+ xargs -iX stat -c 'install %n ${RPM_BUILD_ROOT}%n' X
+ sed -e 's/}\./}\/usr\/share\/games\/bibledave/g'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.79485
+ umask 022
+ cd /home/therat/rpm/BUILD
+ cd bibledave-0.6.6
+ cat
+ sh ./installer.sh
+ rm -f ./installer.sh
+ install -m 0755 bibledave.x /home/therat/rpm/BUILD/bibledave/usr/local/bin/bibledave
+ install 'SF Comic Script.ttf' /home/therat/rpm/BUILD/bibledave/usr/share/games/bibledave
install: cannot stat `SF Comic Script.ttf': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.79485 (%install)
I'll go over what I did. I copied your spec file to ~/bibledave.spec, Downloaded bibledave_v0.6.6.zip from SF.net, and unzipped it. Renamed the folder to bibledave-0.6.6. Tar'd and gziped the folder. Placed bibledave-0.6.6.tar.gz in ~/rpm/SOURCES. Then I ran rpmbuild -bb ~/bibledave.spec and got this error. Was there something I missed?

Last edited by CPUFreak91; 07-21-2006 at 02:36 PM.
 
Old 07-22-2006, 05:18 AM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,532
Blog Entries: 51

Rep: Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601Reputation: 2601
Let's just replace the install line with:
Code:
find ${RPM_BUILD_ROOT} -iname SF\*.ttf"|while read t; do
install "${t}" ${RPM_BUILD_ROOT}/usr/share/games/bibledave
done
* BTW, since you're the maintainer I think you would benefit from making a script that rearranges tarball contents (or downloads CVS), makes the spec file and builds the rpm once you get the hang of building an rpm. If you're interested in doing that we could build a script in this thread once all probs are fixed.
 
Old 07-28-2006, 09:57 AM   #13
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
When I swapped
Code:
install "SF Comic Script.ttf" ${RPM_BUILD_ROOT}/usr/share/games/bibledave
for
Code:
find ${RPM_BUILD_ROOT} -iname SF\*.ttf"|while read t; do
install "${t}" ${RPM_BUILD_ROOT}/usr/share/games/bibledave
done
I got this error:
Code:
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.67919
+ umask 022
+ cd /home/therat/rpm/BUILD
+ cd bibledave-0.6.6
+ cat
+ sh ./installer.sh
+ rm -f ./installer.sh
+ install -m 0755 bibledave.x /home/therat/rpm/BUILD/bibledave/usr/local/bin/bibledave
/var/tmp/rpm-tmp.67919: line 37: unexpected EOF while looking for matching `"'
error: Bad exit status from /var/tmp/rpm-tmp.67919 (%install)
Any idea what might have cause this?

Quote:
Originally Posted by unSpawn
* BTW, since you're the maintainer I think you would benefit from making a script that rearranges tarball contents (or downloads CVS), makes the spec file and builds the rpm once you get the hang of building an rpm. If you're interested in doing that we could build a script in this thread once all probs are fixed.
Yes, thanks, I'm interested
 
Old 07-28-2006, 10:01 AM   #14
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
Oh, nvm, I removed the quote after -iname SF\*.ttf" that was causing the problem.

But now I'm at another obstacle. rpmbuild stops and displays this message:
Code:
Installed (but unpackaged) file(s) found:
   /usr/share/games/bibledave/images/villager_3.png
   /usr/share/games/bibledave/pgu/gui/default/button.down.tga
   /usr/share/games/bibledave/pgu/gui/default/button.hover.tga
   /usr/share/games/bibledave/pgu/gui/default/button.normal.tga
 
Old 07-28-2006, 10:03 AM   #15
CPUFreak91
Member
 
Registered: Jul 2005
Location: Mars
Distribution: Gentoo Linux
Posts: 100

Original Poster
Rep: Reputation: 15
Oh, nvm, I removed the quote after -iname SF\*.ttf" that was causing the problem.

But now I'm at another obstacle. rpmbuild stops and displays this message:
Code:
Installed (but unpackaged) file(s) found:
   /usr/share/games/bibledave/images/villager_3.png
   /usr/share/games/bibledave/pgu/gui/default/button.down.tga
   /usr/share/games/bibledave/pgu/gui/default/button.hover.tga
   /usr/share/games/bibledave/pgu/gui/default/button.normal.tga
 
  


Reply

Tags
rpm, spec


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RPM Spec file creation, %files section question davidas Linux - Software 1 09-13-2007 02:26 AM
writing spec file for RPM to move files Help Me Linux - Newbie 2 05-08-2006 12:58 PM
creating the file list for the .spec files ingerul Linux - Software 0 11-01-2004 03:06 AM
%file attribute for RPM SPEC files Brian of Gep Linux - Software 3 06-18-2004 04:51 AM
%file attribute for RPM SPEC files Brian of Gep Fedora 0 06-15-2004 07:12 PM


All times are GMT -5. The time now is 11:17 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration