Doing something quite unprecedented: taking a thread frm hackers-il to
linux-il, as it is getting too technical ;-)

On Sat, 1 Jun 2002, Shlomi Fish wrote:

>
> Included below is an RPM Spec for building a collection of fortune files.
> It is specific to my collection, but hopefully can be customized to other
> sources with relative ease.
>
> I plan to use it as the basis for my fortune2rpm hack, which I have some
> great plans for.
>
>       Shlomi Fish
>
> #######################################
> # Base Macros which need to be set
> %define packageprefix fortune-mod-fortunes
> %define packagebase shlomif
> %define archivebase fortunes-shlomif
> %define version 0.2.2
> %define fortunefilesprefix shlomif-
>
> # Derived Macros
> %define name %{packageprefix}-%{packagebase}
> %define archivewithver %{archivebase}-%{version}
> %define archivefull %{archivewithver}.tar.gz

This appears to be slightly over-complecated. consider ranamin the tarball
or the package so they'll havethe same name.

Another note: you package has /usr and /usr/share hardwired . One thing
you should consider paramterising is the pathes insidethe package:

  %define fortunedatadir %{_altdatadir}/games/fortune

(I probably got the alias of /usr/share wrong, see /usr/lib/rpm/macros)

even though nobody needs to put the fortune files elsewhere on a decent
linux system, youcan never know when can this come in handy.

> Name: %{name}
> Version: %{version}
> Release: 6
> Copyright: Free to use but restricted

Hmm... what restrictions? Do you have a LICENSE file there? Maybe mention
that in the Licene header?

> Group: Toys

Do you want to add a 'Packager:' header here?

I would advise against this. Add it to your rpmmacros.

>
> Source: http://vipe.technion.ac.il/~shlomif/humour/fortunes/%{archivefull}
> BuildArch: noarch
> Buildroot: %{_tmppath}/%{name}-root
> URL: http://vipe.technion.ac.il/~shlomif/humour/fortunes/
> Serial: 1
> Requires: fortune-mod
> Summary: Shlomi Fish' Collection of Fortune Cookies

IMHO you should make that:

Fortune cookies collection by Shlomi Fish

It is shorter, and puts the important thing (functionally) first

>
> %description
> This package contains several collections of fortune cookies by Shlomi Fish.
> Namely, a collection of his own quotes, some of his favourites from various sources; 
>a collectionof excerpts from the T.V. Show Friends; the Rules of Open

That's a line longer than 80 chars .  Keep lines shrter than 80 chars and
seperate paragraphs with an empty lines.

> Source Programming, and a collection of reasons why there is no iglu cabal.
>
>
> %prep
> %setup -n %{archivewithver}
>
>
> %build
>
> myprefix="%{fortunefilesprefix}"
> rm -f *.dat
> ls | grep -v "\\." | grep -v "[A-Z]" | \
>   ( while read T ; do        \
>       mv "$T" "${myprefix}$T"  ;     \
>       /usr/sbin/strfile "${myprefix}$T" "${myprefix}$T.dat"  ;    \

Does you packge BuildRequire-s /usr/sbin/strfile ? (from which package is
it, anyway?)

>    done )
>
> %install
>
> rm -rf $RPM_BUILD_ROOT
> mkdir $RPM_BUILD_ROOT
> for dir in usr usr/share usr/share/games usr/share/games/fortunes ; do
>   mkdir $RPM_BUILD_ROOT/$dir
> done
> # This will only work in bash and friends.

The script is run with /bin/sh . This is bash on most linux systems,but
can be ash ;-)

use 'mkdir -p'

simply 'mkdir -p ${RPM_BUILD_ROOT}/usr/share/games/fortunes

> for I in *.dat ; do
>   cp $I ${I%%.dat} $RPM_BUILD_ROOT/usr/share/games/fortunes
> done
>
> %post
>
> %postun

You don't have to put an empty %post and %postun . Simply remove those

>
>
> %files
> %defattr(-,root,root)
> /usr/share/games/fortunes/*

No docs at all, not even a README?

in the prep:

cat <<EOF >README
This package contains BLABLABLA
EOF


in %files
$doc README

>
> %clean
> rm -rf $RPM_BUILD_ROOT
>
> %changelog
> * Fri May 31 2002 Shlomi Fish <[EMAIL PROTECTED]> 0.2.2-2
> - Added macros all over the place
>
> * Thu May 30 2002 Shlomi Fish <[EMAIL PROTECTED]> 0.2.2-1
> - first release - testing.

Good to see that this part has not been neglected

-- 
Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to