summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc12
-rw-r--r--NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc34
-rw-r--r--NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc18
-rw-r--r--NativeLauncher/tool/tac_installer.cc34
4 files changed, 66 insertions, 32 deletions
diff --git a/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc b/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc
index 0cff386..973a806 100644
--- a/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc
+++ b/NativeLauncher/installer-plugin/dotnet_apptype_plugin.cc
@@ -30,16 +30,20 @@
typedef struct _xmlDoc xmlDoc;
typedef xmlDoc* xmlDocPtr;
-static bool pluginInstalled = false;
+static std::string prevInstallPkgId = std::string("");
extern "C" int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr doc, const char* pkgId)
{
+ if (pkgId == NULL) {
+ return 0;
+ }
+
// Can be multiple apps in one package
- if (pluginInstalled) {
- _INFO("Plugin already installed");
+ if (strcmp(pkgId, prevInstallPkgId.c_str()) == 0) {
+ _INFO("AppType Plugin already run for same pkgId (%s)", pkgId);
return 0;
}
- pluginInstalled = true;
+ prevInstallPkgId = pkgId;
std::string appType = getAppType(pkgId);
if (appType.empty()) {
diff --git a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc
index 739d2b4..427eb63 100644
--- a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc
+++ b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc
@@ -30,8 +30,8 @@
#endif
#define LOG_TAG "DOTNET_INSTALLER_PLUGIN"
-static bool aotPluginInstalled = false;
-static bool aotPluginFinished = false;
+static std::string prevInstallPkgId = std::string("");
+static std::string prevFinishPkgId = std::string("");
typedef struct metadata_s {
const char* key;
@@ -40,12 +40,16 @@ typedef struct metadata_s {
extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL) {
+ return 0;
+ }
+
// Can be multiple apps in one package
- if (aotPluginInstalled) {
- _INFO("AOT plugin already installed");
+ if (strcmp(pkgId, prevInstallPkgId.c_str()) == 0) {
+ _INFO("AOT Plugin already run for same pkgId (%s)", pkgId);
return 0;
}
- aotPluginInstalled = true;
+ prevInstallPkgId = pkgId;
int skipOpt = false;
if (!pkgmgr_installer_info_get_skip_optimization(&skipOpt)) {
@@ -109,12 +113,16 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char *pkgId, const char *app
extern "C" int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL) {
+ return 0;
+ }
+
// Can be multiple apps in one package
- if (aotPluginFinished) {
- _INFO("AOT plugin already finished(CLEAN)");
+ if (strcmp(pkgId, prevFinishPkgId.c_str()) == 0) {
+ _INFO("AOT Plugin(CLEAN) already run for same pkgId (%s)", pkgId);
return 0;
}
- aotPluginFinished = true;
+ prevFinishPkgId = pkgId;
finalizeNICommon();
return 0;
@@ -122,12 +130,16 @@ extern "C" int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char *pkgId, const char *appId
extern "C" int PKGMGR_MDPARSER_PLUGIN_UNDO(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL) {
+ return 0;
+ }
+
// Can be multiple apps in one package
- if (aotPluginFinished) {
- _INFO("AOT plugin already finished(UNDO)");
+ if (strcmp(pkgId, prevFinishPkgId.c_str()) == 0) {
+ _INFO("AOT Plugin(UNDO) already run for same pkgId (%s)", pkgId);
return 0;
}
- aotPluginFinished = true;
+ prevFinishPkgId = pkgId;
finalizeNICommon();
return 0;
diff --git a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc
index 9cdc9a8..ab93bce 100644
--- a/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc
+++ b/NativeLauncher/installer-plugin/prefer_nuget_cache_plugin.cc
@@ -26,30 +26,48 @@
extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL || appId == NULL) {
+ return 0;
+ }
return tacInstall(std::string(pkgId), TAC_STATE_INSTALL);
}
extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL || appId == NULL) {
+ return 0;
+ }
return tacUpgrade(std::string(pkgId), TAC_STATE_UPGRADE);
}
extern "C" int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL || appId == NULL) {
+ return 0;
+ }
return tacUninstall(std::string(pkgId), TAC_STATE_UNINSTALL);
}
extern "C" int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL || appId == NULL) {
+ return 0;
+ }
return tacRemoved(std::string(pkgId));
}
extern "C" int PKGMGR_MDPARSER_PLUGIN_UNDO(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL || appId == NULL) {
+ return 0;
+ }
return tacUndo(std::string(pkgId));
}
extern "C" int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char *pkgId, const char *appId, GList *list)
{
+ if (pkgId == NULL || appId == NULL) {
+ return 0;
+ }
return tacClean(std::string(pkgId));
}
diff --git a/NativeLauncher/tool/tac_installer.cc b/NativeLauncher/tool/tac_installer.cc
index 9644e08..88d7953 100644
--- a/NativeLauncher/tool/tac_installer.cc
+++ b/NativeLauncher/tool/tac_installer.cc
@@ -48,8 +48,8 @@ static std::vector<std::string> createLibraries;
static std::vector<std::string> updateTac;
static std::vector<std::string> updateTlc;
static tac_state tacState = TAC_STATE_NONE;
-static bool tacPluginInstalled = false;
-static bool tacPluginFinished = false;
+static std::string prevInstallPkgId = std::string("");
+static std::string prevFinishPkgId = std::string("");
static void createSHA256Info(std::string sha256Info, std::string nugetPackage)
{
@@ -379,11 +379,11 @@ int tacInstall(const std::string& pkgId, tac_state state, bool tacForce)
_INFO("PackageID : %s", pkgId.c_str());
// Can be multiple apps in one package
- if (tacPluginInstalled) {
- _INFO("TAC plugin already installed");
+ if (strcmp(pkgId.c_str(), prevInstallPkgId.c_str()) == 0) {
+ _INFO("TAC Plugin(INSTALL) already run for same pkgId (%s)", pkgId.c_str());
return 0;
}
- tacPluginInstalled = true;
+ prevInstallPkgId = pkgId;
std::string appType = getAppType(pkgId);
if (strstr(appType.c_str(), "dotnet") == NULL) {
@@ -441,11 +441,11 @@ int tacUpgrade(const std::string& pkgId, tac_state state, bool tacForce)
_INFO("PackageID : %s", pkgId.c_str());
// Can be multiple apps in one package
- if (tacPluginInstalled) {
- _INFO("TAC plugin already upgraded");
+ if (strcmp(pkgId.c_str(), prevInstallPkgId.c_str()) == 0) {
+ _INFO("TAC Plugin(UPGRADE) already run for same pkgId (%s)", pkgId.c_str());
return 0;
}
- tacPluginInstalled = true;
+ prevInstallPkgId = pkgId;
std::string appType = getAppType(pkgId);
if (strstr(appType.c_str(), "dotnet") == NULL) {
@@ -540,11 +540,11 @@ int tacUninstall(const std::string& pkgId, tac_state state)
_INFO("PackageID : %s", pkgId.c_str());
// Can be multiple apps in one package
- if (tacPluginInstalled) {
- _INFO("TAC plugin already uninstalled");
+ if (strcmp(pkgId.c_str(), prevInstallPkgId.c_str()) == 0) {
+ _INFO("TAC Plugin(UNINSTALL) already run for same pkgId (%s)", pkgId.c_str());
return 0;
}
- tacPluginInstalled = true;
+ prevInstallPkgId = pkgId;
tacState= state;
if (tac_openDB() != 0) {
@@ -652,11 +652,11 @@ int tacUndo(const std::string& pkgId)
_INFO("PackageID : %s", pkgId.c_str());
// Can be multiple apps in one package
- if (tacPluginFinished) {
- _INFO("TAC plugin already finished(UNDO)");
+ if (strcmp(pkgId.c_str(), prevFinishPkgId.c_str()) == 0) {
+ _INFO("TAC Plugin(UNDO) already run for same pkgId (%s)", pkgId.c_str());
return 0;
}
- tacPluginFinished = true;
+ prevFinishPkgId = pkgId;
if (tacState == TAC_STATE_INSTALL) {
install_Undo();
@@ -802,11 +802,11 @@ int tacClean(const std::string& pkgId)
_INFO("PackageID : %s", pkgId.c_str());
// Can be multiple apps in one package
- if (tacPluginFinished) {
- _INFO("TAC plugin already finished(CLEAN)");
+ if (strcmp(pkgId.c_str(), prevFinishPkgId.c_str()) == 0) {
+ _INFO("TAC Plugin(CLEAN) already run for same pkgId (%s)", pkgId.c_str());
return 0;
}
- tacPluginFinished = true;
+ prevFinishPkgId = pkgId;
if (tacState == TAC_STATE_INSTALL) {
install_Clean();