| 127 | } |
| 128 | |
| 129 | static ComponentPtr componentFromJsonV1(PackProfile * parent, const QString & componentJsonPattern, const QJsonObject &obj) |
| 130 | { |
| 131 | // critical |
| 132 | auto uid = Json::requireString(obj.value("uid")); |
| 133 | auto filePath = componentJsonPattern.arg(uid); |
| 134 | auto component = new Component(parent, uid); |
| 135 | component->m_version = Json::ensureString(obj.value("version")); |
| 136 | component->m_dependencyOnly = Json::ensureBoolean(obj.value("dependencyOnly"), false); |
| 137 | component->m_important = Json::ensureBoolean(obj.value("important"), false); |
| 138 | |
| 139 | // cached |
| 140 | // TODO @RESILIENCE: ignore invalid values/structure here? |
| 141 | component->m_cachedVersion = Json::ensureString(obj.value("cachedVersion")); |
| 142 | component->m_cachedName = Json::ensureString(obj.value("cachedName")); |
| 143 | Meta::parseRequires(obj, &component->m_cachedRequires, "cachedRequires"); |
| 144 | Meta::parseRequires(obj, &component->m_cachedConflicts, "cachedConflicts"); |
| 145 | component->m_cachedVolatile = Json::ensureBoolean(obj.value("volatile"), false); |
| 146 | bool disabled = Json::ensureBoolean(obj.value("disabled"), false); |
| 147 | component->setEnabled(!disabled); |
| 148 | return component; |
| 149 | } |
| 150 | |
| 151 | // Save the given component container data to a file |
| 152 | static bool savePackProfile(const QString & filename, const ComponentContainer & container) |
no test coverage detected