fedpkg recipes

At some point I intend to implement a view source tool, but in the mean time here are some useful recipes.

fedpkg is a great little command line tool for checking out, building and modifying Fedora packages. On this page I’m collecting a few simple recipes, useful for all Fedora users. You will need to yum install fedpkg but apart from that no other preparation is required. All the recipes use binutils as an example, but you can use any package name.

Do you have a recipe using fedpkg? Post it in the comments.

Upgrade to the Rawhide version of a Fedora package

fedpkg clone -a -B binutils
cd binutils/master

master corresponds to Rawhide. There are also directories for each branch, eg. f20 for Fedora 20. At this point you may need to install build dependencies:

sudo yum-builddep binutils.spec

Build the package on your local machine. This builds it against whatever version of Fedora is installed on your machine:

fedpkg local

To install the package:

sudo yum install */*.rpm

Apply a source patch to a Fedora package

Note: One aim of the proposed view-source tool will be to make this almost completely automated.

fedpkg clone -a -B binutils
cd binutils/fXX

(Choose your current Fedora version instead of fXX, or use master for Rawhide)

Apply the patch:

cp /tmp/test.patch .
rpmdev-bumpspec -r binutils.spec
vi binutils.spec

Near the top of the spec file, add:

Patch9999: test.patch

In the %prep section, add:

%patch9999 -p1

Now build and install the patched package as usual:

sudo yum-builddep binutils.spec
fedpkg local
sudo yum localupdate */*.rpm

Examine the source of a package

Sure, you can look at the upstream package sources, but often you want to look at the older / patched source as it applies to your version of Fedora, since that might be different …

fedpkg clone -a -B binutils
cd binutils/fXX
fedpkg prep

Change fXX to your version of Fedora. The prep subcommand will unpack the tarball and apply all the patches.



Filed under Uncategorized

2 responses to “fedpkg recipes

  1. Is there any advantages of %patch9999 -p1 -b .xxxx?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.