On the Gauge structure of the calculus of variations with constraints