LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Modifying SRPMs (https://www.linuxquestions.org/questions/linux-general-1/modifying-srpms-697094/)

custangro 01-13-2009 04:24 PM

Modifying SRPMs
 
Hello,

I was wondering if anyone had a good tutorial or "howto" regarding modifying SRPMs.

I searched on google and I found tons of stuff about building RPMs from scratch and that's not what I'm looking for (don't really care about building .spec files right now...)

Basically this is what I'm looking for...

Say package-example.rpm doesn't have --with-perl compiled in it. I would like to download package-example.src.rpm and use the rpmbuild command to add that option.

Does anyone know of a good tutorial for something like that?

Thanks

-C

unSpawn 01-13-2009 05:18 PM

Extract .src.rpm (see 'rpm2cpio') into tarball, patches (if any) and .spec file. Modify %configure line in .spec file, save, run rpmbuild on the new .spec file. Should be about it.

custangro 01-13-2009 06:03 PM

Quote:

Originally Posted by unSpawn (Post 3407591)
Extract .src.rpm (see 'rpm2cpio') into tarball, patches (if any) and .spec file. Modify %configure line in .spec file, save, run rpmbuild on the new .spec file. Should be about it.

Ok, cool. Seems pretty straight forward.

I'll run some some tests and will post if I have trouble.

-C

custangro 01-13-2009 06:26 PM

Quote:

Originally Posted by unSpawn (Post 3407591)
Extract .src.rpm (see 'rpm2cpio') into tarball, patches (if any) and .spec file. Modify %configure line in .spec file, save, run rpmbuild on the new .spec file. Should be about it.

Quick question...

If I installed the src rpm....

example:
Code:

root@host# rpm -ivh package-example.src.rpm
Wouldn't that bypass the rpm2cpio step? Couldn't I just edit the spec file under /usr/src/redhat?

thanks,

-C

unSpawn 01-14-2009 03:11 PM

Quote:

Originally Posted by custangro (Post 3407654)
If I installed the src rpm.... (..) Wouldn't that bypass the rpm2cpio step?

Sure, but please make it a habit to build packages as unprivileged user. Building as root is: potentially unsafe (foreign code executed locally), potentially dangerous (use the wrong $RPM_BUILD_ROOT and see %clean "clean" your system pretty good), unnecessary (what *really* requires root rights anyway?).


Quote:

Originally Posted by custangro (Post 3407654)
Couldn't I just edit the spec file under /usr/src/redhat?

Sure.

custangro 01-14-2009 05:15 PM

Quote:

Originally Posted by unSpawn (Post 3408729)
Sure, but please make it a habit to build packages as unprivileged user. Building as root is: potentially unsafe (foreign code executed locally), potentially dangerous (use the wrong $RPM_BUILD_ROOT and see %clean "clean" your system pretty good), unnecessary (what *really* requires root rights anyway?).



Sure.

Thanks, I didn't know that about building packages as root. Should I make a pseudo user for this?

-C

unSpawn 01-15-2009 12:11 PM

Quote:

Originally Posted by custangro (Post 3408846)
Should I make a pseudo user for this?

No, you could use any unprivileged user that's allowed a login. Just copy over the directory structure: 'mkdir -p ~/redhat/{BUILD,SOURCES,RPMS,SPECS,SRPMS,tmp}' (you don't need ~/redhat/tmp but I like to confine all movement to ~/redhat/) and add a basic ~/.rpmmacros replacing $HOME with the actual value:
Code:

%_topdir        $HOME/share/src/redhat
%_tmppath      %{_topdir}/tmp
%fname          %{name}-%{version}.%{release}
%_builddir      %{_topdir}/BUILD
%_rpmdir        %{_topdir}/RPMS
%_sourcedir    %{_topdir}/SOURCES
%_specdir      %{_topdir}/SPECS
%_srcrpmdir    %{_topdir}/SRPMS

and you're all set (OK, you could add an ~/.rpmrc as well but you are probably not going to tweak %arch build flags).


All times are GMT -5. The time now is 04:33 PM.