summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2017-08-28 15:04:12 -0500
committerYifan Hong2017-08-28 15:10:38 -0500
commitbfbbdeac0982c3c3851075fe000fe626a2bb54bf (patch)
tree757ed780f286d54e63fabe5338fc7e7495795fc0
parent8410997ba0eeae782739ddd6921fea1d73ede13e (diff)
downloadplatform-system-libvintf-bfbbdeac0982c3c3851075fe000fe626a2bb54bf.tar.gz
platform-system-libvintf-bfbbdeac0982c3c3851075fe000fe626a2bb54bf.tar.xz
platform-system-libvintf-bfbbdeac0982c3c3851075fe000fe626a2bb54bf.zip
assemble_vintf: do not allow duplicated --kernel version.
For example, assemble_vintf ... --kernel=3.18... --kernel=3.18... is not allowed. Test: pass Bug: 64124223 Change-Id: I339eec86f5ec6881ab0a2273d4e5e62b183e2333
-rw-r--r--assemble_vintf.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/assemble_vintf.cpp b/assemble_vintf.cpp
index 3218d1d..974c7fc 100644
--- a/assemble_vintf.cpp
+++ b/assemble_vintf.cpp
@@ -238,7 +238,8 @@ class AssembleVintf {
238 return false; 238 return false;
239 } 239 }
240 for (ConditionedConfig& conditionedConfig : conditionedConfigs) { 240 for (ConditionedConfig& conditionedConfig : conditionedConfigs) {
241 MatrixKernel kernel(KernelVersion{pair.first}, std::move(conditionedConfig.second)); 241 MatrixKernel kernel(KernelVersion{pair.first.majorVer, pair.first.minorVer, 0u},
242 std::move(conditionedConfig.second));
242 if (conditionedConfig.first != nullptr) 243 if (conditionedConfig.first != nullptr)
243 kernel.mConditions.push_back(std::move(*conditionedConfig.first)); 244 kernel.mConditions.push_back(std::move(*conditionedConfig.first));
244 matrix->framework.mKernels.push_back(std::move(kernel)); 245 matrix->framework.mKernels.push_back(std::move(kernel));
@@ -389,7 +390,11 @@ class AssembleVintf {
389 std::cerr << "Unrecognized kernel version '" << kernelVerStr << "'" << std::endl; 390 std::cerr << "Unrecognized kernel version '" << kernelVerStr << "'" << std::endl;
390 return false; 391 return false;
391 } 392 }
392 mKernels.push_back({{kernelVer.majorVer, kernelVer.minorVer, 0u}, kernelConfigPath}); 393 if (mKernels.find(kernelVer) != mKernels.end()) {
394 std::cerr << "Multiple --kernel for " << kernelVer << " is specified." << std::endl;
395 return false;
396 }
397 mKernels[kernelVer] = kernelConfigPath;
393 return true; 398 return true;
394 } 399 }
395 400
@@ -399,7 +404,7 @@ class AssembleVintf {
399 std::unique_ptr<std::ofstream> mOutFileRef; 404 std::unique_ptr<std::ofstream> mOutFileRef;
400 std::ifstream mCheckFile; 405 std::ifstream mCheckFile;
401 bool mOutputMatrix = false; 406 bool mOutputMatrix = false;
402 std::vector<std::pair<KernelVersion, std::string>> mKernels; 407 std::map<Version, std::string> mKernels;
403}; 408};
404 409
405} // namespace vintf 410} // namespace vintf