# Targets
SET(TARGET_LIBNAME_COMMON "common-installer")
-SET(TARGET_LIBNAME_UTILS "common-installer-utils")
SET(TARGET_LIBNAME_PARSER "manifest-parser")
SET(TARGET_LIBNAME_MANIFEST_HANDLERS "manifest-handlers")
SET(TARGET_WGT_BACKEND "wgt-backend")
SET(TARGET_XPK_BACKEND "xpk-backend")
-SET(TARGET_NATIVE_BACKEND "native-backend")
SET(TARGET_TPK_BACKEND "tpk-backend")
ADD_DEFINITIONS("-Wall")
%files
%defattr(-,root,root)
%{_libdir}/libcommon-installer.so*
-%{_libdir}/libcommon-installer-utils.so*
%{_datarootdir}/app-installers/signature_schema.xsd
%license LICENSE
ADD_SUBDIRECTORY(common)
-ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(wgt)
ADD_SUBDIRECTORY(tpk)
#ADD_SUBDIRECTORY(xpk)
-#ADD_SUBDIRECTORY(native)
ADD_SUBDIRECTORY(unit_tests)
step/step_unregister_app.cc
step/step_update_app.cc
step/step_update_security.cc
+ utils/file_util.cc
+ utils/string_util.cc
)
# Target - definition
ADD_LIBRARY(${TARGET_LIBNAME_COMMON} SHARED ${SRCS})
TZPLATFORM_CONFIG_DEPS
LIBXML_DEPS
CERT_SVC_DEPS_VCORE
+ MINIZIP_DEPS
+ ZLIB_DEPS
Boost
)
-# Target in-package deps
-TARGET_LINK_LIBRARIES(${TARGET_LIBNAME_COMMON} PUBLIC ${TARGET_LIBNAME_UTILS})
# Extra
SET_TARGET_PROPERTIES(${TARGET_LIBNAME_COMMON} PROPERTIES VERSION ${VERSION})
#include "common/context_installer.h"
#include "common/pkgmgr_interface.h"
#include "common/pkgmgr_signal.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace {
#include "common/pkgmgr_signal.h"
#include "common/step/step.h"
-#include "utils/logging.h"
-#include "utils/macros.h"
+#include "common/utils/logging.h"
+#include "common/utils/macros.h"
namespace common_installer {
#include <memory>
#include "common/app_query_interface.h"
-#include "utils/macros.h"
-#include "utils/logging.h"
+#include "common/utils/macros.h"
+#include "common/utils/logging.h"
namespace common_installer {
#include <cassert>
-#include "utils/logging.h"
+#include "common/utils/logging.h"
// Redefine this value as it is not exported by pkgmgr
// this should probably be in public interface because of
#include <string>
#include "common/step/step.h"
-#include "utils/macros.h"
+#include "common/utils/macros.h"
namespace common_installer {
#include <security-manager.h>
-#include "utils/clist_helpers.h"
-#include "utils/logging.h"
+#include "common/utils/clist_helpers.h"
+#include "common/utils/logging.h"
namespace bf = boost::filesystem;
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace backup_icons {
#include <string>
-#include "utils/file_util.h"
-#include "utils/logging.h"
+#include "common/utils/file_util.h"
+#include "common/utils/logging.h"
namespace bf = boost::filesystem;
namespace bs = boost::system;
backup_xml_path = + ".bck";
context_->backup_xml_path.set(backup_xml_path);
- if (!utils::MoveFile(context_->xml_path.get(),
+ if (!MoveFile(context_->xml_path.get(),
context_->backup_xml_path.get())) {
LOG(ERROR) << "Failed to make a copy of xml manifest file";
return Status::ERROR;
LOG(ERROR) << "Failed to remove newly generated xml file in revert";
return Status::ERROR;
}
- if (!utils::MoveFile(context_->backup_xml_path.get(),
+ if (!MoveFile(context_->backup_xml_path.get(),
context_->xml_path.get())) {
LOG(ERROR) << "Failed to revert a content of xml manifest file";
return Status::ERROR;
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace backup_manifest {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace signature {
#include <string>
#include "common/pkgmgr_interface.h"
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace common_installer {
namespace configure {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace configure {
#include <cstring>
#include <string>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace common_installer {
namespace copy {
<< install_path.parent_path().string();
return Step::Status::ERROR;
}
- if (!utils::MoveDir(context_->unpacked_dir_path.get(), install_path)) {
+ if (!MoveDir(context_->unpacked_dir_path.get(), install_path)) {
LOG(ERROR) << "Cannot move widget directory to install path";
return Status::ERROR;
}
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace copy {
#include <cassert>
#include <string>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace common_installer {
namespace copy_backup {
backup_path_ = GetBackupPathForPackagePath(context_->pkg_path.get());
// backup old content
- if (!utils::MoveDir(context_->pkg_path.get(), backup_path_)) {
+ if (!MoveDir(context_->pkg_path.get(), backup_path_)) {
LOG(ERROR) << "Fail to backup widget directory";
return Step::Status::ERROR;
}
LOG(ERROR) << "Cannot create widget directory";
return Status::ERROR;
}
- if (!utils::MoveDir(context_->unpacked_dir_path.get(), install_path_)) {
+ if (!MoveDir(context_->unpacked_dir_path.get(), install_path_)) {
LOG(ERROR) << "Fail to copy tmp dir: " << context_->unpacked_dir_path.get()
<< " to dst dir: " << install_path_;
return Step::Status::ERROR;
}
}
- if (!utils::MoveDir(backup_path_, context_->pkg_path.get())) {
+ if (!MoveDir(backup_path_, context_->pkg_path.get())) {
return false;
}
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace copy_backup {
bf::path data_path = pkg_path / kDataLocation;
bf::path data_backup_path = backup_path / kDataLocation;
- if (!common_installer::utils::CopyDir(data_backup_path, data_path)) {
+ if (!common_installer::CopyDir(data_backup_path, data_path)) {
LOG(ERROR) << "Failed to restore private directory for widget in update";
return false;
}
bf::path shared_path = pkg_path / kSharedLocation;
bf::path shared_backup_path = backup_path / kSharedLocation;
- if (!common_installer::utils::CopyDir(shared_backup_path, shared_path)) {
+ if (!common_installer::CopyDir(shared_backup_path, shared_path)) {
LOG(ERROR) << "Failed to restore shared directory for widget in update";
return false;
}
#include <cstring>
#include <string>
-#include "utils/clist_helpers.h"
-#include "utils/file_util.h"
+#include "common/utils/clist_helpers.h"
+#include "common/utils/file_util.h"
namespace fs = boost::filesystem;
// and located in TZ_USER_ICON/TZ_SYS_ICON
// if the icon isn't exist print the default icon app-installers.png
icon_path_ = fs::path(getIconPath(context_->uid.get()));
- utils::CreateDir(icon_path_);
+ CreateDir(icon_path_);
fs::path icon = fs::path(app->appid) += fs::path(".png");
if (app->icon->name) {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace generate_xml {
#include <pkgmgr-info.h>
#include <string>
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace old_manifest {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace old_manifest {
#include <cstdio>
#include <string>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace common_installer {
namespace parse {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace parse {
#include <cstdio>
#include <string>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace register_app {
#define COMMON_STEP_STEP_REGISTER_SECURITY_H_
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace security {
#include <cstring>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace common_installer {
namespace remove {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace remove {
#define COMMON_STEP_STEP_REVOKE_SECURITY_H_
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace revoke_security {
#include <cstring>
#include "common/step/step_unregister_app.h"
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace common_installer {
namespace unregister_app {
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace unregister_app {
#include <cstring>
#include <string>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace bf = boost::filesystem;
namespace bs = boost::system;
Step::Status StepUnzip::process() {
bf::path tmp_dir =
- utils::GenerateTmpDir(context_->root_application_path.get());
+ GenerateTmpDir(context_->root_application_path.get());
- if (!utils::CreateDir(tmp_dir)) {
+ if (!CreateDir(tmp_dir)) {
LOG(ERROR) << "Failed to create temp directory: " << tmp_dir;
return Step::Status::ERROR;
}
int64_t required_size =
- utils::GetUnpackedPackageSize(context_->file_path.get());
+ GetUnpackedPackageSize(context_->file_path.get());
if (required_size == -1) {
LOG(ERROR) << "Couldn't get uncompressed size for package: "
return Step::Status::OUT_OF_SPACE;
}
- if (!utils::ExtractToTmpDir(context_->file_path.get().string().c_str(),
+ if (!ExtractToTmpDir(context_->file_path.get().string().c_str(),
tmp_dir)) {
LOG(ERROR) << "Failed to process unpack step";
return Step::Status::ERROR;
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace unzip {
#include <cstring>
#include <string>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace bf = boost::filesystem;
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace update_app {
#define COMMON_STEP_STEP_UPDATE_SECURITY_H_
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace common_installer {
namespace update_security {
// Use of this source code is governed by a apache 2.0 license that can be
// found in the LICENSE file.
-#ifndef UTILS_BYTE_SIZE_LITERALS_H_
-#define UTILS_BYTE_SIZE_LITERALS_H_
+#ifndef COMMON_UTILS_BYTE_SIZE_LITERALS_H_
+#define COMMON_UTILS_BYTE_SIZE_LITERALS_H_
constexpr unsigned long long operator"" _kB(unsigned long long v) { // NOLINT
return v * (1 << 10);
return v * (1 << 30);
}
-#endif // UTILS_BYTE_SIZE_LITERALS_H_
+#endif // COMMON_UTILS_BYTE_SIZE_LITERALS_H_
// Use of this source code is governed by an apache 2.0 license that can be
// found in the LICENSE file.
-#ifndef UTILS_CLIST_HELPERS_H_
-#define UTILS_CLIST_HELPERS_H_
+#ifndef COMMON_UTILS_CLIST_HELPERS_H_
+#define COMMON_UTILS_CLIST_HELPERS_H_
#include "pkgmgr/pkgmgr_parser.h"
} \
} while (0) \
-#endif // UTILS_CLIST_HELPERS_H_
+#endif // COMMON_UTILS_CLIST_HELPERS_H_
/* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <string>
-#include "utils/byte_size_literals.h"
-#include "utils/logging.h"
+#include "common/utils/byte_size_literals.h"
+#include "common/utils/logging.h"
namespace bs = boost::system;
namespace bf = boost::filesystem;
} // namespace
namespace common_installer {
-namespace utils {
bool CreateDir(const bf::path& path) {
if (bf::exists(path))
bf::rename(src, dst, error);
if (error) {
LOG(WARNING) << "Cannot move directory: " << src << ". Will copy/remove...";
- if (!utils::CopyDir(src, dst)) {
+ if (!CopyDir(src, dst)) {
LOG(ERROR) << "Cannot copy directory: " << src;
return false;
}
std::string(raw_file_name_in_zip).find(filter_prefix) == 0) {
bf::path filename_in_zip_path(raw_file_name_in_zip);
if (!filename_in_zip_path.parent_path().empty()) {
- if (!utils::CreateDir(filename_in_zip_path.parent_path())) {
+ if (!CreateDir(filename_in_zip_path.parent_path())) {
LOG(ERROR) << "Failed to create directory: "
<< filename_in_zip_path.parent_path();
return false;
return true;
}
-} // namespace utils
} // namespace common_installer
/* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */
-#ifndef UTILS_FILE_UTIL_H_
-#define UTILS_FILE_UTIL_H_
+#ifndef COMMON_UTILS_FILE_UTIL_H_
+#define COMMON_UTILS_FILE_UTIL_H_
#include <boost/filesystem.hpp>
#include <string>
namespace common_installer {
-namespace utils {
bool CreateDir(const boost::filesystem::path& path);
const boost::filesystem::path& tmp_dir,
const std::string& filter_prefix);
-} // namespace utils
} // namespace common_installer
-#endif // UTILS_FILE_UTIL_H_
+#endif // COMMON_UTILS_FILE_UTIL_H_
// Use of this source code is governed by a apache 2.0 license that can be
// found in the LICENSE file.
-#ifndef UTILS_LOGGING_H_
-#define UTILS_LOGGING_H_
+#ifndef COMMON_UTILS_LOGGING_H_
+#define COMMON_UTILS_LOGGING_H_
#include <cassert>
#include <iomanip>
#include <iostream>
#include <sstream>
-namespace utils {
+namespace common_installer {
enum class LogLevel {
LOG_ERROR,
}
};
-} // namespace utils
+} // namespace common_installer
inline static const constexpr char* __tag_for_logging() {
return "";
// where:
// LEVEL = ERROR | WARNING | INFO | DEBUG
#define LOG(LEVEL) \
- ::utils::LogCatcher() & std::ostringstream() \
- << ::utils::LogTag<::utils::LogLevel::LOG_ ## LEVEL>::value \
+ ::common_installer::LogCatcher() & std::ostringstream() \
+ << ::common_installer::LogTag< \
+ ::common_installer::LogLevel::LOG_ ## LEVEL>::value \
<< " " << std::setw(20) << std::left << __tag_for_logging() \
<< std::setw(0) << " : " \
-#endif // UTILS_LOGGING_H_
+#endif // COMMON_UTILS_LOGGING_H_
// Use of this source code is governed by a apache 2.0 license that can be
// found in the LICENSE file.
-#ifndef UTILS_MACROS_H_
-#define UTILS_MACROS_H_
+#ifndef COMMON_UTILS_MACROS_H_
+#define COMMON_UTILS_MACROS_H_
#define DISALLOW_COPY_AND_ASSIGN(CLASS) \
CLASS(const CLASS&) = delete; \
#define DEPRECATED __attribute__ ((__deprecated__))
-#endif // UTILS_MACROS_H_
+#endif // COMMON_UTILS_MACROS_H_
// This file was rewritten completely in
// 7c807fc0d4561d178b7c2d8b8d532f48e78ab1bc so fixing license.
-#include "utils/string_util.h"
+#include "common/utils/string_util.h"
#include <cstdlib>
#include <string>
#include <vector>
namespace common_installer {
-namespace utils {
std::string DecodePercentEscapedCharacter(const std::string& path) {
std::vector<int> input(path.begin(), path.end());
return std::string(output.begin(), output.end());
}
-} // namespace utils
} // namespace common_installer
// Use of this source code is governed by a apache 2.0 license that can be
// found in the LICENSE file.
-#ifndef UTILS_STRING_UTIL_H_
-#define UTILS_STRING_UTIL_H_
+#ifndef COMMON_UTILS_STRING_UTIL_H_
+#define COMMON_UTILS_STRING_UTIL_H_
#include <string>
namespace common_installer {
-namespace utils {
std::string DecodePercentEscapedCharacter(const std::string& path);
-} // namespace utils
} // namespace common_installer
-#endif // UTILS_STRING_UTIL_H_
+#endif // COMMON_UTILS_STRING_UTIL_H_
+++ /dev/null
-# Target - sources
-SET(SRCS
- tpk-backend.cc
-)
-# Target - definition
-ADD_EXECUTABLE(${TARGET_NATIVE_BACKEND} ${SRCS})
-# Target - includes
-TARGET_INCLUDE_DIRECTORIES(${TARGET_NATIVE_BACKEND} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../")
-# Target - deps
-APPLY_PKG_CONFIG(${TARGET_NATIVE_BACKEND} PUBLIC
- PKGMGR_INSTALLER_DEPS
-)
-# Target - in-package deps
-TARGET_LINK_LIBRARIES(${TARGET_NATIVE_BACKEND} PUBLIC ${TARGET_LIBNAME_COMMON})
-
-# Install
-INSTALL(TARGETS ${TARGET_NATIVE_BACKEND} DESTINATION ${BINDIR})
/* Copyright 2015 Samsung Electronics, license APACHE-2.0, see LICENSE file */
#include <iostream>
#include "tpk/task.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
int main(const int argc, char* argv[]) {
#include "common/step/step.h"
#include "common/app_installer.h"
#include "common/context_installer.h"
-#include "utils/file_util.h"
-#include "utils/logging.h"
+#include "common/utils/file_util.h"
+#include "common/utils/logging.h"
namespace tpk {
fs::path bindir = context->pkg_path.get() / fs::path(app->appid) /
fs::path("bin");
LOG(INFO) << "Creating dir: " << bindir;
- if (!common_installer::utils::CreateDir(bindir)) {
+ if (!common_installer::CreateDir(bindir)) {
LOG(ERROR) << "Directory creation failure";
return false;
}
#include <vector>
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
#include "xml_parser/xml_parser.h"
using std::vector;
#include "common/step/step_update_security.h"
#include "tpk/step/step_parse.h"
#include "tpk/step/step_create_symbolic_link.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
#endif
+++ /dev/null
-# Target - sources
-SET(SRCS
- file_util.cc
- string_util.cc
-)
-# Target - definition
-ADD_LIBRARY(${TARGET_LIBNAME_UTILS} SHARED ${SRCS})
-# Target - includes
-TARGET_INCLUDE_DIRECTORIES(${TARGET_LIBNAME_UTILS} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../")
-
-# Target - deps
-APPLY_PKG_CONFIG(${TARGET_LIBNAME_UTILS} PUBLIC
- MINIZIP_DEPS
- ZLIB_DEPS
- Boost
-)
-
-# Extra
-SET_TARGET_PROPERTIES(${TARGET_LIBNAME_UTILS} PROPERTIES VERSION ${VERSION})
-SET_TARGET_PROPERTIES(${TARGET_LIBNAME_UTILS} PROPERTIES SOVERSION ${VERSION_MAJOR})
-
-# Install
-INSTALL(TARGETS ${TARGET_LIBNAME_UTILS} DESTINATION ${LIB_INSTALL_DIR})
# Target - in-package deps
TARGET_LINK_LIBRARIES(${TARGET_WGT_BACKEND} PUBLIC ${TARGET_LIBNAME_COMMON})
-TARGET_LINK_LIBRARIES(${TARGET_WGT_BACKEND} PUBLIC ${TARGET_LIBNAME_UTILS})
# Install
INSTALL(TARGETS ${TARGET_WGT_BACKEND} DESTINATION ${BINDIR})
#include <cstdio>
#include <string>
-#include "utils/file_util.h"
+#include "common/utils/file_util.h"
namespace wgt {
namespace symbolic_link {
fs::path exec_path =
context_->pkg_path.get() / fs::path(ui->appid)
/ fs::path("bin");
- common_installer::utils::CreateDir(exec_path);
+ common_installer::CreateDir(exec_path);
exec_path /= fs::path(ui->appid);
fs::path exec_path =
context_->pkg_path.get() / fs::path(svc->appid)/
fs::path("bin");
- common_installer::utils::CreateDir(exec_path);
+ common_installer::CreateDir(exec_path);
exec_path /= fs::path(svc->appid);
#include "common/app_installer.h"
#include "common/context_installer.h"
#include "common/step/step.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace wgt {
namespace symbolic_link {
#include "manifest_handlers/tizen_application_handler.h"
#include "manifest_handlers/widget_handler.h"
#include "manifest_parser/manifest_parser.h"
-#include "utils/logging.h"
+#include "common/utils/logging.h"
namespace wgt {
namespace parse {
#include <utility>
#include <vector>
-#include "utils/file_util.h"
-#include "utils/logging.h"
+#include "common/utils/file_util.h"
+#include "common/utils/logging.h"
namespace bf = boost::filesystem;
namespace bs = boost::system;
}
std::string GetAppIdFromPath(const std::string& path) {
- bf::path tmp_path = common_installer::utils::GenerateTmpDir("/tmp");
+ bf::path tmp_path = common_installer::GenerateTmpDir("/tmp");
bs::error_code code;
bf::create_directories(tmp_path, code);
if (code)
return {};
- if (!common_installer::utils::ExtractToTmpDir(path.c_str(), tmp_path,
+ if (!common_installer::ExtractToTmpDir(path.c_str(), tmp_path,
"config.xml")) {
bf::remove_all(tmp_path, code);
return {};