Re: Make RPMs from .spec and package source tarball? how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ben Lancaster wrote:
> How does one make an RPM from a source tarball and an RPM spec file?  
> I need to patch the source of MythTV to fix a rather annoying bug,  
> and then make an RPM based on the ATRPMS spec for the package. Of  
> course, I could just go ahead and install from source, but this will  
> mess up my yum upgrades/dependencies.

Here's how I'd do it (for the most part).  I'll use $file, $package,
and $version in place of the real names, replace them with whatever
values you need.

First, install the fedora-rpmdevtools.  Run fedora-buildrpmtree to
create an rpm build tree where spec files, sources, and rpms will
go.

Install the mythtv source package from atrpms (rpm -ivh $file.src.rpm).

Prepare the mythtv sources using the command rpmbuild -bp $file.spec.
This will unpack the sources into ~/rpmbuild/BUILD/$package-$version.

Make the changes you need to the sources and prepare a patch.  There
is a script in the rpm package named gendiff that is handy for this.
To use it you would make a backup of the files you are changing before
you make any changes.  If you're changing $file.c, do a cp -a
$file.c$extension.  Use the same extension for all of the files you
need to modify.  After you're done making the changes, cd to
~/rpmbuild/BUILD and run gendiff $package-$version $extension >
../SOURCES/$package-$version-$extension.patch.

Edit the spec file and add the patch file you just created.  You will
need to make two changes to the spec file.  First, add

Patch0: patchfile

where the other Source and Patch lines are.  Change 0 to something
else if there is already a Patch0.

Then, in the %prep section of the specfile, add

%patch0 -p1 -b $extension

after the %setup line and any other patches.  Adjust the 0 to match
the number for your patch above.

After this, you should be able to run rpmbuild -ba $file.spec and have
it rebuild a binary and source rpm for you.  If your patch adds any
new files, you will need to add them to the %files section.  You may
also want to add a %changelog entry as well.

Hopefully I haven't overlooked too many important steps here.  I'm
sure others will point them out if I have. :)

HTH,

- -- 
Todd        OpenPGP -> KeyID: 0xD654075A | URL: www.pobox.com/~tmz/pgp
======================================================================
If you think nobody cares if you're alive, try missing a couple of car
payments.
    -- Earl Wilson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: When crypto is outlawed bayl bhgynjf jvyy unir cevinpl.

iG0EARECAC0FAkSN71ImGGh0dHA6Ly93d3cucG9ib3guY29tL350bXovcGdwL3Rt
ei5hc2MACgkQuv+09NZUB1rL9wCfb1a6PdVGeO5gLnTeILu9WZAr+HkAoJxnHE9C
F/KZgyVgijbs9J8PGg+M
=QBHh
-----END PGP SIGNATURE-----


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux