Ivan Gyurdiev wrote:
Always avoid rebuilding packages as root.
Why is that?
Because it is very insecure for one thing, and can silently destroy parts of your installed OS very easily. When building as root, a misplaced "rm -rf" or other fairly fatal snippet of code can really fry your entire installed OS. There are lots of rpm specs out there with rather serious (and likely unintentional) flaws in them which if executed as root have a lot of power to cause silent problems to your system.
Another problem is spec files that do not specify a buildroot, will get installed into your real OS at %install time! This overwrites system installed binaries and is very very bad!
The problems that can and do occur when building rpms as root are far more common that you might think, and while Red Hat supplied src.rpms and some of the better public repositories out there both have much higher quality packaging, the risks are still there for accidental mishaps, and a lot of mishaps go unnoticed for quite some time unless they are really destructive.
Here is a copy of my personal rpm config files, completely documented to assist people in setting up rpm to build from their personal user account rather than risk system corruption from doing it as root:
ftp://people.redhat.com/mharris/hacks/rpmbuild-nonroot-1.0.tar.gz
Be sure to read all documentation before using, and feel free to customize to taste and share with anyone else.
Hope this helps.