Fedora Linux Support Community & Resources Center
  #1  
Old 15th October 2011, 06:18 PM
TheBigRed Offline
Registered User
 
Join Date: Mar 2008
Location: Germany
Posts: 225
linuxfirefox
how to handle z7 source file in rpm spec

Hi,

i want to use a 7z source file in rpm spec, how can do this ?

Code:
%define _pkgbuilddir %{_builddir}/%{name}_%{version}
%define real_ver b1-r3937
%define pkg_name speed-dreams-2

# how to create the bzip2 package
# http://sourceforge.net/projects/speed-dreams/files/2.0.0/speed-dreams-2.0.0-b1-r3937-src.tar.7z/download
# file-roller speed-dreams-2.0.0-b1-r3937-src.tar.7z
# bzip2 file-roller speed-dreams-2.0.0-b1-r3937-src.tar


Summary: The Open Racing Car Simulator
Name: speed-dreams
Version: 2.0.0
Release: b1_r3937.1%{?dist}
License: GPLv2+
Group: Amusements/Games
URL: http://www.speed-dreams.org/
Source0: http://sourceforge.net/projects/speed-dreams/files/%{version}/speed-dreams-%{version}-b1-r3937-src.tar.7z
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: p7zip
BuildRequires: libGL-devel, freeglut-devel, plib-devel >= 1.8.3
BuildRequires: libpng-devel, libjpeg-devel, zlib-devel
BuildRequires: desktop-file-utils
BuildRequires: libXext-devel, libXt-devel, libXi-devel, libXmu-devel
BuildRequires: libXxf86vm-devel, libXrandr-devel, libXrender-devel
BuildRequires: openal-soft-devel freealut-devel >= 1.1.0-10
BuildRequires: enet-devel >= 1.2
Requires:      opengl-games-utils
Requires:      speed-dreams-devel >= 2.0.0-b1-r3937
Requires:      %{name}-robots-base = %{version}-%{release}

%description
Speed-Dreams is a 3D racing cars simulator using OpenGL. A Fork of TORCS. The goal is to have
programmed robots drivers racing against each others.  You can also drive
yourself with either a wheel, keyboard or mouse.

%package robots-base
Summary: The Open Racing Car Simulator additional dirt tracks
Group: Amusements/Games
Requires: speed-dreams

%description robots-base
Speed Dreams is a 3D racing cars simulator using OpenGL. A Fork of TORCS. The goal is to have
programmed robots drivers racing against each others.  You can also drive
yourself with either a wheel, keyboard or mouse.

This package contains additional tracks for the game.

%package devel
Speed Dreams is a 3D racing cars simulator using OpenGL.  The goal is to have
programmed robots drivers racing against each others.  You can also drive
yourself with either a wheel, keyboard or mouse.

This package contains the development files for the game.


%prep
# extract source file
7za x %{SOURCE0}
%setup -qcT -a 0 -n %{name}-%{version}-%{real_ver}-src

%build
%cmake . -DCMAKE_INSTALL_PREFIX:PATH="%{_prefix}" \
         -DCMAKE_BUILD_TYPE:STRING=Release \
         -DOPTION_OFFICIAL_ONLY:BOOL=ON
make %{?_smp_mflags}

%install
#%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}


# Icon for the desktop file
%{__install} -D -p -m 0644 data/data/icons/icon.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

