Gauge and gravitational anomalies in D = 4 N = 1 orientifolds