Fluxes and branes in type II vacua and M-theory geometry with G2 and spin(7) holonomy