# Compiler flags
SET(EXTRA_FLAGS "-Wall -Wextra")
SET(CMAKE_C_FLAGS_PROFILING "-O2 ${EXTRA_FLAGS}")
-SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++14 ${EXTRA_FLAGS}")
+SET(CMAKE_CXX_FLAGS_PROFILING "-O2 -std=c++17 ${EXTRA_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g ${EXTRA_FLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++14 -g ${EXTRA_FLAGS}")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -std=c++17 -g ${EXTRA_FLAGS}")
SET(CMAKE_C_FLAGS_RELEASE "-O2 -g ${EXTRA_FLAGS}")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++14 -g ${EXTRA_FLAGS}")
-SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++14 -g --coverage ${EXTRA_FLAGS}")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++17 -g ${EXTRA_FLAGS}")
+SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++17 -g --coverage ${EXTRA_FLAGS}")
# Linker flags
SET(EXTRA_LINKER_FLAGS "-Wl,--as-needed")
PKG_CHECK_MODULES(GUM_DEPS REQUIRED libgum)
PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock)
-FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem regex program_options)
-
ADD_SUBDIRECTORY(data)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)
Source1002: wgt-installer-tests.manifest
Requires: wgt-installer = %{version}
-BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: app-installers-tests
BuildRequires: pkgconfig(app-installers)
# Target - deps
APPLY_PKG_CONFIG(${TARGET_LIBNAME_HYBRID} PUBLIC
TPK_INSTALLER_DEPS
- Boost
)
# Target - in-package deps
#include "hybrid/step/pkgmgr/step_merge_xml.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
-
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <common/utils/file_util.h>
#include <common/utils/glist_range.h>
+#include <algorithm>
+#include <filesystem>
#include <utility>
#include <string>
#include <vector>
#include "hybrid/hybrid_backend_data.h"
namespace ci = common_installer;
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
namespace {
namespace hybrid {
namespace pkgmgr {
-xmlDocPtr StepMergeXml::LoadXmlDocument(const bf::path& xml_path) {
+xmlDocPtr StepMergeXml::LoadXmlDocument(const fs::path& xml_path) {
// trim blanks
int keep_blanks = xmlKeepBlanksDefault(0);
- xmlDocPtr doc_ptr = xmlParseFile(xml_path.string().c_str());
+ xmlDocPtr doc_ptr = xmlParseFile(xml_path.c_str());
if (!doc_ptr) {
LOG(ERROR) << "Failed to parse file: " << xml_path;
xmlKeepBlanksDefault(keep_blanks);
}
ci::Step::Status StepMergeXml::process() {
- bf::path wgt_xml_path = context_->xml_path.get();
- bf::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml";
+ fs::path wgt_xml_path = context_->xml_path.get();
+ fs::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml";
xmlDocPtr wgt_doc = LoadXmlDocument(wgt_xml_path);
if (wgt_doc == nullptr)
SetXmlNodeAttribute(node, "exec", app->exec);
}
- if (xmlSaveFormatFile(wgt_xml_path.string().c_str(), wgt_doc, 1) == -1) {
+ if (xmlSaveFormatFile(wgt_xml_path.c_str(), wgt_doc, 1) == -1) {
LOG(ERROR) << "Cannot write xml file";
return Step::Status::MANIFEST_ERROR;
}
if (pkgmgr_parser_check_manifest_validation(
- wgt_xml_path.string().c_str()) != 0) {
+ wgt_xml_path.c_str()) != 0) {
LOG(ERROR) << "Merged manifest is not valid";
return Step::Status::MANIFEST_ERROR;
}
}
ci::Step::Status StepMergeXml::precheck() {
- bf::path wgt_xml_path = context_->xml_path.get();
- if (!bf::exists(wgt_xml_path)) {
+ fs::path wgt_xml_path = context_->xml_path.get();
+ if (!fs::exists(wgt_xml_path)) {
LOG(ERROR) << "Converted config file not found: " << wgt_xml_path;
return Step::Status::MANIFEST_ERROR;
}
- bf::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml";
- if (!bf::exists(tpk_xml_path)) {
+ fs::path tpk_xml_path = context_->GetPkgPath() / "tizen-manifest.xml";
+ if (!fs::exists(tpk_xml_path)) {
LOG(ERROR) << "Native manifest file not found: " << tpk_xml_path;
return Step::Status::MANIFEST_ERROR;
}
#ifndef HYBRID_STEP_PKGMGR_STEP_MERGE_XML_H_
#define HYBRID_STEP_PKGMGR_STEP_MERGE_XML_H_
-#include <boost/filesystem.hpp>
-
#include <common/step/step.h>
#include <manifest_parser/utils/logging.h>
#include <libxml/tree.h>
+#include <filesystem>
#include <string>
namespace hybrid {
Status precheck() override;
private:
- xmlDocPtr LoadXmlDocument(const boost::filesystem::path& xml_path);
+ xmlDocPtr LoadXmlDocument(const std::filesystem::path& xml_path);
xmlNodePtr GetXmlNode(const xmlDocPtr doc, const std::string& name,
const std::string& attr = {}, const std::string& attr_val = {});
void MergeXmlNode(xmlNodePtr node1, xmlNodePtr node2);
MANIFEST_PARSER_DEPS
WGT_MANIFEST_HANDLERS_DEPS
VCONF_DEPS
- Boost
)
INSTALL(TARGETS ${TARGET_LIBNAME_WGT_ARCHIVE_INFO} DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/backendlib)
#include <vconf.h>
-#include <boost/filesystem/path.hpp>
-
#include <wgt_manifest_handlers/widget_config_parser.h>
#include <wgt_manifest_handlers/addon_handler.h>
#include <wgt_manifest_handlers/application_icons_handler.h>
#include <common/utils/file_util.h>
#include <cstdlib>
+#include <filesystem>
#include <fstream>
#include <string>
#include <vector>
-namespace bf = boost::filesystem;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
bool WgtArchiveInfo::ExtractPackageArchive(const std::string& file_path,
const std::string& file, const std::string& tmp_dir) {
if (!ci::ExtractToTmpDir(file_path.c_str(),
- bf::path(tmp_dir), file.c_str())) {
+ fs::path(tmp_dir), file.c_str())) {
LOG(ERROR) << "Failed to extract";
return false;
}
return true;
}
-bool WgtArchiveInfo::ReadIcon(const bf::path& icon, const bf::path& tmp_dir) {
- bf::path icon_path = tmp_dir / icon;
+bool WgtArchiveInfo::ReadIcon(const fs::path& icon, const fs::path& tmp_dir) {
+ fs::path icon_path = tmp_dir / icon;
LOG(INFO) << "Icon file path: " << icon_path;
- if (!bf::exists(icon_path)) {
+ if (!fs::exists(icon_path)) {
LOG(WARNING) << "Icon file doesn't actually exist, skip reading icon";
return true;
}
}
bool WgtArchiveInfo::LoadArchiveInfo() {
- bf::path tmp_dir = ci::GenerateTmpDir("/tmp");
+ fs::path tmp_dir = ci::GenerateTmpDir("/tmp");
if (!ci::CreateDir(tmp_dir))
return false;
LOG(DEBUG) << "Unpack at temporary dir: " << tmp_dir;
bool is_hybrid = false;
if (!ExtractPackageArchive(path_, kHybridConfigFileName, tmp_dir.string()))
return false;
- if (bf::exists(tmp_dir / kHybridConfigFileName)) {
+ if (fs::exists(tmp_dir / kHybridConfigFileName)) {
is_hybrid = true;
} else {
if (!ExtractPackageArchive(path_, kConfigFileName, tmp_dir.string()))
}
wgt::parse::WidgetConfigParser parser;
- bf::path manifest_path;
+ fs::path manifest_path;
if (is_hybrid)
manifest_path = tmp_dir / kHybridConfigFileName;
else
#ifndef LIB_WGT_ARCHIVE_INFO_H_
#define LIB_WGT_ARCHIVE_INFO_H_
-#include <boost/filesystem/path.hpp>
-
#include <common/archive_info.h>
#include <manifest_parser/utils/logging.h>
#include <wgt_manifest_handlers/widget_config_parser.h>
+#include <filesystem>
#include <string>
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
class WgtArchiveInfo : public common_installer::ArchiveInfo {
public:
bool GetAddonInfo(const wgt::parse::WidgetConfigParser& parser);
bool GetPrivilegesInfo(const wgt::parse::WidgetConfigParser& parser);
bool GetIconInfo(const wgt::parse::WidgetConfigParser& parser);
- bool ReadIcon(const bf::path& icon, const bf::path& tmp_dir);
+ bool ReadIcon(const fs::path& icon, const fs::path& tmp_dir);
bool GetLabelInfo(const wgt::parse::WidgetConfigParser& parser,
const char* locale);
bool GetDescriptionInfo(const wgt::parse::WidgetConfigParser& parser,
MANIFEST_PARSER_DEPS
PKGMGR_INSTALLER_DEPS
ENCRYPTION_DEPS
- Boost
VCONF_DEPS
)
SET_TARGET_PROPERTIES(${TARGET_LIBNAME_WGT} PROPERTIES COMPILE_FLAGS "-fPIC")
#include "wgt/step/configuration/step_check_rds_manifest.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
+#include <filesystem>
+#include <system_error>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
namespace {
namespace configuration {
common_installer::Step::Status StepCheckRDSManifest::process() {
- bf::path target = context_->unpacked_dir_path.get() / kConfigDeltaDir;
- if (!bf::exists(target)) {
- bf::path source = context_->root_application_path.get() /
+ fs::path target = context_->unpacked_dir_path.get() / kConfigDeltaDir;
+ if (!fs::exists(target)) {
+ fs::path source = context_->root_application_path.get() /
context_->pkgid.get() / kConfigInstalled;
- if (!bf::exists(source)) {
+ if (!fs::exists(source)) {
LOG(ERROR) << "Cannot find old manifest file";
return Status::APP_DIR_ERROR;
}
- bs::error_code error;
- bf::create_directories(source.parent_path(), error);
+ std::error_code error;
+ fs::create_directories(source.parent_path(), error);
if (error) {
LOG(ERROR) << "Failed to create directories for manifest file";
return Status::APP_DIR_ERROR;
}
- bf::copy_file(source, target, error);
+ fs::copy_file(source, target, error);
if (error) {
LOG(ERROR) << "Failed to copy old manifest file";
return Status::APP_DIR_ERROR;
#include "wgt/step/configuration/step_check_start_files.h"
-#include <boost/filesystem/path.hpp>
-
#include <common/installer/app_installer.h>
#include <common/installer_context.h>
#include <common/step/step.h>
#include <wgt_manifest_handlers/w3c_pc_utils.h>
#include <wgt_manifest_handlers/content_handler.h>
-namespace bf = boost::filesystem;
-
namespace wgt {
namespace configuration {
#ifndef WGT_STEP_CONFIGURATION_STEP_CHECK_START_FILES_H_
#define WGT_STEP_CONFIGURATION_STEP_CHECK_START_FILES_H_
-#include <boost/filesystem.hpp>
-
#include <common/installer/app_installer.h>
#include <common/installer_context.h>
#include <common/step/step.h>
#include "wgt/step/configuration/step_parse.h"
-#include <boost/filesystem/path.hpp>
-
#include <common/installer/app_installer.h>
#include <common/utils/paths.h>
#include <common/installer_context.h>
#include <cstdio>
#include <cstdlib>
+#include <filesystem>
#include <memory>
#include <set>
#include <string>
#include "wgt/utils/wgt_backend_data.h"
-namespace bf = boost::filesystem;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
LOG(ERROR) << "Out of memory";
return false;
}
- bf::path icon_path = context_->root_application_path.get()
+ fs::path icon_path = context_->root_application_path.get()
/ app_info->package() / "res" / "wgt" / application_icon.path();
icon->text = strdup(icon_path.c_str());
if (!locale.empty())
}
if (!service_info.icon().empty()) {
- bf::path icon_path = context_->root_application_path.get()
+ fs::path icon_path = context_->root_application_path.get()
/ manifest->package / "res" / "wgt" / service_info.icon();
icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
if (!icon) {
privilege->value = strdup(priv.name().c_str());
privilege->type = strdup(common_installer::kWebPrivilegeType);
if (!priv.license().empty()) {
- if (bf::path(priv.license()).is_absolute())
+ if (fs::path(priv.license()).is_absolute())
privilege->license = strdup(priv.license().c_str());
else
privilege->license = strdup((context_->root_application_path.get()
privilege->value = strdup(priv.name().c_str());
privilege->type = strdup(common_installer::kWebPrivilegeType);
if (!priv.license().empty()) {
- if (bf::path(priv.license()).is_absolute())
+ if (fs::path(priv.license()).is_absolute())
privilege->license = strdup(priv.license().c_str());
else
privilege->license = strdup((context_->root_application_path.get()
return common_installer::Step::Status::OK;
}
-bool StepParse::Check(const boost::filesystem::path& widget_path) {
+bool StepParse::Check(const fs::path& widget_path) {
LOG(DEBUG) << "unpacked widget path: " << widget_path;
widget_path_ = widget_path;
- boost::filesystem::path config = widget_path / kConfigFileName;
+ fs::path config = widget_path / kConfigFileName;
LOG(DEBUG) << "config.xml path: " << config;
- if (!boost::filesystem::exists(config))
+ if (!fs::exists(config))
return false;
return true;
}
#ifndef WGT_STEP_CONFIGURATION_STEP_PARSE_H_
#define WGT_STEP_CONFIGURATION_STEP_PARSE_H_
-#include <boost/filesystem.hpp>
-
#include <common/installer/app_installer.h>
#include <common/installer_context.h>
#include <common/step/step.h>
#include <type_traits>
#include <cassert>
+#include <filesystem>
#include <memory>
#include <set>
#include <string>
protected:
virtual bool LocateConfigFile();
- bool Check(const boost::filesystem::path& widget_path);
+ bool Check(const std::filesystem::path& widget_path);
- boost::filesystem::path widget_path_;
+ std::filesystem::path widget_path_;
private:
std::set<std::string> ExtractPrivileges(
#include <wgt/step/configuration/step_set_old_signature_files_location.h>
-#include <boost/filesystem/path.hpp>
-
#include <common/installer_context.h>
-namespace bf = boost::filesystem;
+#include <filesystem>
+
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
// StepCheckSignature gets path of signature files from unpacked_dir from
// unpacked_dir, which is root directory of package, but signature files
// are not at root directory.
- bf::path oldpath = context_->unpacked_dir_path.get();
- bf::path newpath = oldpath / kWgtPath;
+ fs::path oldpath = context_->unpacked_dir_path.get();
+ fs::path newpath = oldpath / kWgtPath;
context_->unpacked_dir_path.set(newpath);
return Status::OK;
}
#include <web_app_enc.h>
-#include <boost/filesystem/operations.hpp>
-#include <boost/system/error_code.hpp>
-
#include <common/utils/file_util.h>
#include <common/utils/byte_size_literals.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
+#include <filesystem>
#include <set>
#include <string>
+#include <system_error>
#include <memory>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
const std::size_t kEncryptionChunkMaxSize = 8_kB; // bytes
const std::set<std::string> encryptSet { ".html", ".htm", ".css", ".js"};
-FILE* OpenFile(const bf::path& path, const std::string& mode) {
+FILE* OpenFile(const fs::path& path, const std::string& mode) {
FILE* result = nullptr;
result = fopen(path.c_str(), mode.c_str());
LOG(ERROR) << "unpacked_dir_path attribute is empty";
return Step::Status::INVALID_VALUE;
}
- if (!bf::exists(input_)) {
+ if (!fs::exists(input_)) {
LOG(ERROR) << "unpacked_dir_path (" << input_ << ") path does not exist";
return Step::Status::INVALID_VALUE;
}
return ci::Step::Status::OK;
}
-bool StepEncryptResources::Encrypt(const bf::path &src) {
+bool StepEncryptResources::Encrypt(const fs::path &src) {
// traversing through src dir (recurrence if subdir found)
// for every file found, check if it should be encrypted (ToBeEncrypted)
// if yes, encrypt it (and replace original one)
// if not, leave it
- for (bf::directory_iterator file(src);
- file != bf::directory_iterator();
+ for (fs::directory_iterator file(src);
+ file != fs::directory_iterator();
++file) {
- bs::error_code error;
- bf::path current(file->path());
+ std::error_code error;
+ fs::path current(file->path());
- bool is_dir = bf::is_directory(current, error);
+ bool is_dir = fs::is_directory(current, error);
if (error) {
LOG(ERROR) << "Failed to check directory status: " << error.message();
return false;
continue;
}
- bool is_sym = bf::is_symlink(symlink_status(current, error));
+ bool is_sym = fs::is_symlink(symlink_status(current, error));
if (error) {
LOG(ERROR) << "Failed to check symlink status: " << error.message();
return false;
return true;
}
-bool StepEncryptResources::EncryptFile(const bf::path &src) {
+bool StepEncryptResources::EncryptFile(const fs::path &src) {
struct stat info;
memset(&info, 0, sizeof(info));
int fd;
return true;
}
- bf::path encFile(src.string() + ".enc");
+ fs::path encFile(src.string() + ".enc");
FILE *output = OpenFile(encFile, "wb");
if (!output) {
LOG(ERROR) << "Cannot create encrypted file: " << encFile;
input_ = context_->unpacked_dir_path.get();
}
-bool StepEncryptResources::ToBeEncrypted(const bf::path &file) {
+bool StepEncryptResources::ToBeEncrypted(const fs::path &file) {
size_t found_key = file.string().rfind(".");
if (std::string::npos != found_key) {
std::string mimeType = file.string().substr(found_key);
#ifndef WGT_STEP_ENCRYPTION_STEP_ENCRYPT_RESOURCES_H_
#define WGT_STEP_ENCRYPTION_STEP_ENCRYPT_RESOURCES_H_
-#include <boost/filesystem/path.hpp>
-
#include <common/step/step.h>
#include <manifest_parser/utils/logging.h>
Status precheck() override;
protected:
- boost::filesystem::path input_;
+ std::filesystem::path input_;
private:
virtual void SetEncryptionRoot();
- bool Encrypt(const boost::filesystem::path &src);
- bool EncryptFile(const boost::filesystem::path &src);
- bool ToBeEncrypted(const boost::filesystem::path &file);
+ bool Encrypt(const std::filesystem::path &src);
+ bool EncryptFile(const std::filesystem::path &src);
+ bool ToBeEncrypted(const std::filesystem::path &file);
WgtBackendData* backend_data_;
STEP_NAME(EncryptResources)
};
#include "wgt/step/filesystem/step_copy_preview_icons.h"
-#include <boost/filesystem/path.hpp>
-
#include <common/utils/file_util.h>
+#include <filesystem>
#include <string>
#include "wgt/utils/wgt_backend_data.h"
-namespace bf = boost::filesystem;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
if (size.preview.empty())
continue;
- bf::path icon_path = context_->GetPkgPath() / kResWgt / size.preview;
+ fs::path icon_path = context_->GetPkgPath() / kResWgt / size.preview;
std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type);
std::string icon_name = appwidget.id + "." + type + "." + "preview" +
- bf::path(size.preview).extension().string();
- bf::path preview_icon = context_->GetPkgPath() / kSharedRes / icon_name;
+ fs::path(size.preview).extension().string();
+ fs::path preview_icon = context_->GetPkgPath() / kSharedRes / icon_name;
if (!ci::CopyFile(icon_path, preview_icon)) {
LOG(ERROR) << "Cannot create preview icon: " << preview_icon;
return Status::ICON_ERROR;
#include <unistd.h>
#include <unordered_map>
-#include <boost/filesystem.hpp>
-#include <boost/system/error_code.hpp>
#include <common/utils/file_util.h>
#include <common/utils/glist_range.h>
#include <cassert>
#include <cstring>
#include <cstdio>
+#include <filesystem>
#include <string>
+#include <system_error>
#include "wgt/utils/wgt_backend_data.h"
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
namespace {
service_app_type[service_info.id()] = service_info.type();
}
- boost::system::error_code error;
+ std::error_code error;
for (application_x* app :
GListRange<application_x*>(context_->manifest_data.get()->application)) {
// filter out non-wgt apps as this step is run for hybrid backend too
if (strcmp("webapp", app->type) != 0)
continue;
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
- bf::path exec_path = context_->GetPkgPath() / bf::path("bin");
+ fs::path exec_path = context_->GetPkgPath() / fs::path("bin");
if (!common_installer::CreateDir(exec_path))
return false;
- exec_path /= bf::path(app->appid);
+ exec_path /= fs::path(app->appid);
common_installer::RemoveAll(exec_path);
if (strcmp(app->component_type, "uiapp") == 0) {
- bf::create_symlink(bf::path(kWRTPath), exec_path, error);
+ fs::create_symlink(fs::path(kWRTPath), exec_path, error);
} else if (strcmp(app->component_type, "watchapp") == 0) {
- bf::create_symlink(bf::path(kWRTPath), exec_path, error);
+ fs::create_symlink(fs::path(kWRTPath), exec_path, error);
} else if (strcmp(app->component_type, "widgetapp") == 0) {
- bf::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error);
+ fs::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error);
} else if (service_app_type[app->appid] == "standalone") {
- bf::create_symlink(kWrtServiceBinaryPath, exec_path, error);
+ fs::create_symlink(kWrtServiceBinaryPath, exec_path, error);
} else {
- bf::create_symlink(kWrtServiceLauncherBinaryPath, exec_path, error);
+ fs::create_symlink(kWrtServiceLauncherBinaryPath, exec_path, error);
}
if (error) {
LOG(ERROR) << "Failed to set symbolic link "
- << boost::system::system_error(error).what();
+ << error.message();
return false;
}
}
common_installer::Step::Status StepCreateWgtSymbolicLink::undo() {
for (application_x* app :
GListRange<application_x*>(context_->manifest_data.get()->application)) {
- bf::path exec_path = context_->GetPkgPath() / "bin" / app->appid;
+ fs::path exec_path = context_->GetPkgPath() / "bin" / app->appid;
common_installer::RemoveAll(exec_path);
}
return Status::OK;
#ifndef WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_
#define WGT_STEP_FILESYSTEM_STEP_CREATE_WGT_SYMBOLIC_LINK_H_
-#include <boost/filesystem.hpp>
-
#include <manifest_parser/utils/logging.h>
#include <common/installer/app_installer.h>
#include "wgt/step/filesystem/step_create_wgt_symbolic_link.h"
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
-
namespace wgt {
namespace filesystem {
#include <pkgmgr-info.h>
+#include <filesystem>
+#include <system_error>
+
#include "common/utils/file_util.h"
#include "common/utils/glist_range.h"
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
const char kDefaultIconPath[] = "/usr/share/wgt-backend/default.png";
-bool PatchIcon(icon_x* icon, const bf::path& dst_path, bool make_copy) {
+bool PatchIcon(icon_x* icon, const fs::path& dst_path, bool make_copy) {
if (!icon)
return false;
- bs::error_code error;
- bf::path icon_text(icon->text);
- bf::path icon_path = dst_path;
+ std::error_code error;
+ fs::path icon_text(icon->text);
+ fs::path icon_path = dst_path;
if (strcmp(icon->lang, DEFAULT_LOCALE)) {
icon_path += ".";
icon_path += icon->lang;
else
icon_path += ".png";
if (make_copy) {
- bf::copy_file(icon->text, icon_path,
- bf::copy_option::overwrite_if_exists, error);
+ fs::copy_file(icon->text, icon_path,
+ fs::copy_options::overwrite_existing, error);
if (error) {
LOG(ERROR) << "Failed to move icon from " << icon->text << " to "
<< icon_path;
return false;
}
} else {
- if (!bf::exists(icon_path)) {
+ if (!fs::exists(icon_path)) {
LOG(ERROR) << "Can't find icon in " << icon_path;
return false;
}
return true;
}
-bool GenerateDefaultIcon(const bf::path& icon_path,
+bool GenerateDefaultIcon(const fs::path& icon_path,
application_x* app, bool make_copy) {
- bs::error_code error;
+ std::error_code error;
if (make_copy) {
- bf::copy_file(kDefaultIconPath, icon_path,
- bf::copy_option::overwrite_if_exists, error);
+ fs::copy_file(kDefaultIconPath, icon_path,
+ fs::copy_options::overwrite_existing, error);
if (error) {
LOG(ERROR) << "Failed to create default icon for web application";
return false;
}
} else {
- if (!bf::exists(icon_path)) {
+ if (!fs::exists(icon_path)) {
LOG(ERROR) << "Can't find icon in " << icon_path;
return false;
}
namespace filesystem {
common_installer::Step::Status StepWgtPatchIcons::process() {
- bf::path common_icon_location = context_->GetPkgPath() / "shared" / "res";
- bs::error_code error;
- bf::create_directories(common_icon_location, error);
+ fs::path common_icon_location = context_->GetPkgPath() / "shared" / "res";
+ std::error_code error;
+ fs::create_directories(common_icon_location, error);
if (error) {
LOG(ERROR) << "Failed to create common icon location directory";
return Status::ICON_ERROR;
}
for (icon_x* icon :
GListRange<icon_x*>(context_->manifest_data.get()->icon)) {
- bf::path icon_path = common_icon_location /
+ fs::path icon_path = common_icon_location /
context_->manifest_data.get()->mainapp_id;
if (!PatchIcon(icon, icon_path, make_copy_))
return Status::ICON_ERROR;
if (app->icon) {
// edit icon->text and copy icons to common location
for (auto& icon : GListRange<icon_x*>(app->icon)) {
- bf::path icon_path = common_icon_location / app->appid;
+ fs::path icon_path = common_icon_location / app->appid;
if (!PatchIcon(icon, icon_path, make_copy_))
return Status::ICON_ERROR;
}
} else {
LOG(INFO) << "Application provides no icon. Using Tizen default icon.";
// create default icon if there is no icon at all
- bf::path icon_path = common_icon_location / app->appid;
+ fs::path icon_path = common_icon_location / app->appid;
icon_path += ".png";
if (!GenerateDefaultIcon(icon_path, app, make_copy_)) {
LOG(ERROR) << "Failed to create default icon for web application";
} // namespace filesystem
} // namespace wgt
-
#include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
-
#include <common/utils/file_util.h>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+#include <filesystem>
+#include <system_error>
+
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
bool StepWgtPatchStorageDirectories::ShareDirFor3x() {
// check if ${pkg_path}/res/wgt/shared/res exists
- bf::path wgt_shared_res_dir =
+ fs::path wgt_shared_res_dir =
context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation;
- if (!bf::exists(wgt_shared_res_dir))
+ if (!fs::exists(wgt_shared_res_dir))
return true;
// create ${pkg_path}/shared/res
- bf::path shared_dir = context_->GetPkgPath() / kSharedLocation;
- if (!bf::exists(shared_dir)) {
- bs::error_code error;
- bf::create_directory(shared_dir, error);
+ fs::path shared_dir = context_->GetPkgPath() / kSharedLocation;
+ if (!fs::exists(shared_dir)) {
+ std::error_code error;
+ fs::create_directory(shared_dir, error);
if (error) {
LOG(ERROR) << "Failed to create directory: " << shared_dir;
return false;
}
}
- bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
- if (!bf::exists(shared_res_dir)) {
- bs::error_code error;
- bf::create_directory(shared_res_dir, error);
+ fs::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
+ if (!fs::exists(shared_res_dir)) {
+ std::error_code error;
+ fs::create_directory(shared_res_dir, error);
if (error) {
LOG(ERROR) << "Failed to create directory: " << shared_res_dir;
return false;
// move and link all contents of ${pkg_path}res/wgt/shared/res
// to ${pkg_path}shared/res
- bf::directory_iterator end_itr;
- for (bf::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) {
- bf::path current = itr->path();
- if (bf::is_symlink(current)) {
+ fs::directory_iterator end_itr;
+ for (fs::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) {
+ fs::path current = itr->path();
+ if (fs::is_symlink(current)) {
continue;
}
- bf::path dest = shared_res_dir / current.filename();
- if (bf::is_directory(current)) {
+ fs::path dest = shared_res_dir / current.filename();
+ if (fs::is_directory(current)) {
if (!ci::MoveDir(current, dest, ci::FS_MERGE_OVERWRITE))
return false;
} else {
if (!ci::MoveFile(current, dest, true))
return false;
}
- bs::error_code error;
- bf::create_symlink(dest, current, error);
+ std::error_code error;
+ fs::create_symlink(dest, current, error);
if (error) {
LOG(ERROR) << "linking failed for " << dest
- << ": " << boost::system::system_error(error).what();
+ << ": " << error.message();
return false;
}
}
}
bool StepWgtPatchStorageDirectories::CreatePrivateTmpDir() {
- bf::path tmp_path = context_->GetPkgPath() / kTemporaryData;
- if (bf::exists(tmp_path) && bf::is_directory(tmp_path)) {
+ fs::path tmp_path = context_->GetPkgPath() / kTemporaryData;
+ if (fs::exists(tmp_path) && fs::is_directory(tmp_path)) {
return true;
}
- bs::error_code error;
- bf::create_directory(tmp_path, error);
+ std::error_code error;
+ fs::create_directory(tmp_path, error);
if (error) {
LOG(ERROR) << "Failed to create private temporary directory for package";
return false;
#include "wgt/step/filesystem/step_wgt_prepare_package_directory.h"
-#include <boost/filesystem/path.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/system/system_error.hpp>
-
#include <common/utils/paths.h>
#include <common/utils/file_util.h>
+#include <algorithm>
+#include <filesystem>
+#include <system_error>
#include <vector>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
namespace filesystem {
ci::Step::Status StepWgtPreparePackageDirectory::CreateSymlinks() {
- bs::error_code error;
- bf::path mount_point = ci::GetMountLocation(context_->GetPkgPath());
- bf::path res_wgt_link = context_->GetPkgPath() / kResWgtDirectory;
+ std::error_code error;
+ fs::path mount_point = ci::GetMountLocation(context_->GetPkgPath());
+ fs::path res_wgt_link = context_->GetPkgPath() / kResWgtDirectory;
std::vector<std::string> fileList;
std::vector<std::string> extractEntries = GetExtractEntries();
- for (bf::directory_iterator iter(mount_point);
- iter != bf::directory_iterator(); ++iter) {
- bf::path current(iter->path());
+ for (fs::directory_iterator iter(mount_point);
+ iter != fs::directory_iterator(); ++iter) {
+ fs::path current(iter->path());
if (std::find(extractEntries.begin(), extractEntries.end(),
current.filename()) != extractEntries.end())
continue;
- bf::path destination = res_wgt_link / current.filename();
- if (bf::exists(destination)) {
- if (!bf::is_symlink(symlink_status(destination))) {
+ fs::path destination = res_wgt_link / current.filename();
+ if (fs::exists(destination)) {
+ if (!fs::is_symlink(symlink_status(destination))) {
LOG(ERROR) << "Cannot proceed. "
<< "Location of link is used by another file";
return Status::APP_DIR_ERROR;
}
- bf::remove(destination, error);
+ fs::remove(destination, error);
if (error) {
LOG(ERROR) << "Failed to remove previous symlink";
return Status::APP_DIR_ERROR;
}
}
- bf::create_symlink(iter->path(), destination, error);
+ fs::create_symlink(iter->path(), destination, error);
if (error) {
LOG(ERROR) << "Failed to create symlink to widget image :" <<
- boost::system::system_error(error).what();
+ error.message();
return Status::APP_DIR_ERROR;
}
}
}
ci::Step::Status StepWgtPreparePackageDirectory::ExtractEntries() {
- bf::path backup_path =
+ fs::path backup_path =
ci::GetBackupPathForPackagePath(context_->GetPkgPath());
backupPath_ = backup_path;
- bf::path resource_path = context_->GetPkgPath() / kResWgtDirectory;
- bs::error_code error;
- bf::create_directories(resource_path, error);
+ fs::path resource_path = context_->GetPkgPath() / kResWgtDirectory;
+ std::error_code error;
+ fs::create_directories(resource_path, error);
if (error) {
LOG(ERROR) << "Failed to create proper directory structure in widget";
return Status::APP_DIR_ERROR;
for (auto& entry : GetExtractEntries()) {
ci::RemoveAll(context_->GetPkgPath() / kResWgtDirectory / entry);
- if (!bf::exists(backupPath_ / entry))
+ if (!fs::exists(backupPath_ / entry))
continue;
ci::MoveDir(backupPath_ / entry,
context_->GetPkgPath() / kResWgtDirectory / entry,
#include <manifest_parser/utils/logging.h>
-#include <boost/filesystem/path.hpp>
#include <pkgmgrinfo_basic.h>
+#include <filesystem>
#include <string>
#include "common/installer_context.h"
Status precheck() override;
private:
- boost::filesystem::path backupPath_;
+ std::filesystem::path backupPath_;
Status ExtractEntries();
Status CreateSymlinks();
#include "wgt/step/filesystem/step_wgt_resource_directory.h"
-#include <boost/filesystem/path.hpp>
-
#include <common/utils/file_util.h>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+#include <filesystem>
+#include <system_error>
+
+namespace fs = std::filesystem;
namespace wgt {
namespace filesystem {
common_installer::Step::Status StepWgtResourceDirectory::process() {
- bf::path temp_path = context_->unpacked_dir_path.get();
+ fs::path temp_path = context_->unpacked_dir_path.get();
temp_path += ".temp";
- bf::path resource_path = context_->unpacked_dir_path.get() / "res/wgt";
+ fs::path resource_path = context_->unpacked_dir_path.get() / "res/wgt";
if (!common_installer::MoveDir(context_->unpacked_dir_path.get(),
temp_path)) {
<< " to: " << temp_path;
return Status::APP_DIR_ERROR;
}
- bs::error_code error;
- bf::create_directories(resource_path.parent_path(), error);
+ std::error_code error;
+ fs::create_directories(resource_path.parent_path(), error);
if (error) {
LOG(ERROR) << "Failed to create proper directory structure in widget";
return Status::APP_DIR_ERROR;
#include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h"
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
-
#include <common/utils/file_util.h>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+#include <filesystem>
+
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
if (!backup_dir_.empty()) {
LOG(DEBUG) << "Restore res/wgt/shared/res from backup dir";
// restore link
- bf::path wgt_shared_res_dir =
+ fs::path wgt_shared_res_dir =
context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation;
- bf::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res";
+ fs::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res";
if (!backup_wgt_shared_res.empty()) {
if (!ci::RemoveAll(wgt_shared_res_dir)) {
LOG(ERROR) << "Failed to remove res/wgt/shared/res";
}
}
// restore original contents
- bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
- bf::path backup_shared_res = backup_dir_ / "shared_res";
+ fs::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
+ fs::path backup_shared_res = backup_dir_ / "shared_res";
if (!backup_shared_res.empty()) {
if (!ci::CopyDir(backup_dir_, shared_res_dir,
ci::FS_MERGE_OVERWRITE, false)) {
bool StepWgtUndoPatchStorageDirectories::UndoShareDirFor3x() {
// check if ${pkg_path}/shared/res exists
- bf::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
- if (!bf::exists(shared_res_dir))
+ fs::path shared_res_dir = context_->GetPkgPath() / kSharedResLocation;
+ if (!fs::exists(shared_res_dir))
return true;
- bf::path wgt_shared_res_dir =
+ fs::path wgt_shared_res_dir =
context_->GetPkgPath() / kResWgtSubPath / kSharedResLocation;
- if (!bf::exists(wgt_shared_res_dir))
+ if (!fs::exists(wgt_shared_res_dir))
return true;
- if (bf::is_symlink(wgt_shared_res_dir)) {
+ if (fs::is_symlink(wgt_shared_res_dir)) {
LOG(ERROR) << "Can't support this step, pkg should be fully updated";
return false;
}
// backup for undo
backup_dir_ = context_->unpacked_dir_path.get();
backup_dir_ += ".SharedRes";
- bf::path backup_shared_res = backup_dir_ / "shared_res";
+ fs::path backup_shared_res = backup_dir_ / "shared_res";
if (!ci::CreateDir(backup_shared_res))
return false;
- bf::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res";
+ fs::path backup_wgt_shared_res = backup_dir_ / "wgt_shared_res";
if (!ci::CopyDir(wgt_shared_res_dir, backup_wgt_shared_res,
ci::FS_MERGE_OVERWRITE, false)) {
backup_dir_.clear();
// unlink and move all linked contents from ${pkg_path}/shared/res
// to ${pkg_path}/res/wgt/shared/res
- bf::directory_iterator end_itr;
- for (bf::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) {
- bf::path link_file = itr->path();
- if (!bf::is_symlink(link_file)) {
+ fs::directory_iterator end_itr;
+ for (fs::directory_iterator itr(wgt_shared_res_dir); itr != end_itr; ++itr) {
+ fs::path link_file = itr->path();
+ if (!fs::is_symlink(link_file)) {
continue;
}
- bf::path link_target = bf::read_symlink(link_file);
+ fs::path link_target = fs::read_symlink(link_file);
if (link_target.native().substr(0, shared_res_dir.native().length()) !=
shared_res_dir.native()) {
continue;
}
if (!ci::Remove(link_file))
return false;
- bf::path tmp_backup = backup_shared_res / link_target.filename();
- if (bf::is_directory(link_target)) {
+ fs::path tmp_backup = backup_shared_res / link_target.filename();
+ if (fs::is_directory(link_target)) {
if (!ci::CopyDir(link_target, tmp_backup, ci::FS_MERGE_OVERWRITE, false))
return false;
if (!ci::MoveDir(link_target, link_file, ci::FS_MERGE_OVERWRITE))
#include <common/step/step.h>
#include <manifest_parser/utils/logging.h>
+#include <filesystem>
+
namespace wgt {
namespace filesystem {
private:
bool UndoShareDirFor3x();
- boost::filesystem::path backup_dir_;
+ std::filesystem::path backup_dir_;
STEP_NAME(WgtUndoPatchStorageDirectories)
};
-// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reservedstd
// Use of this source code is governed by an apache-2.0 license that can be
// found in the LICENSE file.
#include "wgt/step/filesystem/step_wgt_update_package_directory.h"
-#include <boost/filesystem/path.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/system/error_code.hpp>
-
#include <common/utils/paths.h>
#include <common/utils/file_util.h>
#include <string>
#include <vector>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
"res/wgt"
};
-bool MoveCreateDir(const bf::path& source, const bf::path& destination) {
+bool MoveCreateDir(const fs::path& source, const fs::path& destination) {
if (!ci::MoveDir(source, destination)) {
LOG(ERROR) << "Failed to move directory " << destination;
return false;
ci::Step::Status
StepWgtUpdatePackageDirectory::CreateBackupOfDirectories() {
- bf::path backup_path =
+ fs::path backup_path =
ci::GetBackupPathForPackagePath(context_->GetPkgPath());
for (auto& entry : kBackupEntries) {
std::string root_entry = entry.substr(0, entry.find("/"));
- bf::path directory = context_->GetPkgPath() / root_entry;
- if (!bf::exists(directory))
+ fs::path directory = context_->GetPkgPath() / root_entry;
+ if (!fs::exists(directory))
continue;
LOG(DEBUG) << "Backup directory entry: " << entry;
- bf::path directory_backup = backup_path / root_entry;
+ fs::path directory_backup = backup_path / root_entry;
if (!MoveCreateDir(directory, directory_backup)) {
LOG(ERROR) << "Failed to create backup directory "
<< directory_backup;
ci::Step::Status
StepWgtUpdatePackageDirectory::RecoverBackupOfDirectories() {
- bf::path backup_path =
+ fs::path backup_path =
ci::GetBackupPathForPackagePath(context_->GetPkgPath());
// skip if there is no backup of directories
- if (!bf::exists(backup_path))
+ if (!fs::exists(backup_path))
return Status::OK;
for (auto& entry : kBackupEntries) {
std::string root_entry = entry.substr(0, entry.find("/"));
- bf::path directory = context_->GetPkgPath() / root_entry;
- bf::path directory_backup = backup_path / root_entry;
- if (!bf::exists(directory_backup))
+ fs::path directory = context_->GetPkgPath() / root_entry;
+ fs::path directory_backup = backup_path / root_entry;
+ if (!fs::exists(directory_backup))
continue;
LOG(DEBUG) << "Recover directory entry: " << entry;
- bs::error_code error;
- bf::remove_all(directory, error);
+ std::error_code error;
+ fs::remove_all(directory, error);
if (error) {
LOG(ERROR) << "Failed to remove fail-update directory: " << directory;
return Status::APP_DIR_ERROR;
}
ci::Step::Status StepWgtUpdatePackageDirectory::clean() {
- bf::path backup_path =
+ fs::path backup_path =
ci::GetBackupPathForPackagePath(context_->GetPkgPath());
- if (bf::exists(backup_path))
+ if (fs::exists(backup_path))
ci::RemoveAll(backup_path);
return Status::OK;
}
Status status = RecoverBackupOfDirectories();
if (status != Status::OK)
return status;
- bf::path backup_path =
+ fs::path backup_path =
ci::GetBackupPathForPackagePath(context_->GetPkgPath());
- if (bf::exists(backup_path)) {
- bs::error_code error;
- bf::remove_all(backup_path, error);
+ if (fs::exists(backup_path)) {
+ std::error_code error;
+ fs::remove_all(backup_path, error);
if (error) {
LOG(ERROR) << "Failed to remove backup directories";
return Status::APP_DIR_ERROR;
#include "wgt/step/pkgmgr/step_generate_xml.h"
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
-
#include <common/utils/file_util.h>
#include <common/utils/glist_range.h>
#include <common/privileges.h>
#include <tzplatform_config.h>
#include <unistd.h>
+#include <algorithm>
#include <cassert>
#include <cstring>
+#include <filesystem>
#include <string>
+#include <system_error>
#include "wgt/utils/wgt_backend_data.h"
-namespace bs = boost::system;
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace {
bool WriteWidgetApplicationAttributesAndElements(
xmlTextWriterPtr writer, application_x *app,
const wgt::parse::AppWidgetInfo& widget_info,
- const bf::path& shared_path) {
+ const fs::path& shared_path) {
if (app->nodisplay)
xmlTextWriterWriteAttribute(writer, BAD_CAST "nodisplay",
BAD_CAST app->nodisplay);
if (!size.preview.empty()) {
std::string icon_name = shared_path.string() + "/"
+ appwidget->id + "." + type + "." + "preview" +
- bf::path(size.preview).extension().string();
+ fs::path(size.preview).extension().string();
xmlTextWriterWriteAttribute(writer, BAD_CAST "preview",
BAD_CAST icon_name.c_str()); // NOLINT
}
xmlTextWriterWriteAttribute(writer, BAD_CAST "appid", BAD_CAST app->appid);
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
- bf::path exec_path = context_->GetPkgPath()
- / bf::path("bin") / bf::path(app->appid);
+ fs::path exec_path = context_->GetPkgPath()
+ / fs::path("bin") / fs::path(app->appid);
xmlTextWriterWriteAttribute(writer, BAD_CAST "exec",
- BAD_CAST exec_path.string().c_str());
+ BAD_CAST exec_path.c_str());
if (app->type)
xmlTextWriterWriteAttribute(writer, BAD_CAST "type", BAD_CAST app->type);
else
}
common_installer::Step::Status StepGenerateXml::process() {
- bf::path xml_path =
- bf::path(getUserManifestPath(context_->uid.get(),
+ fs::path xml_path =
+ fs::path(getUserManifestPath(context_->uid.get(),
context_->is_readonly_package.get()))
- / bf::path(context_->pkgid.get());
+ / fs::path(context_->pkgid.get());
xml_path += ".xml";
context_->xml_path.set(xml_path.string());
- bs::error_code error;
- if (!bf::exists(xml_path.parent_path(), error)) {
+ std::error_code error;
+ if (!fs::exists(xml_path.parent_path(), error)) {
if (!common_installer::CreateDir(xml_path.parent_path())) {
LOG(ERROR) <<
"Directory for manifest xml is missing and cannot be created";
#include "wgt/step/security/step_check_extension_privileges.h"
-#include <boost/scope_exit.hpp>
-
#include <common/privileges.h>
#include <common/certificate_validation.h>
#include <common/utils/glist_range.h>
const char kArchI586[] = "i586";
const char kArchDefault[] = "default";
+void FreePrivilegeXList(GList* priv) {
+ g_list_free_full(priv, &common_installer::FreePrivilegeX);
+}
+
} // namespace
namespace wgt {
}
return Status::OK;
}
+
common_installer::Step::Status StepCheckExtensionPrivileges::process() {
std::string app_ext_config_pattern(GetExtensionPath());
}
}
GList* privileges = nullptr;
- BOOST_SCOPE_EXIT_ALL(privileges) {
- g_list_free_full(privileges, &common_installer::FreePrivilegeX);
- };
+ std::unique_ptr<GList, decltype(::FreePrivilegeXList)*> deleter(
+ privileges, &::FreePrivilegeXList);
+
for (auto it = xmlFiles.begin(); it != xmlFiles.end(); ++it) {
LOG(DEBUG) << "start to parse extension xml : " << *it;
ExtensionConfigParser extensionParser(*it);
#include "wgt/step/security/step_direct_manifest_signature.h"
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace {
namespace wgt {
namespace security {
-bf::path StepDirectManifestSignature::GetSignatureRoot() const {
+fs::path StepDirectManifestSignature::GetSignatureRoot() const {
return StepSignature::GetSignatureRoot() / kResWgt;
}
#include <common/step/security/step_signature.h>
#include <manifest_parser/utils/logging.h>
+#include <filesystem>
+
namespace ci = common_installer;
namespace wgt {
ci::security::StepSignature(context, save_signature) {}
private:
- boost::filesystem::path GetSignatureRoot() const override;
+ std::filesystem::path GetSignatureRoot() const override;
STEP_NAME(DirectManifestSignature)
};
#include "wgt/step/security/step_wgt_recover_signature.h"
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace {
namespace wgt {
namespace security {
-bf::path StepWgtRecoverSignature::GetSignatureRoot() {
+fs::path StepWgtRecoverSignature::GetSignatureRoot() {
return context_->GetPkgPath() / kResWgt;
}
#include <common/step/security/step_recover_signature.h>
-#include <boost/filesystem/path.hpp>
+#include <filesystem>
namespace wgt {
namespace security {
using StepRecoverSignature::StepRecoverSignature;
private:
- boost::filesystem::path GetSignatureRoot() override;
+ std::filesystem::path GetSignatureRoot() override;
STEP_NAME(WgtRecoverSignature)
};
#include <unistd.h>
#include <sys/types.h>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-#include <boost/system/error_code.hpp>
-
#include <common/pkgmgr_interface.h>
#include <common/utils/pkgmgr_query.h>
#include <common/recovery_file.h>
#include <tzplatform_config.h>
+#include <filesystem>
#include <memory>
#include <utility>
#include <string>
#include <vector>
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
std::string WgtAppQueryInterface::GetPkgIdFromPath(
const std::string& path) const {
- bf::path tmp_path = ExtractManifest(path);
+ fs::path tmp_path = ExtractManifest(path);
if (tmp_path.empty())
return {};
std::vector<std::shared_ptr<parser::ManifestHandler>> handlers = {
new parser::ManifestHandlerRegistry(handlers));
std::unique_ptr<parser::ManifestParser> parser(
new parser::ManifestParser(std::move(registry)));
- bf::path config_path = tmp_path / GetManifestFileName();
+ fs::path config_path = tmp_path / GetManifestFileName();
if (!parser->ParseManifest(config_path)) {
ClearTemporaryFile(tmp_path);
return {};
info = ReadPkgidFromRecovery(arg);
else
info = arg;
- bf::path rw_package_directory(ci::GetRootAppPath(false, uid));
- bf::path ro_package_directory;
+ fs::path rw_package_directory(ci::GetRootAppPath(false, uid));
+ fs::path ro_package_directory;
if (uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER) || uid == 0)
ro_package_directory = ci::GetRootAppPath(true, uid);
- if ((bf::exists(rw_package_directory / info / kTizenManifestLocation) &&
- bf::exists(rw_package_directory / info / kHybridConfigLocation)) ||
- (bf::exists(ro_package_directory / info / kTizenManifestLocation) &&
- bf::exists(ro_package_directory / info / kHybridConfigLocation))) {
+ if ((fs::exists(rw_package_directory / info / kTizenManifestLocation) &&
+ fs::exists(rw_package_directory / info / kHybridConfigLocation)) ||
+ (fs::exists(ro_package_directory / info / kTizenManifestLocation) &&
+ fs::exists(ro_package_directory / info / kHybridConfigLocation))) {
return true;
} else if (!is_recovery) {
bool tizen_manifest_found = false;
return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
} else {
ci::InstallerRunner runner(
- std::make_unique<wgt::WgtInstallerFactory>(), pkgmgr);
+ std::make_unique<wgt::WgtInstallerFactory>(), pkgmgr);
return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
}
} catch(...) {
ENDIF()
APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST} PUBLIC
- Boost
GMOCK_DEPS
GUM_DEPS
)
APPLY_PKG_CONFIG(${TARGET_SMOKE_TEST_EXTENSIVE} PUBLIC
- Boost
GMOCK_DEPS
GUM_DEPS
)
APPLY_PKG_CONFIG(${TARGET_MANIFEST_TEST} PUBLIC
- Boost
GMOCK_DEPS
)
private:
ci::RequestMode request_mode_;
- std::vector<bf::path> backups_;
+ std::vector<fs::path> backups_;
};
} // namespace smoke_test
};
TEST_F(SmokeTest, RecoveryMode_ForInstallation) {
- bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt";
+ fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt";
std::string pkgid = "smokewgt09";
std::string appid = "smokewgt09.RecoveryModeForInstallation";
{"", "-i", path.string(), "-u", test_user_str.c_str()};
backend.CrashAfterEachStep(&args, [&](int step) -> bool {
if (step >= 2) {
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
}
TEST_F(SmokeTest, RecoveryMode_ForUpdate) {
- bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt";
- bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt";
std::string pkgid = "smokewgt10";
std::string appid = "smokewgt10.RecoveryModeForUpdate";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ASSERT_EQ(backend.InstallWithSubprocess(path_old),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status_old(pkgid, params);
ASSERT_TRUE(expected_file_status_old.Init());
{"", "-i", path_new.string(), "-u", test_user_str.c_str()};
backend.CrashAfterEachStep(&args, [&](int step) -> bool {
if (step >= 2) {
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
}
TEST_F(SmokeTest, RecoveryMode_ForDelta) {
- bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt";
- bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta";
+ fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta";
std::string pkgid = "smokewgt30";
std::string appid = "smokewgt30.RecoveryModeForDelta";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ASSERT_EQ(BackendInterface::SubProcessResult::SUCCESS,
backend.InstallWithSubprocess(path_old));
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status_old(pkgid, params);
ASSERT_TRUE(expected_file_status_old.Init());
{"", "-i", path_new.string(), "-u", test_user_str.c_str()};
backend.CrashAfterEachStep(&args, [&](int step) -> bool {
if (step >= 2) {
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
}
TEST_F(SmokeTest, RecoveryMode_ForMountInstall) {
- bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt";
+ fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt";
std::string pkgid = "smokewgt31";
std::string appid = "smokewgt31.RecoveryModeForMountInstall";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
{"", "-w", path.string(), "-u", test_user_str.c_str()};
backend.CrashAfterEachStep(&args, [&](int step) -> bool {
if (step >= 2) {
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
}
TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
- bf::path path_old =
+ fs::path path_old =
kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate.wgt";
- bf::path path_new =
+ fs::path path_new =
kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate_2.wgt";
std::string pkgid = "smokewgt32";
std::string appid = "smokewgt32.RecoveryModeForMountUpdate";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ASSERT_EQ(backend.MountInstallWithSubprocess(path_old),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status_old(pkgid, params);
ASSERT_TRUE(expected_file_status_old.Init());
params.test_user.uid);
poweroff_unmount_interface.Release();
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
TEST_F(SmokeTest, InstallationMode_Rollback) {
- bf::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt";
+ fs::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt";
std::string pkgid = "smokewgt06";
std::string appid = "smokewgt06.InstallationModeRollback";
}
TEST_F(SmokeTest, UpdateMode_Rollback) {
- bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt";
- bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt";
std::string pkgid = "smokewgt07";
std::string appid = "smokewgt07.UpdateModeRollback";
ASSERT_EQ(backend.InstallWithSubprocess(path_old),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status(pkgid, params);
ASSERT_TRUE(expected_file_status.Init());
}
TEST_F(SmokeTest, DeltaMode_Rollback) {
- bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt";
- bf::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta";
+ fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt";
+ fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta";
std::string pkgid = "smokewgt01";
std::string appid = "smokewgt01.DeltaMode";
ASSERT_EQ(backend.InstallWithSubprocess(path),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status(pkgid, params);
ASSERT_TRUE(expected_file_status.Init());
EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED",
"version 1\n", params));
EXTENDED_ASSERT_TRUE(ValidateDataFiles(pkgid, params.test_user.uid));
- EXTENDED_ASSERT_TRUE(bf::exists(GetPackageRoot(
+ EXTENDED_ASSERT_TRUE(fs::exists(GetPackageRoot(
pkgid, params.test_user.uid) / "res/wgt/DELETED"));
- EXTENDED_ASSERT_FALSE(bf::exists(GetPackageRoot(
+ EXTENDED_ASSERT_FALSE(fs::exists(GetPackageRoot(
pkgid, params.test_user.uid) / "res/wgt/ADDED"));
return true;
});
}
TEST_F(HybridSmokeTest, InstallationMode_Rollback) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"InstallationMode_Rollback_Hybrid.wgt";
std::string pkgid = "smokehyb07";
std::string appid1 = "smokehyb07.web";
}
TEST_F(HybridSmokeTest, UpdateMode_Rollback) {
- bf::path path_old = kSmokePackagesDirectory /
+ fs::path path_old = kSmokePackagesDirectory /
"UpdateMode_Rollback_Hybrid.wgt";
- bf::path path_new = kSmokePackagesDirectory /
+ fs::path path_new = kSmokePackagesDirectory /
"UpdateMode_Rollback_Hybrid_2.wgt";
std::string pkgid = "smokehyb08";
std::string appid1 = "smokehyb08.web";
ASSERT_EQ(backend.InstallWithSubprocess(path_old),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status(pkgid, params);
ASSERT_TRUE(expected_file_status.Init());
}
TEST_F(HybridSmokeTest, DeltaMode_Rollback_Hybrid) {
- bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt";
- bf::path delta_package = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt";
+ fs::path delta_package = kSmokePackagesDirectory /
"DeltaMode_Rollback_Hybrid.delta";
std::string pkgid = "smokehyb11";
std::string appid1 = "smokehyb11.web";
ASSERT_EQ(backend.InstallWithSubprocess(path),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status(pkgid, params);
ASSERT_TRUE(expected_file_status.Init());
expected_file_status.IsEqual(new_file_status, &added_files));
EXTENDED_ASSERT_TRUE(ValidatePackage(pkgid, {appid1}, params));
// Check delta modifications
- bf::path root_path = GetPackageRoot(pkgid, params.test_user.uid);
- EXTENDED_ASSERT_TRUE(bf::exists(root_path / "res" / "wgt" / "DELETED"));
- EXTENDED_ASSERT_FALSE(bf::exists(root_path / "res" / "wgt" / "ADDED"));
- EXTENDED_ASSERT_TRUE(bf::exists(root_path / "lib" / "DELETED"));
- EXTENDED_ASSERT_FALSE(bf::exists(root_path / "lib" / "ADDED"));
+ fs::path root_path = GetPackageRoot(pkgid, params.test_user.uid);
+ EXTENDED_ASSERT_TRUE(fs::exists(root_path / "res" / "wgt" / "DELETED"));
+ EXTENDED_ASSERT_FALSE(fs::exists(root_path / "res" / "wgt" / "ADDED"));
+ EXTENDED_ASSERT_TRUE(fs::exists(root_path / "lib" / "DELETED"));
+ EXTENDED_ASSERT_FALSE(fs::exists(root_path / "lib" / "ADDED"));
EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED",
"version 1\n", params));
EXTENDED_ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "lib/MODIFIED",
}
TEST_F(HybridSmokeTest, MountInstallationMode_Rollback) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"MountInstallationMode_Rollback_Hybrid.wgt";
std::string pkgid = "smokehyb09";
std::string appid1 = "smokehyb09.web";
}
TEST_F(HybridSmokeTest, MountUpdateMode_Rollback) {
- bf::path path_old = kSmokePackagesDirectory /
+ fs::path path_old = kSmokePackagesDirectory /
"MountUpdateMode_Rollback_Hybrid.wgt";
- bf::path path_new = kSmokePackagesDirectory /
+ fs::path path_new = kSmokePackagesDirectory /
"MountUpdateMode_Rollback_Hybrid_2.wgt";
std::string pkgid = "smokehyb10";
std::string appid1 = "smokehyb10.web";
ASSERT_EQ(backend.MountInstallWithSubprocess(path_old),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status(pkgid, params);
ASSERT_TRUE(expected_file_status.Init());
}
TEST_F(SmokeTest, MountInstallationMode_Rollback) {
- bf::path path =
+ fs::path path =
kSmokePackagesDirectory / "MountInstallationMode_Rollback.wgt";
std::string pkgid = "smokewgt33";
std::string appid = "smokewgt33.web";
}
TEST_F(SmokeTest, MountUpdateMode_Rollback) {
- bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt";
- bf::path path_new =
+ fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt";
+ fs::path path_new =
kSmokePackagesDirectory / "MountUpdateMode_Rollback_2.wgt";
std::string pkgid = "smokewgt34";
std::string appid = "smokewgt34.web";
ASSERT_EQ(backend.MountInstallWithSubprocess(path_old),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status(pkgid, params);
ASSERT_TRUE(expected_file_status.Init());
TEST_F(PreloadSmokeTest, RecoveryMode_ForReadonlyUpdateInstall) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path path_old = kSmokePackagesDirectory /
+ fs::path path_old = kSmokePackagesDirectory /
"RecoveryMode_ForReadonlyUpdateInstall.wgt";
- bf::path path_new = kSmokePackagesDirectory /
+ fs::path path_new = kSmokePackagesDirectory /
"RecoveryMode_ForReadonlyUpdateInstall_2.wgt";
std::string pkgid = "smokewgt51";
std::string appid = "smokewgt51.RecoveryModeForReadonlyUpdateInstall";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ASSERT_EQ(backend.InstallPreloadWithSubprocess(path_old),
BackendInterface::SubProcessResult::SUCCESS);
- std::vector<bf::path> added_files;
+ std::vector<fs::path> added_files;
AddDataFiles(pkgid, params.test_user.uid, &added_files);
FileInfoCollector expected_file_status_old(pkgid, params);
ASSERT_TRUE(expected_file_status_old.Init());
{"", "-i", path_new.string(), "-u", test_uid_str.c_str()};
backend.CrashAfterEachStep(&args, [&](int step) -> bool {
if (step >= 2) {
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
EXTENDED_ASSERT_FALSE(recovery_file.empty());
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
// Use of this source code is governed by an apache-2.0 license that can be
// found in the LICENSE file.
-#include <boost/filesystem/path.hpp>
-
#include <common/installer_context.h>
#include <common/utils/glist_range.h>
#include <common/utils/request.h>
#include <glib.h>
#include <gtest/gtest.h>
+#include <filesystem>
#include <map>
#include <memory>
#include <string>
#define ASSERT_CSTR_EQ(STR1, STR2) \
ASSERT_EQ(strcmp(STR1, STR2), 0) \
-namespace bf = boost::filesystem;
namespace ci = common_installer;
+namespace fs = std::filesystem;
namespace {
context_.reset(new ci::InstallerContext());
context_->root_application_path.set(ci::GetRootAppPath(false, getuid()));
context_->unpacked_dir_path.set(
- bf::path(kManifestTestcaseData) / dir_suffix_);
+ fs::path(kManifestTestcaseData) / dir_suffix_);
context_->backend_data.set(new wgt::WgtBackendData());
}
const char* expected_name = "http://package0id/appdefined/test.read";
ASSERT_CSTR_EQ(priv_vec[0].c_str(), expected_name);
ASSERT_FALSE(license_vec.empty());
- bf::path path(m->root_path);
+ fs::path path(m->root_path);
path /= "res/cert";
ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str());
}
const char* second_priv = "http://package0id/appdefined/test.write";
ASSERT_CSTR_EQ(priv_vec[1].c_str(), second_priv);
ASSERT_EQ(license_vec.size(), 2);
- bf::path path(m->root_path);
+ fs::path path(m->root_path);
path /= "res/cert";
ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str());
ASSERT_CSTR_EQ(license_vec[1].c_str(), path.c_str());
const char* expected_name = "http://package0id/appdefined/test.read";
ASSERT_CSTR_EQ(priv_vec[0].c_str(), expected_name);
ASSERT_FALSE(license_vec.empty());
- bf::path path(m->root_path);
+ fs::path path(m->root_path);
path /= "res/cert";
ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str());
}
const char* second_priv = "http://package0id/appdefined/test.write";
ASSERT_CSTR_EQ(priv_vec[1].c_str(), second_priv);
ASSERT_EQ(license_vec.size(), 2);
- bf::path path(m->root_path);
+ fs::path path(m->root_path);
path /= "res/cert";
ASSERT_CSTR_EQ(license_vec[0].c_str(), path.c_str());
ASSERT_CSTR_EQ(license_vec[1].c_str(), path.c_str());
#include <common/utils/pkgmgr_query.h>
#include <smoke_tests/common/smoke_utils.h>
+#include <filesystem>
#include <memory>
#include "smoke_tests/wgt_smoke_utils.h"
-namespace st = smoke_test;
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
namespace ci = common_installer;
-namespace bo = boost::program_options;
+namespace fs = std::filesystem;
+namespace st = smoke_test;
namespace smoke_test {
private:
ci::RequestMode request_mode_;
- std::vector<bf::path> backups_;
+ std::vector<fs::path> backups_;
};
} // namespace smoke_test
};
TEST_F(SmokeTest, InstallationMode) {
- bf::path path = kSmokePackagesDirectory / "InstallationMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "InstallationMode.wgt";
std::string pkgid = "smokewgt03";
std::string appid = "smokewgt03.InstallationMode";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, UpdateMode) {
- bf::path path_old = kSmokePackagesDirectory / "UpdateMode.wgt";
- bf::path path_new = kSmokePackagesDirectory / "UpdateMode_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "UpdateMode.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "UpdateMode_2.wgt";
std::string pkgid = "smokewgt04";
std::string appid = "smokewgt04.UpdateMode";
ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, DeinstallationMode) {
- bf::path path = kSmokePackagesDirectory / "DeinstallationMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "DeinstallationMode.wgt";
std::string pkgid = "smokewgt05";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
ASSERT_EQ(backend.Uninstall(pkgid), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, RDSMode) {
- bf::path path = kSmokePackagesDirectory / "RDSMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "RDSMode.wgt";
std::string pkgid = "smokewgt11";
std::string appid = "smokewgt11.RDSMode";
- bf::path delta_directory = kSmokePackagesDirectory / "delta_dir";
- bf::path sdk_expected_directory = kSdkDirectory / "tmp" / pkgid;
+ fs::path delta_directory = kSmokePackagesDirectory / "delta_dir";
+ fs::path sdk_expected_directory = kSdkDirectory / "tmp" / pkgid;
ASSERT_TRUE(ci::CopyDir(delta_directory, sdk_expected_directory));
ASSERT_EQ(backend.RDSUpdate(path, pkgid),
ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params));
// Check delta modifications
- ASSERT_FALSE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_FALSE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res" / "wgt" / "DELETED"));
- ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res" / "wgt" / "ADDED"));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "2\n",
params));
}
TEST_F(SmokeTest, EnablePkg) {
- bf::path path = kSmokePackagesDirectory / "EnablePkg.wgt";
+ fs::path path = kSmokePackagesDirectory / "EnablePkg.wgt";
std::string pkgid = "smokewgt22";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
ASSERT_EQ(backend.DisablePackage(pkgid), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, DisablePkg) {
- bf::path path = kSmokePackagesDirectory / "DisablePkg.wgt";
+ fs::path path = kSmokePackagesDirectory / "DisablePkg.wgt";
std::string pkgid = "smokewgt21";
std::string appid = "smokewgt21.DisablePkg";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, DeltaMode) {
- bf::path path = kSmokePackagesDirectory / "DeltaMode.wgt";
- bf::path delta_package = kSmokePackagesDirectory / "DeltaMode.delta";
+ fs::path path = kSmokePackagesDirectory / "DeltaMode.wgt";
+ fs::path delta_package = kSmokePackagesDirectory / "DeltaMode.delta";
std::string pkgid = "smokewgt17";
std::string appid = "smokewgt17.DeltaMode";
ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params));
// Check delta modifications
- ASSERT_FALSE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_FALSE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res" / "wgt" / "DELETED"));
- ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res" / "wgt" / "ADDED"));
- ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res" / "wgt" / "css" / "style.css"));
- ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res" / "wgt" / "images" / "tizen_32.png"));
- ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res" / "wgt" / "js" / "main.js"));
ASSERT_TRUE(ValidateFileContentInPackage(
pkgid, "res/wgt/MODIFIED", "version 2\n", params));
}
TEST_F(SmokeTest, RecoveryMode_ForInstallation) {
- bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt";
+ fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForInstallation.wgt";
ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
std::string test_uid_str = std::to_string(params.test_user.uid);
backend_crash.Run("-i", path.string(), "-u", test_uid_str.c_str());
ASSERT_NE(backend_crash.Wait(), 0);
std::string pkgid = "smokewgt09";
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, RecoveryMode_ForUpdate) {
- bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt";
- bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForUpdate.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForUpdate_2.wgt";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
std::string pkgid = "smokewgt10";
backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str());
ASSERT_NE(backend_crash.Wait(), 0);
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, RecoveryMode_ForDelta) {
- bf::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt";
- bf::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta";
+ fs::path path_old = kSmokePackagesDirectory / "RecoveryMode_ForDelta.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "RecoveryMode_ForDelta.delta";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
std::string pkgid = "smokewgt30";
std::string appid = "smokewgt30.RecoveryModeForDelta";
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, RecoveryMode_ForMountInstall) {
- bf::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt";
+ fs::path path = kSmokePackagesDirectory / "RecoveryMode_ForMountInstall.wgt";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
std::string test_uid_str = std::to_string(params.test_user.uid);
ASSERT_NE(backend_crash.Wait(), 0);
std::string pkgid = "smokewgt31";
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, RecoveryMode_ForMountUpdate) {
- bf::path path_old =
+ fs::path path_old =
kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate.wgt";
- bf::path path_new =
+ fs::path path_new =
kSmokePackagesDirectory / "RecoveryMode_ForMountUpdate_2.wgt";
std::string pkgid = "smokewgt32";
std::string appid = "smokewgt32.RecoveryModeForMountUpdate";
ScopedTzipInterface poweroff_unmount_interface(pkgid, params.test_user.uid);
poweroff_unmount_interface.Release();
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
TEST_F(SmokeTest, InstallationMode_GoodSignature) {
// pkgid: smokewgt08
- bf::path path = kSmokePackagesDirectory / "InstallationMode_GoodSignature.wgt"; // NOLINT
+ fs::path path = kSmokePackagesDirectory / "InstallationMode_GoodSignature.wgt"; // NOLINT
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, InstallationMode_WrongSignature) {
// pkgid: smokewgt12
- bf::path path = kSmokePackagesDirectory / "InstallationMode_WrongSignature.wgt"; // NOLINT
+ fs::path path = kSmokePackagesDirectory / "InstallationMode_WrongSignature.wgt"; // NOLINT
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR);
}
TEST_F(RollbackSmokeTest, InstallationMode) {
- bf::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt";
+ fs::path path = kSmokePackagesDirectory / "InstallationMode_Rollback.wgt";
std::string pkgid = "smokewgt06";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR);
ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
}
TEST_F(RollbackSmokeTest, UpdateMode) {
- bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt";
- bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Rollback.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Rollback_2.wgt";
std::string pkgid = "smokewgt07";
std::string appid = "smokewgt07.UpdateModeRollback";
ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
}
TEST_F(RollbackSmokeTest, DeltaMode) {
- bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt";
- bf::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta";
+ fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback.wgt";
+ fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Rollback.delta";
std::string pkgid = "smokewgt01";
std::string appid = "smokewgt01.DeltaMode";
ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED",
"version 1\n", params));
ASSERT_TRUE(ValidateDataFiles(pkgid, params.test_user.uid));
- ASSERT_TRUE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_TRUE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res/wgt/DELETED"));
- ASSERT_FALSE(bf::exists(GetPackageRoot(pkgid, params.test_user.uid) /
+ ASSERT_FALSE(fs::exists(GetPackageRoot(pkgid, params.test_user.uid) /
"res/wgt/ADDED"));
}
TEST_F(HybridSmokeTest, InstallationMode) {
- bf::path path = kSmokePackagesDirectory / "InstallationMode_Hybrid.wgt";
+ fs::path path = kSmokePackagesDirectory / "InstallationMode_Hybrid.wgt";
std::string pkgid = "smokehyb01";
// Excutable for native app doesn't create symlink
std::string appid1 = "smokehyb01.Web";
}
TEST_F(HybridSmokeTest, UpdateMode) {
- bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Hybrid.wgt";
- bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Hybrid_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Hybrid.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Hybrid_2.wgt";
std::string pkgid = "smokehyb02";
std::string appid1 = "smokehyb02.Web";
ASSERT_EQ(backend.InstallSuccess(path_old), ci::AppInstaller::Result::OK);
}
TEST_F(HybridSmokeTest, DeinstallationMode) {
- bf::path path = kSmokePackagesDirectory / "DeinstallationMode_Hybrid.wgt";
+ fs::path path = kSmokePackagesDirectory / "DeinstallationMode_Hybrid.wgt";
std::string pkgid = "smokehyb03";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
ASSERT_EQ(backend.Uninstall(pkgid), ci::AppInstaller::Result::OK);
}
TEST_F(HybridSmokeTest, DeltaMode) {
- bf::path path = kSmokePackagesDirectory / "DeltaMode_Hybrid.wgt";
- bf::path delta_package = kSmokePackagesDirectory / "DeltaMode_Hybrid.delta";
+ fs::path path = kSmokePackagesDirectory / "DeltaMode_Hybrid.wgt";
+ fs::path delta_package = kSmokePackagesDirectory / "DeltaMode_Hybrid.delta";
std::string pkgid = "smokehyb04";
std::string appid1 = "smokehyb04.Web";
ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidatePackage(pkgid, {appid1}, params));
// Check delta modifications
- bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
- ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "wgt" / "DELETED"));
- ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "ADDED"));
- ASSERT_FALSE(bf::exists(root_path / pkgid / "lib" / "DELETED"));
- ASSERT_TRUE(bf::exists(root_path / pkgid / "lib" / "ADDED"));
- ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "css" / "style.css")); // NOLINT
- ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "images" / "tizen_32.png")); // NOLINT
- ASSERT_TRUE(bf::exists(root_path / pkgid / "res" / "wgt" / "js" / "main.js"));
+ fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
+ ASSERT_FALSE(fs::exists(root_path / pkgid / "res" / "wgt" / "DELETED"));
+ ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "ADDED"));
+ ASSERT_FALSE(fs::exists(root_path / pkgid / "lib" / "DELETED"));
+ ASSERT_TRUE(fs::exists(root_path / pkgid / "lib" / "ADDED"));
+ ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "css" / "style.css")); // NOLINT
+ ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "images" / "tizen_32.png")); // NOLINT
+ ASSERT_TRUE(fs::exists(root_path / pkgid / "res" / "wgt" / "js" / "main.js"));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED", "version 2\n", params)); // NOLINT
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "lib/MODIFIED", "version 2\n", params)); // NOLINT
}
TEST_F(HybridSmokeTest, MountInstallationMode) {
- bf::path path = kSmokePackagesDirectory / "MountInstallationMode_Hybrid.wgt";
+ fs::path path = kSmokePackagesDirectory / "MountInstallationMode_Hybrid.wgt";
std::string pkgid = "smokehyb05";
std::string appid1 = "smokehyb05.web";
ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::OK);
}
TEST_F(HybridSmokeTest, MountUpdateMode) {
- bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Hybrid.wgt";
- bf::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Hybrid_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Hybrid.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_Hybrid_2.wgt";
std::string pkgid = "smokehyb06";
std::string appid1 = "smokehyb06.web";
ASSERT_EQ(backend.MountInstallSuccess(path_old),
}
TEST_F(RollbackHybridSmokeTest, InstallationMode) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"InstallationMode_Rollback_Hybrid.wgt";
std::string pkgid = "smokehyb07";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR);
}
TEST_F(RollbackHybridSmokeTest, UpdateMode) {
- bf::path path_old = kSmokePackagesDirectory /
+ fs::path path_old = kSmokePackagesDirectory /
"UpdateMode_Rollback_Hybrid.wgt";
- bf::path path_new = kSmokePackagesDirectory /
+ fs::path path_new = kSmokePackagesDirectory /
"UpdateMode_Rollback_Hybrid_2.wgt";
std::string pkgid = "smokehyb08";
std::string appid1 = "smokehyb08.web";
}
TEST_F(RollbackHybridSmokeTest, DeltaMode) {
- bf::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt";
- bf::path delta_package = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory / "DeltaMode_Rollback_Hybrid.wgt";
+ fs::path delta_package = kSmokePackagesDirectory /
"DeltaMode_Rollback_Hybrid.delta";
std::string pkgid = "smokehyb11";
std::string appid1 = "smokehyb11.web";
ASSERT_TRUE(ValidatePackage(pkgid, {appid1}, params));
// Check delta modifications
- bf::path root_path = GetPackageRoot(pkgid, params.test_user.uid);
- ASSERT_TRUE(bf::exists(root_path / "res" / "wgt" / "DELETED"));
- ASSERT_FALSE(bf::exists(root_path / "res" / "wgt" / "ADDED"));
- ASSERT_TRUE(bf::exists(root_path / "lib" / "DELETED"));
- ASSERT_FALSE(bf::exists(root_path / "lib" / "ADDED"));
+ fs::path root_path = GetPackageRoot(pkgid, params.test_user.uid);
+ ASSERT_TRUE(fs::exists(root_path / "res" / "wgt" / "DELETED"));
+ ASSERT_FALSE(fs::exists(root_path / "res" / "wgt" / "ADDED"));
+ ASSERT_TRUE(fs::exists(root_path / "lib" / "DELETED"));
+ ASSERT_FALSE(fs::exists(root_path / "lib" / "ADDED"));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "res/wgt/MODIFIED",
"version 1\n", params));
ASSERT_TRUE(ValidateFileContentInPackage(pkgid, "lib/MODIFIED",
}
TEST_F(RollbackHybridSmokeTest, MountInstallationMode) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"MountInstallationMode_Rollback_Hybrid.wgt";
std::string pkgid = "smokehyb09";
ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::ERROR);
}
TEST_F(RollbackHybridSmokeTest, MountUpdateMode) {
- bf::path path_old = kSmokePackagesDirectory /
+ fs::path path_old = kSmokePackagesDirectory /
"MountUpdateMode_Rollback_Hybrid.wgt";
- bf::path path_new = kSmokePackagesDirectory /
+ fs::path path_new = kSmokePackagesDirectory /
"MountUpdateMode_Rollback_Hybrid_2.wgt";
std::string pkgid = "smokehyb10";
std::string appid1 = "smokehyb10.web";
}
TEST_F(SmokeTest, MountInstallationMode) {
- bf::path path = kSmokePackagesDirectory / "MountInstallationMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "MountInstallationMode.wgt";
std::string pkgid = "smokewgt28";
std::string appid = "smokewgt28.InstallationMode";
ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::OK);
}
TEST_F(SmokeTest, MountUpdateMode) {
- bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode.wgt";
- bf::path path_new = kSmokePackagesDirectory / "MountUpdateMode_2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "MountUpdateMode_2.wgt";
std::string pkgid = "smokewgt29";
std::string appid = "smokewgt29.UpdateMode";
ASSERT_EQ(backend.MountInstallSuccess(path_old),
}
TEST_F(RollbackSmokeTest, MountInstallationMode) {
- bf::path path =
+ fs::path path =
kSmokePackagesDirectory / "MountInstallationMode_Rollback.wgt";
std::string pkgid = "smokewgt33";
ASSERT_EQ(backend.MountInstall(path), ci::AppInstaller::Result::ERROR);
}
TEST_F(RollbackSmokeTest, MountUpdateMode) {
- bf::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt";
- bf::path path_new =
+ fs::path path_old = kSmokePackagesDirectory / "MountUpdateMode_Rollback.wgt";
+ fs::path path_new =
kSmokePackagesDirectory / "MountUpdateMode_Rollback_2.wgt";
std::string pkgid = "smokewgt34";
std::string appid = "smokewgt34.web";
}
TEST_F(SmokeTest, UserDefinedPlugins) {
- bf::path path = kSmokePackagesDirectory / "SimpleEchoPrivilege.wgt";
+ fs::path path = kSmokePackagesDirectory / "SimpleEchoPrivilege.wgt";
std::string pkgid = "smokewgt02";
std::string appid = "smokewgt02.SimpleEcho";
std::string call_privilege = "http://tizen.org/privilege/call";
TEST_F(SmokeTest, InstallExternalMode) {
ASSERT_TRUE(CheckAvailableExternalPath());
- bf::path path = kSmokePackagesDirectory / "InstallExternalMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "InstallExternalMode.wgt";
std::string pkgid = "smokewgt35";
std::string appid = "smokewgt35.web";
ASSERT_EQ(backend.InstallWithStorage(path, StorageType::EXTERNAL),
TEST_F(SmokeTest, MigrateLegacyExternalImageMode) {
ASSERT_TRUE(CheckAvailableExternalPath());
- bf::path path =
+ fs::path path =
kSmokePackagesDirectory / "MigrateLegacyExternalImageMode.wgt";
std::string pkgid = "smokewgt36";
std::string appid = "smokewgt36.web";
- bf::path legacy_path = kSmokePackagesDirectory / kLegacyExtImageDir;
+ fs::path legacy_path = kSmokePackagesDirectory / kLegacyExtImageDir;
std::string test_uid_str = std::to_string(params.test_user.uid);
if (test_uid_str == kDefaultUserIdStr ||
params.test_user.uid == kGlobalUserUid) {
TEST_F(PreloadSmokeTest, InstallationMode) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path path = kSmokePackagesDirectory / "InstallationMode_Preload.wgt";
+ fs::path path = kSmokePackagesDirectory / "InstallationMode_Preload.wgt";
std::string pkgid = "smokewgt37";
std::string appid = "smokewgt37.InstallationModePreload";
ASSERT_EQ(backend.InstallPreload(path), ci::AppInstaller::Result::OK);
TEST_F(PreloadSmokeTest, UpdateMode) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path path_old = kSmokePackagesDirectory / "UpdateMode_Preload.wgt";
- bf::path path_new = kSmokePackagesDirectory / "UpdateMode_Preload2.wgt";
+ fs::path path_old = kSmokePackagesDirectory / "UpdateMode_Preload.wgt";
+ fs::path path_new = kSmokePackagesDirectory / "UpdateMode_Preload2.wgt";
std::string pkgid = "smokewgt38";
std::string appid = "smokewgt38.UpdateModePreload";
ASSERT_EQ(backend.InstallPreload(path_old), ci::AppInstaller::Result::OK);
TEST_F(PreloadSmokeTest, DeinstallationMode) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path path = kSmokePackagesDirectory / "DeinstallationMode_Preload.wgt";
+ fs::path path = kSmokePackagesDirectory / "DeinstallationMode_Preload.wgt";
std::string pkgid = "smokewgt39";
ASSERT_EQ(backend.InstallPreload(path), ci::AppInstaller::Result::OK);
ASSERT_EQ(backend.UninstallPreload(pkgid), ci::AppInstaller::Result::OK);
TEST_F(SmokeTest, ManifestDirectInstallMode) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path src_path = kSmokePackagesDirectory / "ManifestDirectInstallMode";
+ fs::path src_path = kSmokePackagesDirectory / "ManifestDirectInstallMode";
std::string pkgid = "smokewgt40";
std::string appid = "smokewgt40.ManifestDirectInstallMode";
- bf::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid);
+ fs::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid);
ci::CopyDir(src_path / pkgid, pkg_path / pkgid);
ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid);
}
TEST_F(SmokeTest, ManifestDirectUpdateMode) {
- bf::path path = kSmokePackagesDirectory / "ManifestDirectUpdateMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "ManifestDirectUpdateMode.wgt";
std::string pkgid = "smokewgt41";
std::string appid = "smokewgt41.ManifestDirectUpdateMode";
TEST_F(PreloadSmokeTest, ReadonlyUpdateInstallMode) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path path = kSmokePackagesDirectory / "ReadonlyUpdateInstallMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "ReadonlyUpdateInstallMode.wgt";
std::string pkgid = "smokewgt42";
std::string appid = "smokewgt42.ReadonlyUpdateInstallMode";
TEST_F(PreloadSmokeTest, ReadonlyUpdateUninstallMode) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path path = kSmokePackagesDirectory / "ReadonlyUpdateUninstallMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "ReadonlyUpdateUninstallMode.wgt";
std::string pkgid = "smokewgt43";
std::string appid = "smokewgt43.ReadonlyUpdateUninstallMode";
TEST_F(HybridSmokeTest, ManifestDirectInstallMode) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path src_path = kSmokePackagesDirectory /
+ fs::path src_path = kSmokePackagesDirectory /
"ManifestDirectInstallMode_Hybrid";
std::string pkgid = "smokehyb12";
std::string appid = "smokehyb12.ManifestDirectInstallModeHybrid";
- bf::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid);
+ fs::path pkg_path = ci::GetRootAppPath(false, params.test_user.uid);
ci::CopyDir(src_path / pkgid, pkg_path / pkgid);
ci::PkgQueryInterface pkg_query(pkgid, params.test_user.uid);
}
TEST_F(HybridSmokeTest, ManifestDirectUpdateMode) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"ManifestDirectUpdateMode_Hybrid.wgt";
std::string pkgid = "smokehyb13";
std::string appid = "smokehyb13.ManifestDirectUpdateModeHybrid";
}
TEST_F(SmokeTest, SharedRes24) {
- bf::path path = kSmokePackagesDirectory / "SharedRes24.wgt";
+ fs::path path = kSmokePackagesDirectory / "SharedRes24.wgt";
std::string pkgid = "smokeSh2xx";
std::string appid = "smokeSh2xx.SharedRes24";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
ValidatePackage(pkgid, {appid}, params);
- bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
- ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT
- ASSERT_FALSE(bf::exists(root_path / pkgid / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT
+ fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
+ ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT
+ ASSERT_FALSE(fs::exists(root_path / pkgid / "shared" / "res" / "NOT-SHARED-WGT")); // NOLINT
}
TEST_F(SmokeTest, SharedRes30) {
- bf::path path = kSmokePackagesDirectory / "SharedRes30.wgt";
+ fs::path path = kSmokePackagesDirectory / "SharedRes30.wgt";
std::string pkgid = "smokeSh3xx";
std::string appid = "smokeSh3xx.SharedRes30";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params));
- bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
- ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT
- ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT
+ fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
+ ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT
+ ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT
}
TEST_F(SmokeTest, SharedRes30Delta) {
- bf::path path = kSmokePackagesDirectory / "SharedRes30Delta.wgt";
- bf::path delta_package = kSmokePackagesDirectory / "SharedRes30Delta.delta";
+ fs::path path = kSmokePackagesDirectory / "SharedRes30Delta.wgt";
+ fs::path delta_package = kSmokePackagesDirectory / "SharedRes30Delta.delta";
std::string pkgid = "smokeSh3De";
std::string appid = "smokeSh3De.SharedRes30Delta";
ASSERT_EQ(backend.InstallSuccess(path), ci::AppInstaller::Result::OK);
ASSERT_EQ(backend.Install(delta_package), ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidatePackage(pkgid, {appid}, params));
// Check delta modifications
- bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
- ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
- ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
- ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
- ASSERT_FALSE(bf::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
+ fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
+ ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
+ ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
+ ASSERT_FALSE(fs::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
+ ASSERT_FALSE(fs::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
}
TEST_F(HybridSmokeTest, SharedRes30Hybrid) {
- bf::path path = kSmokePackagesDirectory / "SharedRes30Hybrid.wgt";
+ fs::path path = kSmokePackagesDirectory / "SharedRes30Hybrid.wgt";
std::string pkgid = "smokeSh3Hy";
std::string appid1 = "smokeSh3Hy.SharedRes30Hybrid";
std::string appid2 = "sharedres30hybridserivce";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidatePackage(pkgid, {appid1, appid2}, params));
- bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
- ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT
- ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT
- ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK")); // NOLINT
+ fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
+ ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT")); // NOLINT
+ ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT")); // NOLINT
+ ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK")); // NOLINT
}
TEST_F(HybridSmokeTest, SharedRes30HybridDelta) {
- bf::path path = kSmokePackagesDirectory / "SharedRes30HybridDelta.wgt";
- bf::path delta_package = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory / "SharedRes30HybridDelta.wgt";
+ fs::path delta_package = kSmokePackagesDirectory /
"SharedRes30HybridDelta.delta";
std::string pkgid = "smokeSh3HD";
std::string appid1 = "smokeSh3HD.SharedRes30HybridDelta";
ASSERT_EQ(backend.Install(delta_package), ci::AppInstaller::Result::OK);
ASSERT_TRUE(ValidatePackage(pkgid, {appid1, appid2}, params));
// Check delta modifications
- bf::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
- ASSERT_TRUE(bf::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
- ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
- ASSERT_TRUE(bf::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK-2")); // NOLINT
- ASSERT_FALSE(bf::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
- ASSERT_FALSE(bf::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
+ fs::path root_path = ci::GetRootAppPath(false, params.test_user.uid);
+ ASSERT_TRUE(fs::is_symlink(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
+ ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-WGT-2")); // NOLINT
+ ASSERT_TRUE(fs::is_regular_file(root_path / pkgid / "shared" / "res" / "SHARED-TPK-2")); // NOLINT
+ ASSERT_FALSE(fs::exists(root_path / pkgid / "res" / "wgt" / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
+ ASSERT_FALSE(fs::exists(root_path / pkgid / "shared" / "res" / "SHARED-WGT-1")); // NOLINT
}
TEST_F(SmokeTest, InstallExtendedMode) {
ASSERT_TRUE(CheckAvailableExtendedPath());
- bf::path path = kSmokePackagesDirectory / "InstallExtendedMode.wgt";
+ fs::path path = kSmokePackagesDirectory / "InstallExtendedMode.wgt";
std::string pkgid = "smokewgt44";
std::string appid = "smokewgt44.web";
ASSERT_EQ(backend.InstallWithStorage(path, StorageType::EXTENDED),
}
TEST_F(SmokeTest, RecoveryMode_CrashAfterUnzip) {
- bf::path path = kSmokePackagesDirectory / "RecoveryMode_CrashAfterUnzip.wgt";
+ fs::path path = kSmokePackagesDirectory / "RecoveryMode_CrashAfterUnzip.wgt";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ci::Subprocess backend_crash("/usr/bin/wgt-installer-ut/smoke-test-helper");
std::string test_uid_str = std::to_string(params.test_user.uid);
ASSERT_NE(backend_crash.Wait(), 0);
std::string pkgid = "smokewgt45";
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
std::unique_ptr<ci::recovery::RecoveryFile> recovery_info =
ASSERT_TRUE(recovery_info ? true : false);
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
ASSERT_TRUE(CheckPackageNonExistance(pkgid, params));
- ASSERT_FALSE(bf::exists(recovery_info->unpacked_dir()));
+ ASSERT_FALSE(fs::exists(recovery_info->unpacked_dir()));
}
TEST_F(SmokeTest, InstallationMode_GlobalServiceAppWithUiAppId) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"InstallationMode_GlobalServiceAppWithUiAppId.wgt";
std::string pkgid = "smokewgt46";
std::string ui_appid = "smokewgt46.uiapp";
}
TEST_F(SmokeTest, InstallationMode_GlobalServiceAppWithoutUiAppId) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"InstallationMode_GlobalServiceAppWithoutUiAppId.wgt";
std::string pkgid = "smokewgt47";
std::string service_appid = "smokewgt47.serviceapp";
}
TEST_F(SmokeTest, InstallationMode_UIServiceAppWithUiAppId) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"InstallationMode_UIServiceAppWithUiAppId.wgt";
std::string pkgid = "smokewgt48";
std::string ui_appid = "smokewgt48.uiapp";
}
TEST_F(SmokeTest, InstallationMode_UIServiceAppWithoutUiAppId) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"InstallationMode_UIServiceAppWithoutUiAppId.wgt";
std::string pkgid = "smokewgt49";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR);
}
TEST_F(SmokeTest, InstallationMode_UIAppWithoutUiAppId) {
- bf::path path = kSmokePackagesDirectory /
+ fs::path path = kSmokePackagesDirectory /
"InstallationMode_UIAppWithoutUiAppId.wgt";
std::string pkgid = "smokewgt50";
ASSERT_EQ(backend.Install(path), ci::AppInstaller::Result::ERROR);
TEST_F(PreloadSmokeTest, RecoveryMode_ForReadonlyUpdateInstall) {
ASSERT_EQ(getuid(), 0) << "Test cannot be run by normal user";
- bf::path path_old = kSmokePackagesDirectory /
+ fs::path path_old = kSmokePackagesDirectory /
"RecoveryMode_ForReadonlyUpdateInstall.wgt";
- bf::path path_new = kSmokePackagesDirectory /
+ fs::path path_new = kSmokePackagesDirectory /
"RecoveryMode_ForReadonlyUpdateInstall_2.wgt";
RemoveAllRecoveryFiles("/wgt-recovery", params.test_user.uid);
ASSERT_EQ(backend.InstallPreload(path_old), ci::AppInstaller::Result::OK);
backend_crash.Run("-i", path_new.string(), "-u", test_uid_str.c_str());
ASSERT_NE(backend_crash.Wait(), 0);
- bf::path recovery_file = FindRecoveryFile("/wgt-recovery",
+ fs::path recovery_file = FindRecoveryFile("/wgt-recovery",
params.test_user.uid);
ASSERT_FALSE(recovery_file.empty());
ASSERT_EQ(backend.Recover(recovery_file), ci::AppInstaller::Result::OK);
namespace smoke_test {
-const bf::path kSmokePackagesDirectory =
+const fs::path kSmokePackagesDirectory =
"/usr/share/wgt-installer-ut/test_samples/smoke/";
bool ValidatePackage(const std::string& pkgid,
const std::vector<std::string>& appids,
const TestParameters& params);
-extern const bf::path kSmokePackagesDirectory;
+extern const fs::path kSmokePackagesDirectory;
class WgtBackendInterface: public BackendInterface {
public: