PDA

View Full Version : rpmbuild and install problem for mysql


technog
28th February 2006, 11:21 PM
I was having a ton of trouble updating the mysql 4.x on FC4 to 5.01, so I decided to uninstall mysql 4.0 and build 5.01 from scratch.

Built using rpmbuild with the SPEC file; the contents of which looks like the commands in a makefile.
The install however, went into ../BUILD dir; didnt go to the usual location of /usr/local/mysql dir.

I re-built from the source with the same rpmbuild command and added -bi and --buildroot to /usr/local/mysql directory as :
rpmbuild -ba -bi --buildroot /usr/local/mysql --target i686 mysql-5.0.18.spec

Still nothing. The /usr/local/mysql dir doesnt even get created !

Is there an install-dir option from the command line ? or an equivalent thereof ??
man rpmbuild doesnt state any option for install dir.


There is a var in the spec file called RBR that seems to be used for make install part, but RBR gets set with the BUILD_ROOT_DIR var anyway !
At least configure has prefix dir and exec dir vars. I guess that I need these equivalent of these.


Any help,

Sunil

markkuk
28th February 2006, 11:34 PM
The install however, went into ../BUILD dir; didnt go to the usual location of /usr/local/mysql dir.
That's exactly how it should work, rpmbuild builds the program in a temporary location. DON'T point the buildroot anywhere near the final installation location of the files!
The program is installed in its correct final location by installing the RPM package created by a successful rpmbuild.

technog
1st March 2006, 04:50 PM

Wait a minute! found the package installed in as /mysql !

The Makefile in the BUILD dir had the root directory as the prefix dir !
Why in the blazes did this happen ?

So, if I wanted to do this again, and specify the standard dir for mysql to /usr/local/mysql:
Where and how would I specify this to rpmbuild ?


Also, in response to the last post, its great that rpmbuild did the right thing.
However installation into the root dir sounds like something incorrect in the spec file. How can I rectify this ?

Also, for someone new to the rpm world, it seems like its a wrapper around the configure/make/make install commands. Is this correct ?
At least with the configure command, I could specify the --prefix and --exec dirs option, which would generate the correct install command in the makefile.

Also, as a temporary next step, I could simply copy the installation dir into the intended dir and try to run the server from there. Ideally, however, for multiple installs, this should be taken care of by rpmbuild and an install tool to automate.

Please let me know what I am not understanding here,

tia,

Sunil

markkuk
2nd March 2006, 12:22 AM
Don't specify --prefix or --exec in the spec file and everything will go in the right place when you use the %makeinstall macro in the spec file. RPM packages install files under /usr, not /usr/local. See the Building RPM Packages (http://fedora.redhat.com/docs/developers-guide/ch-rpm-building.html) section of Fedora Developer's Guide, the Fedora Extras Packaging Guidelines (http://www.fedoraproject.org/wiki/Packaging/Guidelines) and Maximum RPM (http://rpm.org/max-rpm-snapshot/) for more information.

technog
2nd March 2006, 08:23 PM
markuk: ok, good referrences. Reading over a couple of coffees.

I guess I am still confused as to why the package got installed under the root dir ( /mysql) ?
The spec file must have it wrong.

Regardless, instead of moving the whole tree over to /usr/local/mysql manually, I would like to re-do the process and specify the correct location of /usr/local/mysl.

How can be done without moding the spec file ???

btw: I did move the dir over to /usr/local/mysql, and everyhing is good now. But I dont want to do this everytime.

Since there is a program, I would like to use it. If it doesnt behave as it should, I would like to correct it going forward.

Thanks,

Sunil