LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   .spec file: creating an RPM: Files don't appear in designated paths (http://www.linuxquestions.org/questions/linux-software-2/spec-file-creating-an-rpm-files-dont-appear-in-designated-paths-465666/)

CPUFreak91 07-19-2006 05:56 PM

.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 :))

unSpawn 07-19-2006 07:01 PM

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).

CPUFreak91 07-20-2006 02:07 PM

[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?:confused:
Thanks for your help so far :)

unSpawn 07-20-2006 04:31 PM

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).

bigrigdriver 07-20-2006 06:48 PM

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.

CPUFreak91 07-20-2006 11:31 PM

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".

unSpawn 07-21-2006 12:20 PM

+ /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


CPUFreak91 07-21-2006 12:45 PM

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.

unSpawn 07-21-2006 01:39 PM

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?

CPUFreak91 07-21-2006 02:04 PM

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.

CPUFreak91 07-21-2006 03:34 PM

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?

unSpawn 07-22-2006 06:18 AM

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.

CPUFreak91 07-28-2006 10:57 AM

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 :)

CPUFreak91 07-28-2006 11:01 AM

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


CPUFreak91 07-28-2006 11:03 AM

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



All times are GMT -5. The time now is 06:40 PM.