private void maybeValidateRepository(RebuildContext context) throws MojoExecutionException {
if (doNotValidate) {
return;
}
getLog().info("Validating downloaded repository...");
LocalYumRepoFacade localYumRepo = context.getLocalYumRepo();
if (!localYumRepo.isRepoDataExists()) {
throw new MojoExecutionException("Repository does not exist!");
}
// list of files (repo-relative paths)
List<String> fileList = localYumRepo.parseFileListFromRepoMetadata();
for (String repoRelativePath : fileList) {
if (!context.getExcludedFiles().contains(repoRelativePath)
&& !localYumRepo.hasFile(repoRelativePath)) {
// repository metadata declared a (non-excluded) file that did not exist.
throw new MojoExecutionException("Repository metadata declared file " + repoRelativePath + " but the file did not exist.");
}
}
}