Use more flexible repo_open_ext; introduce flag generator.