-bool metadataCheck(GList *list)
-{
- GList *tag = NULL;
- Metadata *mdInfo = NULL;
- tag = g_list_first(list);
- mdInfo = (Metadata*)tag->data;
- if (strcmp(mdInfo->key, TAC_METADATA_KEY) == 0 && strcmp(mdInfo->value, METADATA_VALUE) == 0) {
- _DBG("Prefer nuget cache set TRUE");
- if (initializePluginManager("normal")) {
- _ERR("Fail to initialize PluginManager");
- return false;
- }
- if (initializePathManager(std::string(), std::string(), std::string())) {
- _ERR("Fail to initialize PathManger");
- return false;
- }
- return true;
- }
- return false;
-}
-
-bool appTypeCheck(std::string pkgId)
-{
- uid_t uid = 0;
- if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
- _ERR("Failed to get UID");
- return false;
- }
-
- pkgmgrinfo_pkginfo_h handle;
- int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId.c_str(), uid, &handle);
- if (ret != PMINFO_R_OK) {
- _ERR("Failed to get pkg info");
- return false;
- }
-
- bool isDotnetAppType = false;
- auto dotnetAppCounter = [] (pkgmgrinfo_appinfo_h handle, void *userData) -> int {
- char* type = nullptr;
- bool* dotnet = static_cast<bool*>(userData);
- if (pkgmgrinfo_appinfo_get_apptype(handle, &type) != PMINFO_R_OK) {
- _ERR("Failed to get app type : %s", type);
- return -1;
- }
- if (strcmp(type, "dotnet") == 0) {
- *dotnet = true;
- }
- return 0;
- };
-
- if (pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_ALL_APP, dotnetAppCounter, &isDotnetAppType, uid) != PMINFO_R_OK) {
- _ERR("Failed to get list of app in pkg : %s", pkgId.c_str());
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return false;
- }
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return isDotnetAppType;
-}
-
-void SHA256(std::string path, char outputBuffer[65])
-{
- FILE *file = fopen(path.c_str(), "rb");
- if (!file) {
- return;
- }
-
- unsigned char hash[SHA256_DIGEST_LENGTH];
- SHA256_CTX sha256;
- SHA256_Init(&sha256);
- int bytesRead = 0;
- const int bufSize = 32768;
- char *buffer = (char*)malloc(bufSize);
- if (!buffer) {
- fclose(file);
- return;
- }
-
- while ((bytesRead = fread(buffer, 1, bufSize, file))) {
- SHA256_Update(&sha256, buffer, bytesRead);
- }
- SHA256_Final(hash, &sha256);
- for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) {
- snprintf(outputBuffer + (i * 2), 3, "%02x", hash[i]);
- }
- outputBuffer[64] = 0;
-
- fclose(file);
- free(buffer);
-}
-
-void createSHA256Info(std::string sha256Info, std::string nugetPackage)