[CentOS] RPM `requires` installation order

Thu Oct 29 00:56:10 UTC 2015
Shyam S <shyam334 at gmail.com>

Hello All,

I'm a bit of newbie with rpm/yum, seeking the help from rpm/yum experts.

Suppose I have an RPM package A which depends on package B.
RPM A's spec has 'Requires:B'  tag with 'autoprov' and 'autoreq' enabled.

When I install RPM A on a 'centos 6.5' machine with 'RPM version 4.8.0',
using the command `yum install A` :

* `rpm` installs A first, then it installs B.
* The installation of B could partially fail. That is, A would installed
even if the       installation of the dependency, B has failed.

Is this the expected behaviour? (Shouldn't B be installed before A?)

Can the same behaviour be expected across versions (such as el5)?

I was hoping that the dependencies would be installed before the main
package is installed. Which would prevent the installation of the main
package, If one of the dependencies failed to install.

I have tried `PreReq` tag as well, which has same behaviour as far as I can
tell.

Is there any other means to accomplish my requirement?

Thanks,
Shyam