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



-----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-----

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: netkit-telnet compile fail. `exit undeclared in main.cc ?
    ... and in what order to run the patches and what is done to compile, install, ... or remove the package. ... patch prior to actual compilation and this patch process fails ... or just the materials that come in the source rpm? ...
    (comp.os.linux.misc)
  • Re: Fedora Updates: whole packages vs patches
    ... single Solaris patch can patch more than one package. ... that diff file and original rpm to generate updated rpm. ...
    (Fedora)
  • Re: Fedora Updates: whole packages vs patches
    ... is recreating the base if you remove the patch. ... > location of the original package, and restore the needed parts from there. ... Implementing a tool that could replace changed files inside binary RPM, ... either download a patch, or new RPM. ...
    (Fedora)
  • RE: Creating RPMS from source without Makefile
    ... Creating RPMS from source without Makefile ... For several applications/tools I'd like to create an RPM to make ... You may want to start with a package less complex than httpd ... "Start with pristine sources; then patch as needed. ...
    (RedHat)
  • RE: [SLE] YaST Online Update Problem
    ... YaST ... I tried that and I get the following for each patch that YaST is trying to ... ERROR (YOU: rpm failed) ... YShortcutmanager.cc:96 No valid shortcut for ...
    (SuSE)