| 99 | } |
| 100 | |
| 101 | static ComponentPtr componentFromJsonV1(PackProfile * parent, const QString & componentJsonPattern, const QJsonObject &obj) |
| 102 | { |
| 103 | // critical |
| 104 | auto uid = Json::requireValueString(obj.value("uid")); |
| 105 | auto filePath = componentJsonPattern.arg(uid); |
| 106 | auto component = new Component(parent, uid); |
| 107 | component->m_version = Json::ensureValueString(obj.value("version")); |
| 108 | component->m_dependencyOnly = Json::ensureValueBoolean(obj.value("dependencyOnly"), false); |
| 109 | component->m_important = Json::ensureValueBoolean(obj.value("important"), false); |
| 110 | |
| 111 | // cached |
| 112 | // TODO @RESILIENCE: ignore invalid values/structure here? |
| 113 | component->m_cachedVersion = Json::ensureValueString(obj.value("cachedVersion")); |
| 114 | component->m_cachedName = Json::ensureValueString(obj.value("cachedName")); |
| 115 | Meta::parseRequires(obj, &component->m_cachedRequires, "cachedRequires"); |
| 116 | Meta::parseRequires(obj, &component->m_cachedConflicts, "cachedConflicts"); |
| 117 | component->m_cachedVolatile = Json::ensureValueBoolean(obj.value("volatile"), false); |
| 118 | bool disabled = Json::ensureValueBoolean(obj.value("disabled"), false); |
| 119 | component->setEnabled(!disabled); |
| 120 | return component; |
| 121 | } |
| 122 | |
| 123 | // Save the given component container data to a file |
| 124 | static bool savePackProfile(const QString & filename, const ComponentContainer & container) |
no test coverage detected