Fedora Linux Support Community & Resources Center
  #1  
Old 3rd August 2012, 10:11 PM
patrick Offline
Registered User
 
Join Date: Mar 2012
Location: Carrboro, NC, USA
Posts: 17
linuxchrome
Question Help creating spec file for gMTP

I may be recreating the wheel here, but I am having trouble with my %files section (I think).

Spec file: http://sprunge.us/ePTG

Processing files: gmtp-1.3.3-1.fc17.x86_64
error: File not found by glob: /home/patrick/rpmbuild/BUILDROOT/gmtp-1.3.3-1.fc17.x86_64/usr/bin/*

I really have no idea what I am doing and I am shocked I have proceeded this far. The program seems to compile and the binaries are in BUILDROOT, but then I get the above error.

Thank you for any help, I am happy to provide more info if needed.
Reply With Quote
  #2  
Old 3rd August 2012, 10:57 PM
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,190
linuxchrome
Re: Help creating spec file for gMTP

This package installs to /usr/local. There is no configure file to run to change that to /usr during the config step since there is no config step. %{_bindir} translates to /usr/bin. If you want to install to the standard Fedora rpm location of /usr, then you'll need to add a line to your spec file that modifies the Makefile by changing the line "PREFIX ?= /usr/local" to "PREFIX ?= /usr" using sed in the %setup section.

Also, your %files section is incomplete. I ran a "make" then "make install DESTDIR=~/work/mGTP" to see what files would install and to where. Here's the result, shown using the tree command on that destination directory:
Code:
usr
└── local
    ├── bin
    │** └── gmtp
    └── share
        ├── applications
        │** └── gMTP.desktop
        ├── gconf
        │** └── schemas
        │**     └── gmtp.schemas
        ├── gmtp
        │** ├── audio-x-mp3-playlist.png
        │** ├── audio-x-mpeg.png
        │** ├── empty.png
        │** ├── folder.png
        │** ├── icon-16.png
        │** ├── icon.png
        │** ├── image-x-generic.png
        │** ├── logo.png
        │** ├── media-cdrom-audio.png
        │** ├── stock-about-16.png
        │** ├── text-plain.png
        │** ├── video-x-generic.png
        │** └── view-refresh.png
        ├── locale
        │** ├── da
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** ├── de
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** ├── es
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** ├── fr
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** └── it
        │**     └── LC_MESSAGES
        │**         └── gmtp.mo
        └── pixmaps
            └── gMTPicon.png
At the end of your %install section you need to add the line: %find_lang %{name}
And then instead of just "%files", use %files -f %{name}.lang
That will handle the *.mo "locale" files automatically. Add all the other install directories to the %files section.
Reply With Quote
  #3  
Old 3rd August 2012, 11:13 PM
Yellowman
Guest
 
Posts: n/a
linuxfirefox
Re: Help creating spec file for gMTP

Whoops I broke it

https://dl.dropbox.com/u/6907158/gmtp.spec


Code:
Summary:            A simple MP3 and Media player client for UNIX and UNIX like systems
Name:               gmtp
Version:            1.3.3
Release:            2%{?dist}
License:            BSD
Group:              Applications/Multimedia
Source:             http://downloads.sourceforge.net/project/gmtp/gMTP-%{version}/%{name}-%{version}-i386.tar.gz
URL:                http://gmtp.sourceforge.net/

BuildRequires: libmtp-devel
BuildRequires: flac-devel
BuildRequires: libid3tag-devel
BuildRequires: libusb-devel
BuildRequires: libvorbis-devel
BuildRequires: gtk3-devel
BuildRequires: glib2-devel
BuildRequires: desktop-file-utils

%description
gMTP is a client for accessing MTP devices.

%prep
%setup -q -n gMTP

%build
make %{?_smp_mflags} gtk3

%install
make DESTDIR=%{buildroot} PREFIX=%{_prefix} install-gtk3 
make DESTDIR=%{buildroot} PREFIX=%{_prefix} register-gsettings-schemas

desktop-file-validate %{buildroot}/%{_datadir}/applications/gMTP.desktop


%find_lang gmtp

%postun
if [ $1 -eq 0 ] ; then
    /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
fi

%posttrans
    /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :

%files -f gmtp.lang
%doc AUTHORS ChangeLog COPYING NEWS README
%{_bindir}/*
%{_datadir}/applications/gMTP.desktop
%{_datadir}/gmtp
%{_datadir}/pixmaps/gMTPicon.png
%{_datadir}/glib-2.0/schemas/org.gnome.gmtp.gschema.xml
%{_datadir}/glib-2.0/schemas/gschemas.compiled

%changelog
* Fri Aug 03 2012 Leigh Scott <leigh123linux@googlemail.com> - 1.3.3-2
- Fix %%install make prefix
- Change gconf to gsettings in %%install
- Valid desktop file
- Add scriptlets for gsettings
- Add the needed build requires
- Fix source url
- Install lang files properly
- Install %%doc

* Fri Aug 03 2012 Patrick Talbert <skibler@gmail.com> - 1.3.3-1
- Initial rpm package

Last edited by Yellowman; 4th August 2012 at 02:04 PM.
Reply With Quote
  #4  
Old 4th August 2012, 04:17 PM
Yellowman
Guest
 
Posts: n/a
linuxfirefox
Re: Help creating spec file for gMTP

Quote:
Originally Posted by PabloTwo View Post
This package installs to /usr/local. There is no configure file to run to change that to /usr during the config step since there is no config step. %{_bindir} translates to /usr/bin. If you want to install to the standard Fedora rpm location of /usr, then you'll need to add a line to your spec file that modifies the Makefile by changing the line "PREFIX ?= /usr/local" to "PREFIX ?= /usr" using sed in the %setup section.

Also, your %files section is incomplete. I ran a "make" then "make install DESTDIR=~/work/mGTP" to see what files would install and to where. Here's the result, shown using the tree command on that destination directory:
Code:
usr
└── local
    ├── bin
    │** └── gmtp
    └── share
        ├── applications
        │** └── gMTP.desktop
        ├── gconf
        │** └── schemas
        │**     └── gmtp.schemas
        ├── gmtp
        │** ├── audio-x-mp3-playlist.png
        │** ├── audio-x-mpeg.png
        │** ├── empty.png
        │** ├── folder.png
        │** ├── icon-16.png
        │** ├── icon.png
        │** ├── image-x-generic.png
        │** ├── logo.png
        │** ├── media-cdrom-audio.png
        │** ├── stock-about-16.png
        │** ├── text-plain.png
        │** ├── video-x-generic.png
        │** └── view-refresh.png
        ├── locale
        │** ├── da
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** ├── de
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** ├── es
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** ├── fr
        │** │** └── LC_MESSAGES
        │** │**     └── gmtp.mo
        │** └── it
        │**     └── LC_MESSAGES
        │**         └── gmtp.mo
        └── pixmaps
            └── gMTPicon.png
At the end of your %install section you need to add the line: %find_lang %{name}
And then instead of just "%files", use %files -f %{name}.lang
That will handle the *.mo "locale" files automatically. Add all the other install directories to the %files section.

None of this is needed (see spec in post #3 )
Reply With Quote
  #5  
Old 7th August 2012, 06:43 PM
patrick Offline
Registered User
 
Join Date: Mar 2012
Location: Carrboro, NC, USA
Posts: 17
linuxchrome
Re: Help creating spec file for gMTP

Ha! I spent a good while trying to create a sed line to change the Makefile and finally came up with:

Code:
sed -i -e 's/PREFIX ?= \/usr\/local/PREFIX ?= \/usr/g' Makefile
...and then I saw the posts from Yellowman! So that PREFIX=%{_prefix} in the make line changes the install prefix to /usr instead of /usr/local?

And the %files section literally has to have a line for each file to be installed? Is it cheating/wrong/bad to use %[_datadir}/* ?

Also, with Yellowman's spec file it compiles and runs great. What has to happen to get it included in a proper fedora repo?? With all the new android devices using MTP I would imagine gMTP will be a much more popular application!

Thank you everyone for the help.
Reply With Quote
  #6  
Old 7th August 2012, 07:01 PM
Yellowman
Guest
 
Posts: n/a
linuxfirefox
Re: Help creating spec file for gMTP

Quote:
Originally Posted by patrick View Post
Ha! I spent a good while trying to create a sed line to change the Makefile and finally came up with:

Code:
sed -i -e 's/PREFIX ?= \/usr\/local/PREFIX ?= \/usr/g' Makefile
...and then I saw the posts from Yellowman! So that PREFIX=%{_prefix} in the make line changes the install prefix to /usr instead of /usr/local?

And the %files section literally has to have a line for each file to be installed? Is it cheating/wrong/bad to use %[_datadir}/* ?

Also, with Yellowman's spec file it compiles and runs great. What has to happen to get it included in a proper fedora repo?? With all the new android devices using MTP I would imagine gMTP will be a much more popular application!

Thank you everyone for the help.
It has to be reviewed, here's the process.

http://fedoraproject.org/wiki/Packag...PackageProcess

It isn't that bad, I did it

https://admin.fedoraproject.org/pkgd.../leigh123linux



and (it's all about ownership)

Quote:
Why do we need to use %find_lang?

Using %find_lang helps keep the spec file simple, and helps avoid several other packaging mistakes.

Packages that use %{_datadir}/* to grab all the locale files in one line also grab ownership of the locale directories, which is not permitted.
Most packages that have locales have lots of locales. Using %find_lang is much easier in the spec file than having to do:
https://fedoraproject.org/wiki/Packa...25find_lang.3F

Last edited by Yellowman; 7th August 2012 at 07:08 PM.
Reply With Quote
  #7  
Old 17th August 2012, 07:15 PM
grdryn Offline
Registered User
 
Join Date: Apr 2011
Location: Galway, Ireland
Posts: 3
linuxfirefox
Re: Help creating spec file for gMTP

Just a quick query: I see BuildRequires but no Requires in the spec. Would the non-devel equivalents of the -devel BuildRequires be needed as Requires?

EDIT: I'd love to see this in the Fedora package collection by the way! Good luck with it!
Reply With Quote
  #8  
Old 17th August 2012, 07:50 PM
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,190
linuxchrome
Re: Help creating spec file for gMTP

Quote:
Originally Posted by grdryn View Post
Just a quick query: I see BuildRequires but no Requires in the spec. Would the non-devel equivalents of the -devel BuildRequires be needed as Requires?

EDIT: I'd love to see this in the Fedora package collection by the way! Good luck with it!
No. The rpm packaging process determines what the non-devel requirements are and automatically will pull in any dependency packages when using yum (or any GUI front-end to yum) when installing.
Reply With Quote
  #9  
Old 17th August 2012, 08:11 PM
Yellowman
Guest
 
Posts: n/a
linuxfirefox
Re: Help creating spec file for gMTP

Quote:
Originally Posted by PabloTwo View Post
No. The rpm packaging process determines what the non-devel requirements are and automatically will pull in any dependency packages when using yum (or any GUI front-end to yum) when installing.
It does this mostly but it can't be relied on to get it right.
Reply With Quote
Reply

Tags
creating, file, gmtp, rpm, rpmbuild, 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
[SOLVED] Need help with RPM spec file Hlingler Programming & Packaging 3 18th January 2011 11:24 AM
Can someone check my spec file? uncholowapo Gamers' Lounge 2 15th October 2008 11:22 PM
rpm spec file macro help FunkyRes Programming & Packaging 1 14th September 2008 02:36 PM
building a SPEC file jim Programming & Packaging 5 2nd October 2005 09:40 PM


Current GMT-time: 16:33 (Friday, 31-10-2014)

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
Nabari Travel Photos on Instagram - Corner Brook Travel Photos on Instagram - Lebanon Travel Photos