Conditional expectations and weak and strong compactness in spaces of Bochner integrable functions