%{__install} -dm 755  %{buildroot}%{_datadir}/pixmaps
%{__install} -D -p -m 755 data/data/img/*.png %{buildroot}%{_datadir}/pixmaps

%{__install} -dm 755  %{buildroot}%{_datadir}/games/%{name}
%{__install} -D -p -m 755 data/data/icons/icon.* %{buildroot}%{_datadir}/games/%{name}

#%{__install} -dm 755  %{buildroot}%{_libdir}/games/%{name}/lib
#%{__install} -D -p -m 755 src/modules/simu/simuv2.1/SOLID-2.0/src/libsolid.so %{buildroot}%{_libdir}/games/%{pkg_name}/lib/


%{__cat} > %{name}.desktop << EOF
[Desktop Entry]
Name=speed-dreams
Comment=The Open Racing Car Simulator
Exec=/usr/games/speed-dreams-2
Icon=/usr/share/games/speed-dreams/icon.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Game;Simulation;
EOF

%{__mkdir_p} %{buildroot}%{_datadir}/applications
desktop-file-install \
    --vendor "" \
    --dir %{buildroot}%{_datadir}/applications \
    %{name}.desktop

# We need this for proper automatic stripping to take place (still in 1.3.0)
find %{buildroot}%{_libdir}/games/ -name '*.so' | xargs %{__chmod} +x

# remove cmake files
find $RPM_BUILD_ROOT -type f -name "*.cmake" -exec rm -f {} ';'


#%clean
#%{__rm} -rf %{buildroot}


%files
# Directory default mode of 0755 is MANDATORY, since installed dirs are 0777
%defattr(-,root,root,0755)
%doc COPYING.txt README.txt
%{_datadir}/games/%{pkg_name}/*.txt
#%{_libdir}/games/%{pkg_name}/lib/libsolid.so

/usr/games/*
%{_libdir}/games/%{pkg_name}/drivers/kilo2008/*
%{_libdir}/games/%{pkg_name}/drivers/human/*
%{_libdir}/games/%{pkg_name}/drivers/simplix*
%{_libdir}/games/%{pkg_name}/drivers/usr*
%{_libdir}/games/%{pkg_name}/lib/*
%{_libdir}/games/%{pkg_name}/modules/graphic/*.so
%{_libdir}/games/%{pkg_name}/modules/simu/*.so
%{_libdir}/games/%{pkg_name}/modules/telemetry/*.so
%{_libdir}/games/%{pkg_name}/modules/track/*.so
%{_libdir}/games/%{pkg_name}/modules/userinterface/*.so

%{_datadir}/pixmaps/*.png
%{_datadir}/games/%{name}/icon.*


%files robots-base
%defattr(-,root,root,-)
# data packages, installs tracks, car models, fonts ...
%{_datadir}/applications/%{name}.desktop
%dir %{_datadir}/games/%{name}/
%{_datadir}/games/%{pkg_name}/categories/*
%{_datadir}/games/%{pkg_name}/cars/*
%{_datadir}/games/%{pkg_name}/config/*
%{_datadir}/games/%{pkg_name}/data/*
#%{_datadir}/games/%{pkg_name}/drivers/*
%{_datadir}/games/%{pkg_name}/tracks/*
%{_datadir}/games/%{pkg_name}/credits.xml
%{_datadir}/games/%{pkg_name}/version.xml
%{_datadir}/games/%{pkg_name}/drivers/human/*
%{_datadir}/games/%{pkg_name}/drivers/kilo2008/*
%{_datadir}/games/%{pkg_name}/drivers/simplix/*
%{_datadir}/games/%{pkg_name}/drivers/simplix_36GP/*
%{_datadir}/games/%{pkg_name}/drivers/simplix_ls1/*
%{_datadir}/games/%{pkg_name}/drivers/simplix_ls2/*
%{_datadir}/games/%{pkg_name}/drivers/simplix_mp5/*
%{_datadir}/games/%{pkg_name}/drivers/simplix_sc/*
%{_datadir}/games/%{pkg_name}/drivers/simplix_trb1/*
%{_datadir}/games/%{pkg_name}/drivers/usr_36GP/*
%{_datadir}/games/%{pkg_name}/drivers/usr_ls1/*
%{_datadir}/games/%{pkg_name}/drivers/usr_ls2/*
%{_datadir}/games/%{pkg_name}/drivers/usr_sc/*
%{_datadir}/games/%{pkg_name}/drivers/usr_trb1/*


%files devel
%defattr(-,root,root,-)
%{_includedir}/%{pkg_name}/*
the following error message appears:

Code:
[root@fc15 tmp]# rpmbuild -ba speed-dreams-2.0.0-b1-r3937-2.fc15.spec
Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.3Rua6K
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ 7za x /usr/src/redhat/SOURCES/speed-dreams-2.0.0-b1-r3937-src.tar.7z

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=C,Utf16=off,HugeFiles=on,2 CPUs)

Processing archive: /usr/src/redhat/SOURCES/speed-dreams-2.0.0-b1-r3937-src.tar.7z

Extracting  speed-dreams-2.0.0-b1-r3937-src.tar

Everything is Ok

Size:       1206671360
Compressed: 823892373
+ cd /usr/src/redhat/BUILD
+ rm -rf speed-dreams-2.0.0-b1-r3937-src
+ /bin/mkdir -p speed-dreams-2.0.0-b1-r3937-src
+ cd speed-dreams-2.0.0-b1-r3937-src
+ /bin/tar -xf /usr/src/redhat/SOURCES/speed-dreams-2.0.0-b1-r3937-src.tar.7z
/bin/tar: This does not look like a tar archive
/bin/tar: Skipping to next header
/bin/tar: Exiting with failure status due to previous errors
Fehler: Fehler-Status beim Beenden von /var/tmp/rpm-tmp.3Rua6K (%prep)


Fehler beim Bauen des RPM:
    Fehler-Status beim Beenden von /var/tmp/rpm-tmp.3Rua6K (%prep)
can someone help ?

Last edited by TheBigRed; 16th October 2011 at 02:14 PM.
Reply With Quote
  #2  
Old 16th October 2011, 12:30 AM
JohnVV's Avatar
JohnVV Offline
Registered User
 
Join Date: Aug 2005
Location: Ann Arbor
Age: 45
Posts: 3,907
linuxfirefox
Re: how to handle z7 source file in rpm spec

i would not ( ?? "z7" ???? )
z7 and NOT .7z ?

seven zip is NOT installed by default
use the standard gnu zip
__________________
Running Arch ,OpenSUSE 11.4-64bit & Scientific Linux 6.1-64bit ( fedora 4 to 11)
My Celestia Downloads

http://celestiamotherlode.net/catalo...?creator_id=10
Reply With Quote
  #3  
Old 16th October 2011, 12:56 AM
PabloTwo's Avatar
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,119
linuxfirefox
Re: how to handle z7 source file in rpm spec

My guess is that because you did not first "cd" into the directory where %{SOURCE0} is before using the "7za x" command, you extracted the .tar.7z into your current directory, leaving %setup to find the speed-dreams-2.0.0-b1-r3937-src.tar.7z file, which is doesn't recognize as a file type is knows about.

Try doing:
Code:
cd /usr/src/redhat/SOURCES/
7za x speed-dreams-2.0.0-b1-r3937-src.tar.7z
cd -
Then, hopefully, %setup will find a .tar file, which is does know how to handle.
Reply With Quote
  #4  
Old 16th October 2011, 03:52 PM
TheBigRed Offline
Registered User
 
Join Date: Mar 2008
Location: Germany
Posts: 225
linuxfirefox
Re: how to handle z7 source file in rpm spec

sorry no luck:
Code:
%prep
# extract source file
#7za x %{SOURCE0}
#7za x -so %{SOURCE0} | tar xf -
#cd /usr/src/redhat/BUILD/%{name}-%{version}-%{real_ver}-src
cd /usr/src/redhat/SOURCES/
7za x speed-dreams-2.0.0-b1-r3937-src.tar.7z
cd -
%setup -qcn %{name}-%{version}-%{real_ver}-src

%build
%cmake  -DCMAKE_INSTALL_PREFIX:PATH="%{_prefix}" \
         -DCMAKE_BUILD_TYPE:STRING=Release \
         -DOPTION_OFFICIAL_ONLY:BOOL=ON
make %{?_smp_mflags}
setup did always recognize a 7z file

Code:
[root@fc15 tmp]# rpmbuild -ba speed-dreams.spec 
Ausführung(%prep): /bin/sh -e /var/tmp/rpm-tmp.ZjKnhh
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/SOURCES/
+ 7za x speed-dreams-2.0.0-b1-r3937-src.tar.7z

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=C,Utf16=off,HugeFiles=on,2 CPUs)

Processing archive: speed-dreams-2.0.0-b1-r3937-src.tar.7z

file speed-dreams-2.0.0-b1-r3937-src.tar
already exists. Overwrite with 
speed-dreams-2.0.0-b1-r3937-src.tar?
Extracting  speed-dreams-2.0.0-b1-r3937-src.tar

Everything is Ok

Size:       1206671360
Compressed: 823892373
+ cd -
/usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf speed-dreams-2.0.0-b1-r3937-src
+ /bin/mkdir -p speed-dreams-2.0.0-b1-r3937-src
+ cd speed-dreams-2.0.0-b1-r3937-src
+ /bin/tar -xf /usr/src/redhat/SOURCES/speed-dreams-2.0.0-b1-r3937-src.tar.7z
/bin/tar: This does not look like a tar archive
/bin/tar: Skipping to next header
/bin/tar: Exiting with failure status due to previous errors

Last edited by TheBigRed; 16th October 2011 at 04:18 PM.
Reply With Quote
  #5  
Old 16th October 2011, 04:30 PM
PabloTwo's Avatar
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,119
linuxfirefox
Re: how to handle z7 source file in rpm spec

What happens if you comment out the line:
Source0: http://sourceforge.net/projects/speed-dreams/files/%{version}/speed-dreams-%{version}-b1-r3937-src.tar.7z

And add line: Source0: speed-dreams-%{version}-b1-r3937-src.tar

You really should be using an rpm build tree in your regular user account directory, and building it as a regular user, not as root. If you haven't done so already,

yum install rpmdevtools

Then in your regular user directory, do: rpmdev-setuptree
That will give you a directory ~/rpmbuild, with appropriate sub-directories (BUILD RPMS SOURCES SPECS SRPMS).
Reply With Quote
  #6  
Old 16th October 2011, 04:53 PM
TheBigRed Offline
Registered User
 
Join Date: Mar 2008
Location: Germany
Posts: 225
linuxfirefox
Re: how to handle z7 source file in rpm spec

this is the result:
[martin@fc15 ~]$ rpmbuild -ba speed-dreams.spec
error: File /home/martin/rpmbuild/SOURCES/speed-dreams-2.0.0-b1-r3937-src.tar: No such file or directory
Reply With Quote
  #7  
Old 16th October 2011, 04:59 PM
PabloTwo's Avatar
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,119
linuxfirefox
Re: how to handle z7 source file in rpm spec

OK, I sort of expected that. If the source code file wasn't so large, I'd download it and try myself to get the .7z aspect of it sorted out in the spec file, but that's a bigger file than I want to have to deal with.
Reply With Quote
  #8  
Old 16th October 2011, 05:03 PM
Finalzone's Avatar
Finalzone Offline
Community Manager
 
Join Date: Mar 2004
Location: Vancouver, Canada
Posts: 2,366
linuxfirefox
Re: how to handle z7 source file in rpm spec

Verify if p7zip is installed into your system.
Code:
rpm -qa p7zip
or
Code:
yum search 7z
__________________
Desktop CPU: AMD Phenom II(tm) X4 Processor 940 AM2+ - Memory: 8GB DDR2-RAM - GPU: Nvidia Geforce GTX 460 v2 - OS: Fedora 18 Spherical Cow x86-64 and Windows 7 Ultimate SP1 64-bit
Laptop Toshiba Satellite C650D - OS: Fedora 19 Schrödinger's Cat (preview release) x86-64 and Microsoft Windows 7 64-bit
Reply With Quote
  #9  
Old 16th October 2011, 05:23 PM
TheBigRed Offline
Registered User
 
Join Date: Mar 2008
Location: Germany
Posts: 225
linuxfirefox
Re: how to handle z7 source file in rpm spec

p7zip is installed
# rpm -qa p7zip
p7zip-9.20.1-2.fc15.x86_64

Quote:
Originally Posted by Finalzone View Post
Verify if p7zip is installed into your system.
Code:
rpm -qa p7zip
or
Code:
yum search 7z
Reply With Quote
  #10  
Old 16th October 2011, 05:32 PM
PabloTwo's Avatar
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,119
linuxfirefox
Re: how to handle z7 source file in rpm spec

I just installed p7zip and found a *.tar.7z file on the net I downloaded to play with.
I used the "7za x name.tar.7z" command on the file, then checked the contents of the directory.
I found both name.tar.7z and name.tar

I would suggest then, trying,

cd /home/martin/rpmbuild/SOURCES
7za x speed-dreams-2.0.0-b1-r3937-src.tar.7z
rm speed-dreams-2.0.0-b1-r3937-src.tar.7z
cd -

These commands should appear in the %prep section of the spec file. After running, only the file 7za x speed-dreams-2.0.0-b1-r3937-src.tar should appear in /home/martin/rpmbuild/SOURCES/
Reply With Quote
  #11  
Old 16th October 2011, 07:18 PM
TheBigRed Offline
Registered User
 
Join Date: Mar 2008
Location: Germany
Posts: 225
linuxfirefox
Re: how to handle z7 source file in rpm spec

Quote:
Originally Posted by PabloTwo View Post
I just installed p7zip and found a *.tar.7z file on the net I downloaded to play with.
I used the "7za x name.tar.7z" command on the file, then checked the contents of the directory.
I found both name.tar.7z and name.tar

I would suggest then, trying,

cd /home/martin/rpmbuild/SOURCES
7za x speed-dreams-2.0.0-b1-r3937-src.tar.7z
rm speed-dreams-2.0.0-b1-r3937-src.tar.7z
cd -

These commands should appear in the %prep section of the spec file. After running, only the file 7za x speed-dreams-2.0.0-b1-r3937-src.tar should appear in /home/martin/rpmbuild/SOURCES/
many thanks, that works, but i think its not rpm conform.
I think SOURCE must always contains the SOURCE Package.

Code:
...
Source0: speed-dreams-%{version}-b1-r3937-src.tar
...
%prep
# extract source file
cd /home/martin/rpmbuild/SOURCES
7za x speed-dreams-2.0.0-b1-r3937-src.tar.7z
#rm 7za x speed-dreams-2.0.0-b1-r3937-src.tar.7z
cd -
%setup -q -n %{name}-%{version}-%{real_ver}-src

%build
...


---------- Post added at 08:18 PM ---------- Previous post was at 07:07 PM ----------

The solution is:

Code:
Source0:       http://downloads.sourceforge.net/%{name}/%{name}-%{version}-b1-r3937-src.tar.7z
....
%prep
rm -rf %{name}-%{version}-b1-r3937-src.tar.7z
7za x %{SOURCE0}
tar -xvf %{name}-%{version}-b1-r3937-src.tar

%build
cd %{name}-%{version}-b1-r3937-src
%cmake  -DCMAKE_INSTALL_PREFIX:PATH="%{_prefix}" \
        -DCMAKE_BUILD_TYPE:STRING=Release \
        -DOPTION_OFFICIAL_ONLY:BOOL=ON
make %{?_smp_mflags}
...
Reply With Quote
Reply

Tags
file, handle, rpm, source, spec

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
how to handle rar file simon2000 Using Fedora 8 26th February 2011 02:15 PM


Current GMT-time: 08:58 (Monday, 20-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