Discussion:
Automatically installing RPM build requirements
Gus Wirth
2011-11-16 03:26:41 UTC
Permalink
I'm building some RPM packages from source for Fedora 15. One of the
problems I'm encountering is getting all the prerequisites installed for
building the package. The format of the RPM file has lines in it like:


BuildRequires: SDL-devel
BuildRequires: a52dec-devel
BuildRequires: aalib-devel
BuildRequires: alsa-lib-devel
BuildRequires: cdparanoia-devel
BuildRequires: desktop-file-utils
BuildRequires: faad2-devel >= %{faad2min}
BuildRequires: fontconfig-devel
BuildRequires: freetype-devel >= 2.0.9

What I would like is some tool that gathers all the "BuildRequires"
lines, turns it into a "yum install xxxx" and then installs all the
prerequisites.

Either my search-foo is failing or maybe it doesn't exist, which I find
doubtful.

Alternatively, now that I look at it I guess a little bit of Perl could
take care of this but I'm feeling lazy at the moment.

Gus
Thomas Nicholson
2011-11-16 13:15:33 UTC
Permalink
Gus,

We have shell scripts that do basic builds like you're trying to do. We also have a config file that we create for each build.

So in this case you would list all the packages you need to install in the config including any options. Then the script reads the config and does all the install, test, deploy and logs all the activity.

This allows us to have one generic script that tests for OS type and then reads the config, that can be changed at anytime.

Not sure if that will work for you but that's how we get it done.

Good luck,

Thomas

Sent from my iPhone
Post by Gus Wirth
I'm building some RPM packages from source for Fedora 15. One of the
problems I'm encountering is getting all the prerequisites installed for
BuildRequires: SDL-devel
BuildRequires: a52dec-devel
BuildRequires: aalib-devel
BuildRequires: alsa-lib-devel
BuildRequires: cdparanoia-devel
BuildRequires: desktop-file-utils
BuildRequires: faad2-devel >= %{faad2min}
BuildRequires: fontconfig-devel
BuildRequires: freetype-devel >= 2.0.9
What I would like is some tool that gathers all the "BuildRequires"
lines, turns it into a "yum install xxxx" and then installs all the
prerequisites.
Either my search-foo is failing or maybe it doesn't exist, which I find
doubtful.
Alternatively, now that I look at it I guess a little bit of Perl could
take care of this but I'm feeling lazy at the moment.
Gus
--
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
Doug
2011-11-16 15:32:52 UTC
Permalink
Post by Gus Wirth
I'm building some RPM packages from source for Fedora 15. One of the
problems I'm encountering is getting all the prerequisites installed for
building the package.
Let me get this straight, you're trying to build(make your own) RPM packages of some source but you can't get the RPM packaging
build system installed because RPM will not install all the prerequisites for building RPM packages?

I would think something is wrong with your RPM system if it can't even build your build environment since installing prerequisites
is what the GNU/Linux package systems are known for doing. How could you trust your packaging is built correctly unless you build
and test on some other system you know RPM is functioning properly?
David Looney
2011-11-16 21:32:19 UTC
Permalink
Post by Doug
Post by Gus Wirth
I'm building some RPM packages from source for Fedora 15. One of
the problems I'm encountering is getting all the prerequisites
installed for building the package.
Let me get this straight, you're trying to build(make your own) RPM
packages of some source but you can't get the RPM packaging build
system installed because RPM will not install all the prerequisites
for building RPM packages?
I would think something is wrong with your RPM system if it can't
even build your build environment since installing prerequisites is
what the GNU/Linux package systems are known for doing. How could you
trust your packaging is built correctly unless you build and test on
some other system you know RPM is functioning properly?
I think he just means the pre-requisites for building the particular
package. The tool seems to be yum-builddep
(http://wiki.freeradius.org/Red-Hat-FAQ):

There is utility tool which will help you, it's called yum-builddep and
it's contained in the yum-utils package. If you don't have yum-utils
installed then install it now:

% yum install yum-utils

The yum-builddep tool is passed a src rpm on the command line, it then
scans the BuildRequires and builds a list of packages required to build
our package, if any of the necessary packages are not installed it will
install them for you, e.g.:

% sudo yum-builddep freeradius-2.1.1-7.fc10.src.rpm

David Looney
--
Ninety percent of the game is half mental. - Yogi Berra
Gus Wirth
2011-11-16 22:44:38 UTC
Permalink
On 11/16/2011 03:32 PM, David Looney wrote:
[snip]
Post by David Looney
I think he just means the pre-requisites for building the particular
package. The tool seems to be yum-builddep
There is utility tool which will help you, it's called yum-builddep and
it's contained in the yum-utils package. If you don't have yum-utils
% yum install yum-utils
The yum-builddep tool is passed a src rpm on the command line, it then
scans the BuildRequires and builds a list of packages required to build
our package, if any of the necessary packages are not installed it will
% sudo yum-builddep freeradius-2.1.1-7.fc10.src.rpm
David Looney
YES! That's exactly what I need.

Thank You!

Since the script is in Python I see where I could modify it to take into
account conditional requirements but for now it works well enough.

Gus
Olli Hollmen
2011-11-18 18:33:00 UTC
Permalink
yum-builddep is the correct tool for purpose, but just demonstrating a
perl solution as perl was
mentioned as one possibility. As a Ubuntu/Debian dpkg user I have not
tested this.

#!/usr/bin/perl
my @lines = `list-rpm-meta-guts $ARGV[0]`; # What is real command for
list-rpm-meta-guts ?
my @deps = map({chomp();/^BuildRequires:\s+(\S+)/ ? ($1) : ();} @lines);
map({`yum install $_`} @deps);

With best regards,

Olli
Post by Gus Wirth
[snip]
Post by David Looney
I think he just means the pre-requisites for building the particular
package. The tool seems to be yum-builddep
There is utility tool which will help you, it's called yum-builddep and
it's contained in the yum-utils package. If you don't have yum-utils
?% yum install yum-utils
The yum-builddep tool is passed a src rpm on the command line, it then
scans the BuildRequires and builds a list of packages required to build
our package, if any of the necessary packages are not installed it will
?% sudo yum-builddep freeradius-2.1.1-7.fc10.src.rpm
David Looney
YES! That's exactly what I need.
Thank You!
Since the script is in Python I see where I could modify it to take into
account conditional requirements but for now it works well enough.
Gus
--
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
Loading...