rpmrebuild - Man Page

a tool to build an rpm package from an installed package


rpmrebuild [option] <packagename>


rpmrebuild is a tool to build easily rpm package. it can be used to build an rpm file from an installed package (lost rpm) or  to quickly make change to a package:  just have your change on installed files and call rpmrebuild.


-5  --md5-compat-digest

use rpm 4.4 compatible digest (md5)

-a,  --additional=<flags>

pass additional flags to rpmbuild

-b,  --batch

work in batch mode (no interactive query if files change)

--cap-from-db (default)

set files posix capabilities as saved in rpm database


set files posix capabilities as installed files (do not force to original capabilities, saved in rpm database)

-c,  --comment-missing=<yes|no>

comment out in the specfile missing files. Default: no.

-D,  --define=<defines>

defines to be passed to rpmbuild.

-d,  --directory=<directory>

rpm package result will be written in directory.

-e,  --edit-spec

alias to --edit-whole.

-f,  --filter=<command>

alias for --change-spec-whole

-h,  --help

output help information about all, but plugins option and exit.


output help information about plugins options and exit.

-i,  --include=<file>

read more options from the file 'file'.

-I,  --install

install the created package. you need to run rpmrebuild as root user.

-k,  --keep-perm

alias to --pug-from-fs

-l,  --list-plugin

list installed plugins

-m,  --modify=<command>

alias to --change-files

-n,  --notest-install

do not test install at end of rpm building

-p,  --package

use package file, not installed rpm (this option is like rpm's -p option)

--pug-from-db (default)

set files permission, uid and gid as saved in rpm database


keep installed files permission, uid and gid  (do not force to original files permission, uid and gid saved in rpm database)

-P,  --autoprovide

use rpm scripts to compute provides

-R,  --autorequire

use rpm scripts to compute requires

-r,  --release=<version>

specify a release

-s,  --spec-only=<specfile>

do not rebuild package, only generate specfile.  Can't be used with --change-files.

-v,  --verbose

verbose output


for debugging purposes : do not remove temporary files at end of work. also force verbose mode

-V,  --version

output version information and exit.

-w,  --warning

display some warnings if it detects a potential problem  (for example, spec file which contains filename with globbing char).

-y,  --verify=<yes|no>

Turn on/off package verifying before processing.  Default: yes. Can be turn off to get better performance.


rpmrebuild use may be extended with plugins. Plugins are searched in /usr/lib/rpmrebuild/plugins and then in $PATH


Invoke plugin which change package's files. Note, that these files are copied before to the temporary location, so installed package's files not changed.
Can't be used with --spec-only


Invoke plugin or editor to change specfile.








































Invoke plugin or editor to change preamble, conflicts, obsoletes, provides, requires, description, files, triggers, preinstall, postinstall, preuninstall, postuninstall, verifyscript or changelog.
None of these options can be specified after --change-spec-whole or --edit-whole.

Include Files

Any of the rpmrebuild's LONG option can be specified on the command line or in the include file (file specified with -i/--include option).

Include files are also searched in the /usr/lib/rpmrebuild/plugins directory.

Include file has following syntax.


Any line begin with '#' or some number of whitespace and '#'.

empty line

empty line are ignored.

option line

option line is very similar to the option written on the command line. the limitation of the option line in the file are:

long option

should be used ONLY long options WITHOUT leading --.

option's argument

option's argument should not be quoted.


option's argument should be separated from option by spaces or tabs, not by equal ('=') sign.

non-optional argument(s)

package name (non-optional argument) shouldn't be specified in the include file.

For example, if command line looks like:

rpmrebuild --change-files="pgm1 a b c" --change-spec-pre="pgm2 bb" pkg

Then include file should be written like:

change-files    pgm1 a b c
change-spec-pre pgm2 bb



is used by rpm when building packages (macros)


directory where rpmrebuild put temporary files.



Directory for temporal files. If not set ~/.tmp/rpmrebuild.$$ is used.


This is another way to pass options to rpmrebuild (to use with care). It allows to change  the default options on a host. For example to activate the un_prelink plugin, just set RPMREBUILD_OPTS="--include un_prelink.plug"


used to specify an editor for specfile. if not set EDITOR variable examined.


used to specify an editor for specfile. if not set vi used.


Build an rpm package as closed as possible to original one:

rpmrebuild --batch package

Build a modified package:

rpmrebuild --keep-perm package

Build a rpm from another rpm file:

rpmrebuild --package --filter filter /usr/src/redhat/i386/package-i386.rpm

rebuild and sign the bash package

rpmrebuild --additional "--sign" bash

Rebuild rpm as legacy (rpm[23]) package:

rpmrebuild --additional "--nodirtokens" bash

Specify generated rpm name:

rpmrebuild --define "_rpmfilename %%{NAME}.rpm" bash

Change package interactive

rpmrebuild --package --change-files "/bin/bash" /some/place/bash.rpm

Change package non-interactive

rpmrebuild --package --change-files "a.sh && b.sh" /some/place/bash.rpm

if you have problem with rpm building, and if you know specfile syntax, you can also edit it:

rpmrebuild  --edit-whole package

batch change of version tag

rpmrebuild  --change-spec-preamble='sed -e "s/^Version:.*/Version: YourVersion/"' YourPackage


Eric Gerbier <gerbier@users.sourceforge.net>
Valery Reznic <valery_reznic@users.sourceforge.net>

See <URL:http://rpmrebuild.sourceforge.net/>.


rpmrebuild can not reproduce exactly a package, so

- md5 checksum will not match original ones.
- gpg or pgp signatures are lost

packages which contains file with globbing characters (* .. ? ) will not build

See Also

rpm(8), rpmbuild(8), rpmrebuild_plugins(1), 'man -k rrp' for plugins specific manpages.

Referenced By


2.16 Eric Gerbier rpm tools