summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'HalManifest.cpp')
-rw-r--r--HalManifest.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/HalManifest.cpp b/HalManifest.cpp
index 6f05cab..454e0fc 100644
--- a/HalManifest.cpp
+++ b/HalManifest.cpp
@@ -184,20 +184,19 @@ bool HalManifest::hasInstance(const std::string& halName, const Version& version
184 return instances.find(instanceName) != instances.end(); 184 return instances.find(instanceName) != instances.end();
185} 185}
186 186
187void HalManifest::forEachInstance( 187bool HalManifest::forEachInstanceOfVersion(
188 const std::function<void(const std::string&, const Version&, const std::string&, 188 const std::string& package, const Version& expectVersion,
189 const std::string&, bool*)>& f) const { 189 const std::function<bool(const ManifestInstance&)>& func) const {
190 bool stop = false; 190 for (const ManifestHal* hal : getHals(package)) {
191 for (const auto& hal : getHals()) { 191 bool cont = hal->forEachInstance([&](const ManifestInstance& manifestInstance) {
192 for (const auto& v : hal.versions) { 192 if (manifestInstance.version().minorAtLeast(expectVersion)) {
193 for (const auto& intf : iterateValues(hal.interfaces)) { 193 return func(manifestInstance);
194 for (const auto& instance : intf.instances) {
195 f(hal.name, v, intf.name, instance, &stop);
196 if (stop) break;
197 }
198 } 194 }
199 } 195 return true;
196 });
197 if (!cont) return false;
200 } 198 }
199 return true;
201} 200}
202 201
203static bool satisfyVersion(const MatrixHal& matrixHal, const Version& manifestHalVersion) { 202static bool satisfyVersion(const MatrixHal& matrixHal, const Version& manifestHalVersion) {
@@ -381,7 +380,12 @@ bool HalManifest::checkCompatibility(const CompatibilityMatrix &mat, std::string
381 auto incompatibleHals = checkIncompatibleHals(mat); 380 auto incompatibleHals = checkIncompatibleHals(mat);
382 if (!incompatibleHals.empty()) { 381 if (!incompatibleHals.empty()) {
383 if (error != nullptr) { 382 if (error != nullptr) {
384 *error = "HALs incompatible. The following requirements are not met:\n"; 383 *error = "HALs incompatible.";
384 if (mat.level() != Level::UNSPECIFIED)
385 *error += " Matrix level = " + to_string(mat.level()) + ".";
386 if (level() != Level::UNSPECIFIED)
387 *error += " Manifest level = " + to_string(level()) + ".";
388 *error += " The following requirements are not met:\n";
385 for (const auto& e : incompatibleHals) { 389 for (const auto& e : incompatibleHals) {
386 *error += e + "\n"; 390 *error += e + "\n";
387 } 391 }