Re: Creating .spec files



Hi *,

On Mon, Dec 08, 2003 at 01:08:06PM -0800, Michael A. Peters wrote:
> On Mon, 2003-12-08 at 12:56, Christian Lohmaier wrote:
> > On Mon, Dec 08, 2003 at 11:12:31AM -0600, James Richardson wrote:
> [...] 
> You also should use the %lang feature when applicable.

¿What is the %lang feature?

> Some of it may need to be manually done.
> 
> Attached is a spec file I wrote for gnome-terminal 2.2 showing how I
> dealt with scrollkeeper - including the %lang stuff (I had to manually
> create a file for the omf lang stuff - that isn't built into rpm's
> find_lang yet - or at least wasn't)

Ahh, do you just mean the %find_lang macro? I use that already.
And "manually create" - does this mean you had to create the list before
you could build successful?
Then this is not an option.
Setting up the rpm-environment (~/.rpmrc and ~/.rpmmacros) should be the
only prerequisites. Then a "rpm -ba package.spec" should work out of the
box.
There should not be the need to do a fake build, create the omf-list and
then build again.

If %find_lang doesn't include omf files by default, one should place a
modified version in ~/.rpmmacros that does the job.

> notice the following -
> 
> %define __gconftool_2 %_bindir/gconftool-2
> %define __scrollkeeper_update %_bindir/scrollkeeper-update

Well, this may be useful. But still this is not portable.
Not much different from defining %bindir/gconftool-2 directly.
(I wouldn't use %_bindir since that probably misses the path set. At
least this wouldn't work with %bindir set to /opt/gnome2

> # prevent creation of package if unpackaged files
> %define _unpackaged_files_terminate_build 1

Is this a standard-option? I didn't find it documented.
Nevertheless this will cause the %install-section to grow, but this can
be useful indeed.

> -=-
> Source1: %{name}.omf.lang

If this file cannot be created on the file I would not like to take this
approach.
> -=-
> 
> export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
> %makeinstall
> unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
> %__rm -rf %buildroot%_localstatedir/scrollkeeper

This is the cause of telling rpm to fail on unpackaged files. But again
I would not use %_localstatedir but %localstatedir.

> %find_lang %{name} --with-gnome

The --with-gnome switch was new to me. Fine that it exists ;-)

> cat %{SOURCE1} >> %{name}.lang

see my comment above. Eithe %ind_lang should be enhanced or the list
should be omitted and the files manually listed.

> %post
> export GCONF_CONFIG_SOURCE=`%__gconftool_2 --get-default-source`
> %__gconftool_2 --makefile-install-rule
> %_sysconfdir/gconf/schemas/%{name}.schema
> s > /dev/null
> %__scrollkeeper_update

Scrollkeeper should not be mandatory at all, so include a check whether
scrollkeeper is installed at all.
 
> This was for an internal (not public) linux distribution - but these
> techniques should work with any linux distro.

They do, but I already use them ;-))

> %define name gnome-terminal
> %define ver 2.2.2
> %define rel yjl1

I think these extra lines are superfluous. Just put the Version and
Release-Tags to the top of the file.

> Packager: Michael A. Peters <mpeters mac com>

I'd put this in the ~/.rpmmacros file. Otherwise this has to be updated
everytime.

> Requires: %__gconftool_2
> Requires: %__scrollkeeper_update

Scrollkeeper should not be Required by the binary RPM (IMHO)
And I think it is better to require packages than some dedicated files.

> 
> %prep
> %__rm -rf %buildroot && %__mkdir_p %buildroot

My version of RPM does this on its own. -> unnecessary.

> %setup -q
> 
> %build
> %configure
> %__make

This should not be the "make" command, but the make maro

Instead of running /usr/bin/make run "<set the optflags> then make".

> %install
> [...]
> echo "%defattr(-,root,root)" > %_tmppath/%{name}.partial
> for a in `find %buildroot%_datadir/gnome -type f |%__sed -e s?"^%buildroot"?""?`; do
>     echo "$a" >> %_tmppath/%{name}.partial
> done;

¿What is this for? 
 
> %__strip --strip-all %buildroot%_bindir/gnome-terminal
 
This should be handled by the build root policies, not in the spec.
(the macro %__os_install_post)
Imaging you would like to create debug-build -> you would have to edit
every specfile.

> [...]
> %files -f %{name}.lang 
> %defattr(-,root,root)
> %doc AUTHORS COPYING ChangeLog INSTALL NEWS README TODO
> %config %_sysconfdir/gconf/schemas/%{name}.schemas

I suggest the following instead of the manually generated omf-file list:
-==-
# tag everything in %{_datadir}/share/omf as documentation
%docdir %{_datadir}/share/omf
%{_datadir}/share/omf/*
-==-
> [...]

ciao
Christian
-- 
NP: Limp Bizkit - Almost Over



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]