reconstituting bin rpm from installed package (rewind function)

Edward Peschko horos11 at
Thu Mar 4 18:42:07 UTC 2010


Ok, I've been using rpm for a bit now, and I'd like the ability to
'rewind' my system, ie: take a package, install it, and then put it
back to the state it was before I did the install. I was thinking that
the easiest way to do this would be to reconstitute the binary rpms
from install, ie:

    1. get a list of files in a given installed package,
    2. get any metadata associated with that installed package from
the rpm database
    3. dump the two items into a binary rpm

If I then install the new rpm and it doesn't work out, I could simply
uninstall the new one, and reinstall the old, saved ones, ie: rewind
my setup.

Now, I know that this would be easy if I had the binary rpms laying
around that constitute my setup, but in this case I don't (they don't
ship with the system). Hence I'd like to be able to reconstitute the
binary rpms given the rpm database and the list of packages that are
installed on the system.

Is there a simple way to do this, I know I can list the files in a
package via -ql, but going from that list of files to a binary rpm
isn't obvious, at least from the rpmbuild manpage (which seems to be
driven off of src rpms). If rpmbuild had a command that mimicked tar:

rpmbuild --cvf  name_of_rpm.bin.rpm `rpm -ql <name_of_rpm.bin.rpm>`

then I could get most of what I'd want, except for pre-install and
post-install hooks. Other than that it would work for my purposes.

Anyways, is there an easy way to do this? Just looking at the rpm and
rpmbuild docs, I don't see one. But this has got to be a frequent
situation that people run into, so I'm hoping there has got to be a
simple solution that is precoded..

If not, is there a tool that generates a spec file for a binary rpm
based off a list of file names? I think that I could get that with a
wrapper around rpmbuild, although it would be nicer if the
reconstituted rpms truly were equivalent to what  installed..

Thanks much,


More information about the Rpm-list mailing list