Mailinglist Archive: opensuse-packaging (57 mails)

< Previous Next >
Re: [opensuse-packaging] packaging made simple.
  • From: Pascal Bleser <pascal.bleser@xxxxxxxxx>
  • Date: Sat, 19 Aug 2006 15:24:58 +0200
  • Message-id: <44E7112A.1090405@xxxxxxxxx>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marcus Hüwe wrote:
> On 2006-08-19 12:15:04 +0200, jdd wrote:
>> Here the example spec file I received (thanks :-)
>>
>> I have questions. I noted them with "###"
>>
>> #
>> # spec file for package makethumb (Version 0.1.01)
>> #
>> Name: makethumb
>> Summary: makes web site for photos
>> Version: 0.1
>> Release: 1
>> Group: Productivity/Graphics/Convertors
>> License: GPL
>> URL: http://www.dodin.net
>> Source: %{name}-%{version}.tar.gz
>>
>> ###where are the % variables defined?

I think you should first read some deeper documentation about how to
build packages. It's not rocket science, but it's not trivial either.

"packaging made simple" - I'm afraid it's not simple, at least making
good packages isn't.

The Fedora project has enhanced the "Maximum RPM Guide" and keeps it
up-to-date, that's the best reference you'll find about RPM:
http://fedora.redhat.com/docs/drafts/rpm-guide-en/index.html
(from section 8 on)

It explains almost everything you need to know, so please read it before
asking questions. Of course, if you have more elaborate questions, we'd
be happy to help.

SUSE Linux specific information, additions or ways of doing things are
compiled here:
http://forgeftp.novell.com//library/SUSE%20Package%20Conventions/spc.html

> You defined them some lines above :)
> Name: makethumb
> Version: 0.1
> ...
>
> "Name:", "Version:" etc. are special rpmtags.

Right, rpmbuild predefines a set of macros.

Macros are referenced with %macro or %{macro}.
Macros can be either "tags" or scripted functions.
"Tags" are things like %name, %version, %release, %_prefix, %_mandir,
%suse_version, %_tmppath, etc...

Scripted functions are .. well... functions or just placeholders.
Some are standard (%__make, %__install, %patch, ... - defined in
/usr/lib/rpm/macros) and some are specific to SUSE Linux
(%suse_update_desktop_files, ... - defined in /usr/lib/rpm/suse_macros)
e.g. %makeinstall, %suse_update_desktop_files, %patch, ...

http://fedora.redhat.com/docs/drafts/rpm-guide-en/ch22s02.html#id3045884
http://forgeftp.novell.com//library/SUSE%20Package%20Conventions/spc_rpm_macros.html

>> BuildRoot: %{_tmppath}/%{name}-%{version}-build
>> Packager: jdd <jdd@xxxxxxxxx>
>> BuildArch: noarch
>> Requires: bash jhead
>>
>> ###makethum needs some image converter that are usually
>> installed by default. it can choose two of them. Oh can I
>> say that? it needs imagemagic OR cjpeg/djpeg + netpbm
>>
> hmm you can try:
>
> Suggests: imagemagic
> Suggests: cjpeg...

Suggests is only available with RPM 4.4.x, so only specify that tag when
you're building a package for >= SUSE 10.1.

To write a spec file that works on both >= 10.1 and < 10.1, you can do this:

%if %suse_version >= 1010
Suggests: imagemagick cjpeg ...
%else
Requires: imagemagick
%endif

In this particular case, Suggests won't *force* the installation of one
of them.
I would rather recommend to pick one and force it with Requires, e.g.:

Requires: imagemagick

...
>> %install
>> rm -rf %{buildroot}
>>
> Don't do that!
> Your %{buildroot} will be "cleaned" before the build starts.. see %clean section.

Right, rpmbuild already cleans it.
Actually, doing as above could end up in a race condition, so do *not*
do that, never.

It's an often made mistake, and I guess at least 60% of the spec files
of SUSE Linux packages still contain that line.

It's not dramatic though, but if you write or edit a spec file, never
write that line in %install (or remove it if it's already there).

cheers
- --
-o) Pascal Bleser http://linux01.gwdg.de/~pbleser/
/\\ <pascal.bleser@xxxxxxxxx> <guru@xxxxxxxxxxx>
_\_v The more things change, the more they stay insane.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFE5xEqr3NMWliFcXcRAuQaAJ9YPCRP2d64jcCUX9OZS5Lkc+fkkQCgvy50
AF0gnY0MTT1YMbn7y7QZo4U=
=yMFZ
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References