diff --git a/cmake.changes b/cmake.changes index bfad22e..be9d6c8 100644 --- a/cmake.changes +++ b/cmake.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Nov 15 08:23:14 UTC 2016 - alarrosa@suse.com + +- Fix cmake.prov to report all cmake Config modules provided in a single + cmake directory instead of just returning the first one given by a + shell glob (which could be different across builds). Also, include + upper and lowercase files always instead of including lowercase files + only when no uppercase files were found. + ------------------------------------------------------------------- Sun Sep 25 00:21:58 UTC 2016 - jimmy@boombatower.com diff --git a/cmake.prov b/cmake.prov index 792e88c..eb7850c 100644 --- a/cmake.prov +++ b/cmake.prov @@ -31,35 +31,30 @@ class CMakeParser: paths = map(lambda x: x.rstrip(), filelist.readlines()) for path in paths: - modulePath, cmakeModule, lowercase = self.parseCmakeModuleConfig(path) - if modulePath and cmakeModule: - version = self.resolveCMakeModuleVersion(modulePath, cmakeModule, lowercase) - + for (modulePath, cmakeModule, lowercase) in self.parseCmakeModuleConfig(path): + version = self.resolveCMakeModuleVersion(modulePath, cmakeModule, lowercase) + if version: - print("cmake(%s) = %s" % (cmakeModule, version)) + print("cmake(%s) = %s" % (cmakeModule, version)) else: - print("cmake(%s)" % cmakeModule) - + print("cmake(%s)" % cmakeModule) def parseCmakeModuleConfig(self, configFile): paths = configFile.rsplit("/", 3) modulePath = "%s/cmake/%s" % (paths[0], paths[2]) - lowercase = False - configFile = glob.glob("%s/*Config.cmake" % modulePath) - if not configFile: - configFile = glob.glob("%s/*-config.cmake" % modulePath) - lowercase = True - if not configFile: - return (None, None) + result = [] + for configFile in glob.glob("%s/*Config.cmake" % modulePath): + moduleName = configFile[len(modulePath) + 1:-len("Config.cmake")] + result.append( (modulePath, moduleName, False) ) - if lowercase: - moduleName = configFile[0][len(modulePath) + 1:-len("-config.cmake")] - else: - moduleName = configFile[0][len(modulePath) + 1:-len("Config.cmake")] + for configFile in glob.glob("%s/*-config.cmake" % modulePath): + moduleName = configFile[len(modulePath) + 1:-len("-config.cmake")] + if (modulePath, moduleName, False) not in result: + result.append( (modulePath, moduleName, True) ) - return (modulePath, moduleName, lowercase) + return result def resolveCMakeModuleVersion(self, modulePath, cmakeModule, lowercase): versionFile = ("%s/%s-config-version.cmake" if lowercase else "%s/%sConfigVersion.cmake") % (modulePath, cmakeModule)