Jump to content

HOWTO Buchan Milne's RPM building mini howto


aru
 Share

Recommended Posts

 

rolf

Moderator

Joined: 16 Apr 2002

Posts: 968

Location: Oakland, CA USA

 

Posted: Fri Aug 02, 2002 4:45 pm Post subject: Buchan Milne's RPM building mini howto

_________________________________________________________________

 

 

Here is a copy of Buchan Milne's 'RPM building mini howto'

 

Mandrake Club Forum wrote:

RPM building mini howto. (Score: 1)

by bgmilne on Tuesday, July 30 @ 15:25:54 PDT

Since I want to develop some expertise in networking I am more

attracted to servers and utilities than to desktop apps. I have an

interest right now in Zope, FWBuilder and CFEngine. I am looking for a

way of learning how to package theses apps myself. I have found the

spec file for the latest FWBuilder (1.03 I think) inside Mandrakesoft

CVS. (Isn't that a great place?)

 

Zope and CFEngine are some of the server apps I have been meaning to

try, but haven't had the time. Maybe I can help you get some of this

packaged. I was planning to do Zope, but haven't got around to it yet

... I might still.

 

I am trying to build the package myself as there was never an offer to

train those who were interested in learning how to do it themselves.

It is a slow process but I guess that in due time I will be able to

propose those packages and submit them at the same time.

 

I think it might be an idea to do an rpm building tutorial, but it

would take a while.

 

I found somewhere in the Internet that CFEngine 2.02 had been

packaged. It was built for RedHat. But interestingly enough, the spec

file and the *.src.rpm are also available. I attemped to install the

binaries but it failed, the usual, libraries incompatibilities. So I

am looking into the spec file and the source RPM to learn as much as I

can and package it for MDK 8.2. When I succeed I will submit it.

Certainly, this is going to take me longer than it would take someone

with more experience but I am determined to learn how to package.

 

First step with a SRPM is to try and rebuild it:

 

$ rpm --rebuild cfengine*.src.rpm

 

Note, that if you haven't got a ~/.rpmmacros (decribed, with example

file in the mdk-rpm howto) this will fail unless you have write access

to /usr/src/rpm/*. Best is to make a .rpmmacros and the directories it

requires.

 

If that doesn't work (like if the build fails), install the src.rpm:

 

$ rpm -ivh cengine*.src.rpm

 

It will install all sources and patches in your rpm source directory,

which you can find with

 

$ rpm --eval "%_sourcedir"

 

and a SPEC file in your spec dir, which you can find with

 

$ rpm --eval "%_specdir"

 

You can then edit the spec, and try to build it with:

 

$ rpm -ba `rpm --eval "%_specdir"`/cfengine.spec

(you can use the real path if you want, but this should work for

anyone).

 

You should get an rpm in your rpm directory. For binaries RPMs, that

should be:

$ rpm --eval "%_rpmdir/%_target_cpu"

for non-binary RPMs, that should be

 

$ rpm --eval "%_rpmdir/noarch"

 

If you build succeeds, try installing it. You may find your

dependencies are wrong, fix your spec file and rebuild. But wait, if

you haven't changed anything that will affect the compilation phase,

you can short-circuit the build (useful on a big package, like Mozilla

or OpenOffice.org which take hours to build):

 

$ rpm -bi `rpm --eval "%_specdir"`/cfengine.spec --short-circuit

 

Since short-circuit only does one build step at a time, you have to

tell it which ones to do, for each one you need. Without the

short-circuit option, it does up until the end of the '-b' command.

The '-b' commands are p (prep), c (compile), i (install), b (binary

RPM), s (source RPM) and a (both source and binary RPM). Thus, the

command above does the "%install" section of the rpm only, and to

build rpms from it, you need to

 

$ rpm -ba `rpm --eval "%_specdir"`/cfengine.spec --short-circuit

 

Now you can test installation again.

 

Once you are happy with the installation, you will want to check the

package for common mistakes, using rpmlint (in the rpmlint rpm):

 

$ rpmlint `rpm --eval "%_rpmdir/%_target_cpu"`/*cfengine*.rpm

 

$ rpmlint `rpm --eval "%_srpmdir"`/*cfengine*.rpm

 

Fix any mistakes again, using the short-circuit trick again if

suitable.

 

Once all those issues are resolved, and you think the RPM is ready for

public consumption, you will want to rebuild it (to ensure the whole

process works) and sign it also:

$ rpm -ba `rpm --eval "%_specdir"`/cfengine.spec --sign

 

(you need to have created gpg keys, and set them up in ~/.rpmmacros)

as described in the mdk-rpm howto.

 

Some people also recommend using --rmsource, followed by a rebuild of

the generated srpm, to ensure that you haven't used a file that isn't

in the source package, but it may not be necessary.

 

Btw, if you get any weird errors doing any of the build-related rpm

functions, make sure you have the rpm-build rpm installed

 

Well, it seems I have just done a mini howto for building RPMs. If

anyone has questions on this, or more suggestions please add them

below, and maybe we can turn this into an official Mandrake Club RPM

Building Guide.

 

I am studying (again) MDK-RPM Howto. It is not as crystal clear as I

would like it to be but it is of some help. I have also read the Linux

Documentation Project Howto (too skimpy). If any one has other

suggestions for studying I more that welcome the suggestions.

 

You may also want to read some parts of the Maximum RPM book, avaiable

somewhere at

 

And if anyone with experience packaging wants to give a hand, I would

most appreciate it.

 

Maybe we need to start a new category on the forums, but in the

meantime maybe you should start a thread under the RPMs category.

 

Feel free to post there, one of the VIPs/packagers should answer ...

 

[/color]

 

 

JeroenM

Moderator

Joined: 16 Apr 2002

Posts: 594

Location: Leuven, Belgium

Posted: Fri Aug 02, 2002 4:59 pm Post subject:

_________________________________________________________________

 

 

Thank you!!

 

 

spider

Frequent user

Joined: 21 Jul 2002

Posts: 65

Posted: Thu Aug 08, 2002 12:25 pm Post subject:

_________________________________________________________________

 

 

Just what I am seeking for

 

thanks

 

 

 

Editor's note: This thread was originally posted at the old MUB (Mandrake User Board at club-nihil). This post is the result of a 99% automatic backup, so due to its nature some text may be lost (improbable but possible).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...