ensure required build/cache dirs exist and have the correct owner