Creating RPM's for Linux - Part 2



Pinky:So do you want to do tonight Brain?
The Brain The same thing we do every night Pinky. Try to build RPM's.
Pinky:Narf. But I though we tried to take over the world?
The Brain That was before our show was canceled. Now pay attention.


The Brain Today we are going to see how buildroot can make your rpm's more simple.
Pinky:But brain. How can you get more simple than pudding?
The Brain Well for starters, it could actually work.
Pinky:Naarrrf ... ya ... that didn't turn out to well did it.


Pinky:But Brain, I don't know what a buildroot is?
The Brain That's simple Pinky. When rpm get's the file in the %files section, it get's them from wherver it's BuildRoot is set to. If it isn't set, then BuildRoot is /.
Pinky:Zoinks ... that's slash isn't it Brain.
The Brain Yes Pinky. Now pay attention, because if we set BuildRoot to something else, we can cut down what we do in the %files section.


Pinky:But I want to make toast.
The Brain Very well Pin..
Pinky:Buttered Toast
The Brain Ok ... we'll make buttered toast.
Pinky:Poink ... here is by buttered toast spec file.
The Brain Ah, I see that you first make your buildroot directory, and the subdirectory. Then you copy the files into the directory one at a time. Yes, that will work. And for your %files you just have to put /
Pinky:Zoink Slash.
The Brain Yes, just slash


Pinky:And chocolate milk
The Brain But Pinky, this doesn't use a BuildRoot
Pinky:But it's simple ... nothing simpler than chocolate milk.
The Brain Except maybe you.
Pinky:But it works
The Brain Yes ... yes it works
Pinky:Poink
The Brain But Pinky, this can be dangerous if you arn't careful. This simply sucks up the files that you tell it, from where they are now. You have to make sure the file is really what you want before you make this rpm.
Pinky:But it works
The Brain Yes ... yes it works, and to be honest, you can't get much simpler than this.


The Brain But enough about you, let me show you tonights plan. Behold the texas switch.
Pinky:Naaarrrf
The Brain As you see, my sources are a gzipped tarball, and then another file.
Pinky:Wheee ... oh ... no ... what is that %prep thing.
The Brain That %prep step will unpack our tarball and then put us in the directory that they have been unpacked to.
Pinky:So you are just copying them from there into Texas.
The Brain Yes! And then comes the stroke of genious ..
Pinky:CHEESE!!!
The Brain Yes pinky ... cheese. We made Source1 cheese, which as everyone know is the heart, mind and body of Wisconsin.
Pinky:Cheese cheese ... I love cheese
The Brain So I then rip the heart out of Texas, and replace it with cheese, causing Texas, and everyone in Texas, to act like they live in Wisconsin. Causing some of the worlds most powerful leaders to run around in the middle of winter without shirts, catching colds, and being stuck in bed.
Pinky:Ohhhh...
The Brain Yes, and then in the power vacuum, I will arise and RULE THE WORLD.
Pinky:But Brain ... I thought we were making RPM's?
The Brain We are Pinky, but that is only the first step.
Pinky:Narf.


The Brain But the texas switch wouldn't let me take over the world without the decoy
Pinky:Naaarrrff ... that looks compilcated Brain.
The Brain It is a little, but it really is just another example of our BuildRoot with one addition. We are making three seperate rpm's when we we build this, instead of just building one rpm.
Pinky:So we build the rpm three times?
The Brain No pinky ... just once. But it is going to build three rpm's named decoy_swamp, decoy_forest, and decoy_city.
Pinky:Zoink ... Brain, you have a description for each of those.
The Brain Yes Pinky, and I also have a list of files for each, and a line called %package for each of them as well.
Pinky:But when you build this do you have to give rpm any special instructions?
The Brain No ... that is the beauty of this. You just build using this spec file like you would any other rpm. But it will write all three rpm's instead of just one.
Pinky:Brilliant ... oh ... but there is just one problem.
The Brain What's that?
Pinky:There isn't any cheese in your decoy.
The Brain There isn't supposed to be. This rpm decoy's you away from the cheese.
Pinky:But couldn't you just use fake cheese for a decoy.
The Brain No.
Pinky:Cheese whiz?
The Brain Step close Pinky, so I can hurt you ...

If you wanted to look at the rpm's, and the source rpm's, there are here.
Buttered Toast: Spec File Source RPM RPM
Chocolate Milk: Spec File Source RPM RPM
Texas Switch: Spec File Source RPM RPM
Decoy: Spec File Source RPM RPM 1 RPM 2 RPM 3


How-To
dawson@fnal.gov
June 12, 2003