Ported from rpmdrake