LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Rpmbuild for PHP/Mysql App (https://www.linuxquestions.org/questions/programming-9/rpmbuild-for-php-mysql-app-739596/)

baddah 07-12-2009 04:26 PM

Rpmbuild for PHP/Mysql App
 
Hi,

I'm looking for a way to use rpmbuild to make an rpm of a php/mysql app.

Basically i'll have the php code that must go to the default apache directory, and sqldump that will be imported to a specified database,etc.
Maybe check dependancies as well, i.e check that php,mysql and php-mysqli is installed.

I'm not sure what i'll need in my spec file though. Firstly, is this possible, and if so do i need to make some kind of Makefile? What do i need to add in my prep and build sections of my spec file?

I know i can probably write a shell script that will do everything, but i'll really prefer to have a .rpm file that will do all of this for me.

Any suggestions?

Thnx

unSpawn 07-12-2009 05:48 PM

Quote:

Originally Posted by baddah (Post 3605424)
Firstly, is this possible,

Sure it can be done.


Quote:

Originally Posted by baddah (Post 3605424)
I'm not sure what i'll need in my spec file though.

Have a look at IBM's "Building RPM packages without being root" part 1 and part 2 (http://www.ibm.com/developerworks/library/l-rpm1/, http://www.ibm.com/developerworks/library/l-rpm2/), Maximum RPM (http://www.rpm.org/max-rpm/), Fedora/RH docs (http://fedoraproject.org/wiki/Packaging/Guidelines and http://docs.fedoraproject.org/drafts...-en/index.html ;-p


Quote:

Originally Posted by baddah (Post 3605424)
I know i can probably write a shell script that will do everything, but i'll really prefer to have a .rpm file that will do all of this for me.

In short what we need is a tarball that includes all the components that need to go onto the system and the list of commands you would perform to install this app. If you list the tarball contents and the commands we'll build you a .spec file and explain what goes on.

baddah 07-13-2009 01:40 AM

Thanks, i'll have a bash at it, and if i don't get it right i'll come back.

baddah 07-14-2009 09:11 AM

Ok, i think i understand the procedure now for code that needs to be compiled. The prep does the untar, then you build it and finally install it. Under your %files part you then list the compiled code and this gets included into the generated .rpm file.

I'm a bit confused with how to handle php code that just needs to be copied over to the default apache dir,i.e no compiling is needed.

A very trivial example :

I have a tarball HelloWorld-0.0.1.tar.gz with one file Helloworld.php in it. (The tarball is in my BUILD dir and all of that)

I want to generate an rpm so that when i run it, it copies over Helloworld.php to the default apache dir on the box it is installed on.

What would i need in my spec file here? I have tried to put the cp commands in the spec files' install part, but it does not seem to work :(.

I assume i'm missing the big picture...

unSpawn 07-14-2009 09:18 AM

Saying "doesn't seem to work" is not like posting the actual error. Posting those may make it way easier to read and understand what's going on. That said: 0) under %install list the proper 'install' command to copy the file from your %source to the $RPM_BUILD_ROOT/path/to/apaches/docroot/ and 1) under %files list the /path/to/apaches/docroot/filename.


All times are GMT -5. The time now is 10:57 AM.