Extracting information from package.xml with conditions

I know that I can use rosdep to query build dependencies like:

ROS_VERSION=1 rosdep keys --from-paths src/my_pkg -t build

but is there a tool that can resolve other things like buildtype which also might depend on ROS_VERSION?

You could write a very small python program to do exactly what you want. There is catkin_pkg to loop over all the packages in a workspace, parse the package xml and evaluate_conditions().