summaryrefslogtreecommitdiff
path: root/src/application-lib
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@pelagicore.com>2019-07-26 12:33:27 +0200
committerRobert Griebl <robert.griebl@pelagicore.com>2019-08-02 14:57:33 +0200
commit5b0c0787c975e27d87111754f98255c1a1dfff32 (patch)
tree255b634e32eab223e8f33d6e5f32bb5b023b9f71 /src/application-lib
parent3c28fe19b6419fdb1f5a91670b5bd222fa3a619c (diff)
downloadqtapplicationmanager-5b0c0787c975e27d87111754f98255c1a1dfff32.tar.gz
Remove support for multiple installation locations
We had removed support for SD-Card (removable location) installations in a previous patch. Supporting multiple non-removable locations adds a lot of complexity to the AM's installer that isn't really needed, since modern Linux kernels can support these niche use-cases much more transparently through the device mapper/lvm infrastructure. Change-Id: Iaf10d2eb28b9d61e54c5268bcbdd623005b8508d Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Diffstat (limited to 'src/application-lib')
-rw-r--r--src/application-lib/applicationinfo.cpp3
-rw-r--r--src/application-lib/installationreport.cpp16
-rw-r--r--src/application-lib/installationreport.h4
-rw-r--r--src/application-lib/packagedatabase.cpp20
-rw-r--r--src/application-lib/packagedatabase.h8
5 files changed, 21 insertions, 30 deletions
diff --git a/src/application-lib/applicationinfo.cpp b/src/application-lib/applicationinfo.cpp
index c714e86d..33421f6b 100644
--- a/src/application-lib/applicationinfo.cpp
+++ b/src/application-lib/applicationinfo.cpp
@@ -158,8 +158,7 @@ QVariantMap ApplicationInfo::toVariantMap() const
map[qSL("baseDir")] = packageInfo()->baseDir().absolutePath();
map[qSL("codeDir")] = map[qSL("baseDir")]; // 5.12 backward compatibility
map[qSL("manifestDir")] = map[qSL("baseDir")]; // 5.12 backward compatibility
- map[qSL("installationLocationId")] = packageInfo()->installationReport()
- ? packageInfo()->installationReport()->installationLocationId() : QString();
+ map[qSL("installationLocationId")] = packageInfo()->installationReport() ? qSL("internal-0") : QString();
map[qSL("supportsApplicationInterface")] = m_supportsApplicationInterface;
map[qSL("dlt")] = packageInfo()->dltConfiguration();
diff --git a/src/application-lib/installationreport.cpp b/src/application-lib/installationreport.cpp
index ba59888a..2ef2678b 100644
--- a/src/application-lib/installationreport.cpp
+++ b/src/application-lib/installationreport.cpp
@@ -83,16 +83,6 @@ void InstallationReport::setPackageId(const QString &packageId)
m_packageId = packageId;
}
-QString InstallationReport::installationLocationId() const
-{
- return m_installationLocationId;
-}
-
-void InstallationReport::setInstallationLocationId(const QString &installationLocationId)
-{
- m_installationLocationId = installationLocationId;
-}
-
QVariantMap InstallationReport::extraMetaData() const
{
return m_extraMetaData;
@@ -188,7 +178,7 @@ bool InstallationReport::deserialize(QIODevice *from)
return false;
try {
- checkYamlFormat(docs, 3 /*number of expected docs*/, { "am-installation-report" }, 2 /*version*/);
+ checkYamlFormat(docs, 3 /*number of expected docs*/, { "am-installation-report" }, 3 /*version*/);
} catch (const Exception &) {
return false;
}
@@ -204,7 +194,6 @@ bool InstallationReport::deserialize(QIODevice *from)
throw false;
}
- m_installationLocationId = root[qSL("installationLocationId")].toString();
m_diskSpaceUsed = root[qSL("diskSpaceUsed")].toULongLong();
m_digest = QByteArray::fromHex(root[qSL("digest")].toString().toLatin1());
if (m_digest.isEmpty())
@@ -265,12 +254,11 @@ bool InstallationReport::serialize(QIODevice *to) const
return false;
QVariantMap header {
- { "formatVersion", 2 },
+ { "formatVersion", 3 },
{ "formatType", "am-installation-report" }
};
QVariantMap root {
{ qSL("packageId"), packageId() },
- { qSL("installationLocationId"), installationLocationId() },
{ qSL("diskSpaceUsed"), diskSpaceUsed() },
{ qSL("digest"), QLatin1String(digest().toHex()) }
};
diff --git a/src/application-lib/installationreport.h b/src/application-lib/installationreport.h
index 3140f35b..d924fec1 100644
--- a/src/application-lib/installationreport.h
+++ b/src/application-lib/installationreport.h
@@ -60,9 +60,6 @@ public:
QString packageId() const;
void setPackageId(const QString &packageId);
- QString installationLocationId() const;
- void setInstallationLocationId(const QString &installationLocationId);
-
QVariantMap extraMetaData() const;
void setExtraMetaData(const QVariantMap &extraMetaData);
QVariantMap extraSignedMetaData() const;
@@ -91,7 +88,6 @@ public:
private:
QString m_packageId;
- QString m_installationLocationId;
QByteArray m_digest;
quint64 m_diskSpaceUsed = 0;
QStringList m_files;
diff --git a/src/application-lib/packagedatabase.cpp b/src/application-lib/packagedatabase.cpp
index 6ca32e1c..2b49a7db 100644
--- a/src/application-lib/packagedatabase.cpp
+++ b/src/application-lib/packagedatabase.cpp
@@ -53,10 +53,10 @@
QT_BEGIN_NAMESPACE_AM
-PackageDatabase::PackageDatabase(const QStringList &builtInAppsDirs,
- const QString &installedAppsDir)
- : m_builtInAppsDirs(builtInAppsDirs)
- , m_installedAppsDir(installedAppsDir)
+PackageDatabase::PackageDatabase(const QStringList &builtInPackagesDirs,
+ const QString &installedPackagesDir)
+ : m_builtInPackagesDirs(builtInPackagesDirs)
+ , m_installedPackagesDir(installedPackagesDir)
{ }
PackageDatabase::PackageDatabase(const QString &singlePackagePath)
@@ -65,6 +65,11 @@ PackageDatabase::PackageDatabase(const QString &singlePackagePath)
Q_ASSERT(!singlePackagePath.isEmpty());
}
+QString PackageDatabase::installedPackagesDir() const
+{
+ return m_installedPackagesDir;
+}
+
void PackageDatabase::enableLoadFromCache()
{
if (m_parsed)
@@ -151,6 +156,7 @@ QMap<PackageInfo *, QString> PackageDatabase::loadManifestsFromDir(YamlPackageSc
throw Exception(f, "failed to deserialize the installation report");
pkg->setInstallationReport(report.take());
+ pkg->setBaseDir(QDir(m_installedPackagesDir).filePath(pkg->id()));
}
result.insert(pkg.take(), manifestPath);
} catch (const Exception &e) {
@@ -191,11 +197,11 @@ void PackageDatabase::parse()
throw Exception("Failed to load manifest for package: %1").arg(e.errorString());
}
} else {
- for (const QString &dir : m_builtInAppsDirs)
+ for (const QString &dir : m_builtInPackagesDirs)
m_builtInPackages.unite(loadManifestsFromDir(&yps, dir, true));
- if (!m_installedAppsDir.isEmpty())
- m_installedPackages = loadManifestsFromDir(&yps, m_installedAppsDir, false);
+ if (!m_installedPackagesDir.isEmpty())
+ m_installedPackages = loadManifestsFromDir(&yps, m_installedPackagesDir, false);
}
if (m_saveToCache)
diff --git a/src/application-lib/packagedatabase.h b/src/application-lib/packagedatabase.h
index 2aaced4d..8669acce 100644
--- a/src/application-lib/packagedatabase.h
+++ b/src/application-lib/packagedatabase.h
@@ -56,9 +56,11 @@ class YamlPackageScanner;
class PackageDatabase
{
public:
- PackageDatabase(const QStringList &builtInAppsDirs, const QString &installedAppsDir = QString());
+ PackageDatabase(const QStringList &builtInPackagesDirs, const QString &installedPackagesDir = QString());
PackageDatabase(const QString &singlePackagePath);
+ QString installedPackagesDir() const;
+
void enableLoadFromCache();
void enableSaveToCache();
@@ -82,8 +84,8 @@ private:
bool m_loadFromCache = false;
bool m_saveToCache = false;
bool m_parsed = false;
- QStringList m_builtInAppsDirs;
- QString m_installedAppsDir;
+ QStringList m_builtInPackagesDirs;
+ QString m_installedPackagesDir;
QString m_singlePackagePath;
QMap<PackageInfo *, QString> m_builtInPackages;