diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-11-23 17:23:26 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-01-06 11:26:29 +0200 |
commit | 403e610e6b867dc840c4e78a344cac52bbe751c2 (patch) | |
tree | 746f263da474c1603ce14820d164cd37c97e95bc /src/libs/kdtools | |
parent | 8985801a4e61fad34914ed04480d0240ece53c15 (diff) |
Add support for moving child components with <TreeName>
Add new optional "moveChildren" attribute to <TreeName> element.
Children of components declaring "moveChildren=true" attribute are
calculated a value for an automatic tree name element.
Multiple components in a single tree branch can declare a
tree name, the order which the relocation happens is from leaf
components to root components.
Components may be moved under another tree name target.
Components may be moved to an existing identifier part that
does not have a component, for example in the following
repository structure:
rootA.childA
rootB
rootB.childB
the "rootB" component can legally declare a "rootA" tree name.
The tree names of components become static after installed. If
a repository declares a new tree name for a component that is
installed, it is only applied after updating in maintenance tool.
Child components, which have an automatic tree name, are moved if
the parent component is updated with a new tree name, however.
Task-number: QTIFW-2380
Change-Id: I9c44a114d3c1248b7e2dd4f0b5cda0739af102f3
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs/kdtools')
-rw-r--r-- | src/libs/kdtools/localpackagehub.cpp | 12 | ||||
-rw-r--r-- | src/libs/kdtools/localpackagehub.h | 4 | ||||
-rw-r--r-- | src/libs/kdtools/updatesinfo.cpp | 4 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/libs/kdtools/localpackagehub.cpp b/src/libs/kdtools/localpackagehub.cpp index d709acb54..353d3f4dd 100644 --- a/src/libs/kdtools/localpackagehub.cpp +++ b/src/libs/kdtools/localpackagehub.cpp @@ -319,7 +319,7 @@ void LocalPackageHub::refresh() void LocalPackageHub::addPackage(const QString &name, const QString &version, const QString &title, - const QString &treeName, + const QPair<QString, bool> &treeName, const QString &description, const QStringList &dependencies, const QStringList &autoDependencies, @@ -404,7 +404,8 @@ void LocalPackageHub::writeToDisk() addTextChildHelper(&package, QLatin1String("Name"), info.name); addTextChildHelper(&package, QLatin1String("Title"), info.title); addTextChildHelper(&package, QLatin1String("Description"), info.description); - addTextChildHelper(&package, scTreeName, info.treeName); + addTextChildHelper(&package, scTreeName, info.treeName.first, QLatin1String("moveChildren"), + QVariant(info.treeName.second).toString()); if (info.inheritVersionFrom.isEmpty()) addTextChildHelper(&package, QLatin1String("Version"), info.version); else @@ -477,9 +478,10 @@ void LocalPackageHub::PackagesInfoData::addPackageFrom(const QDomElement &packag info.title = childNodeE.text(); else if (childNodeE.tagName() == QLatin1String("Description")) info.description = childNodeE.text(); - else if (childNodeE.tagName() == scTreeName) - info.treeName = childNodeE.text(); - else if (childNodeE.tagName() == QLatin1String("Version")) { + else if (childNodeE.tagName() == scTreeName) { + info.treeName.first = childNodeE.text(); + info.treeName.second = QVariant(childNodeE.attribute(QLatin1String("moveChildren"))).toBool(); + } else if (childNodeE.tagName() == QLatin1String("Version")) { info.version = childNodeE.text(); info.inheritVersionFrom = childNodeE.attribute(QLatin1String("inheritVersionFrom")); } diff --git a/src/libs/kdtools/localpackagehub.h b/src/libs/kdtools/localpackagehub.h index 648d6cf6e..b544ddfb6 100644 --- a/src/libs/kdtools/localpackagehub.h +++ b/src/libs/kdtools/localpackagehub.h @@ -43,7 +43,7 @@ struct KDTOOLS_EXPORT LocalPackage QString name; QString title; QString description; - QString treeName; + QPair<QString, bool> treeName; QString version; QString inheritVersionFrom; QStringList dependencies; @@ -100,7 +100,7 @@ public: void addPackage(const QString &pkgName, const QString &version, // mandatory const QString &title, - const QString &treeName, + const QPair<QString, bool> &treeName, const QString &description, const QStringList &dependencies, const QStringList &autoDependencies, diff --git a/src/libs/kdtools/updatesinfo.cpp b/src/libs/kdtools/updatesinfo.cpp index eaa9b039e..545931a55 100644 --- a/src/libs/kdtools/updatesinfo.cpp +++ b/src/libs/kdtools/updatesinfo.cpp @@ -140,6 +140,10 @@ bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE) } if (!licenseHash.isEmpty()) info.data.insert(QLatin1String("Licenses"), licenseHash); + } else if (childE.tagName() == QLatin1String("TreeName")) { + const bool moveChildren = QVariant(childE.attribute(QLatin1String("moveChildren"))).toBool(); + const QPair<QString, bool> treeNamePair(childE.text(), moveChildren); + info.data.insert(QLatin1String("TreeName"), QVariant::fromValue(treeNamePair)); } else if (childE.tagName() == QLatin1String("Version")) { info.data.insert(QLatin1String("inheritVersionFrom"), childE.attribute(QLatin1String("inheritVersionFrom"))); |