%files
%defattr(-,root,root)
-%{_datarootdir}/app-installers/plugins_list.txt
+%{_datarootdir}/parser-plugins/plugins_list.txt
%manifest app-installers.manifest
%{_libdir}/libapp-installers.so.*
%{_bindir}/pkgdir-tool
SET(PLUGINS_LIST_FILE_NAME plugins_list.txt)
SET(PLUGINS_LIST_FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/plugins/${PLUGINS_LIST_FILE_NAME})
-SET(PLUGINS_LIST_INSTALL_PATH ${SHAREDIR}/app-installers)
-SET(PLUGINS_LIST_INSTALL_FILE_PATH ${PLUGINS_LIST_INSTALL_PATH}/${PLUGINS_LIST_FILE_NAME})
+SET(PLUGINS_LIST_INSTALL_PATH ${SHAREDIR}/parser-plugins)
-ADD_DEFINITIONS("-DPLUGINS_LIST_INSTALL_FILE_PATH=\"${PLUGINS_LIST_INSTALL_FILE_PATH}\"")
+ADD_DEFINITIONS("-DPLUGINS_LIST_INSTALL_PATH=\"${PLUGINS_LIST_INSTALL_PATH}\"")
IF(NOT DEFINED TIZEN_FULL_VERSION)
MESSAGE(FATAL_ERROR "TIZEN_FULL_VERSION MUST BE defined")
ELSE(NOT DEFINED TIZEN_FULL_VERSION)
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/system/error_code.hpp>
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
namespace common_installer {
}
bool PluginsListParser::ReadLinesFromFile(std::vector<std::string>* lines) {
- std::ifstream plugins_file;
-
- plugins_file.open(path_.string());
+ for (bf::directory_iterator file(path_); file != bf::directory_iterator();
+ ++file) {
+ bs::error_code error;
+ bool is_file = bf::is_regular_file(file->path(), error);
+ if (!is_file || error)
+ continue;
+
+ std::ifstream plugins_file;
+ plugins_file.open(file->path().string());
+ if (!plugins_file.is_open()) {
+ LOG(ERROR) << "File " << file->path() << " not opened";
+ continue;
+ }
- if (!plugins_file.is_open()) {
- LOG(ERROR) << "File " << path_ << " no open";
- return false;
- }
+ LOG(INFO) << "Plugin list path: " << file->path();
- LOG(INFO) << "Plugin list path: " << path_;
+ std::string line;
+ while (plugins_file >> line)
+ lines->push_back(line);
- std::string line;
- while (plugins_file >> line) {
- lines->push_back(line);
+ plugins_file.close();
}
- plugins_file.close();
-
if (lines->empty()) {
- LOG(ERROR) << "No data in file " << path_;
+ LOG(ERROR) << "No data in files from " << path_;
return false;
}
Step::Status StepRunParserPlugin::ProcessPlugins(
const boost::filesystem::path& xml_path, manifest_x* manifest,
Plugin::ActionType action_type) {
- // PLUGINS_LIST_FILE_PATH path generated from cmake
- const std::string listPath(PLUGINS_LIST_INSTALL_FILE_PATH);
+ // PLUGINS_LIST_INSTALL_PATH path generated from cmake
+ const std::string listPath(PLUGINS_LIST_INSTALL_PATH);
PluginManager plugin_manager(xml_path.string(), listPath, manifest);
if (!plugin_manager.LoadPlugins()) {
bf::path(kPluginsTestFiles) / "libtest-category-plugin.so";
const bf::path kTestMetadataPlugin =
bf::path(kPluginsTestFiles) / "libtest-metadata-plugin.so";
+const bf::path kTestValidPluginsListDir =
+ bf::path(kPluginsTestFiles) / "valid-parser-plugins";
+const bf::path kTestInvalidPluginsListDir =
+ bf::path(kPluginsTestFiles) / "invalid-parser-plugins";
void CheckCall(
const ci::TestAssessor::ResultStore& store,
}
TEST_F(PluginTest, PluginsListParser_Valid) {
- bf::path list_file = bf::path(kPluginsTestFiles) / "test_plugin_list.txt";
- PluginsListParser parser(list_file);
+ PluginsListParser parser(kTestValidPluginsListDir);
ASSERT_TRUE(parser.Parse());
auto list = parser.PluginInfoList();
ASSERT_EQ(list.size(), 3);
}
TEST_F(PluginTest, PluginsListParser_Invalid) {
- bf::path list_file = bf::path(kPluginsTestFiles) / "invalid_plugin_list.txt";
- PluginsListParser parser(list_file);
+ PluginsListParser parser(kTestInvalidPluginsListDir);
ASSERT_FALSE(parser.Parse());
}
TestAssessor::Instance().ClearResults(); \
\
bf::path manifest = bf::path(kPluginsTestFiles) / "tizen-manifest.xml"; \
- bf::path list = bf::path(kPluginsTestFiles) / "test_plugin_list.txt"; \
+ bf::path list = kTestValidPluginsListDir; \
\
InstallerContext context; \
context.unpacked_dir_path.set(manifest.parent_path()); \
--- /dev/null
+type="metadata";name="http://developer.samsung.com/tizen/metadata/test_metadata";path="/usr/share/app-installers-ut/test_samples/plugins/libtest-metadata-plugin.so"
type="tag";name="test";path="/usr/share/app-installers-ut/test_samples/plugins/libtest-tag-plugin.so"
type="category";name="http://tizen.org/category/test_category";path="/usr/share/app-installers-ut/test_samples/plugins/libtest-category-plugin.so"
-type="metadata";name="http://developer.samsung.com/tizen/metadata/test_metadata";path="/usr/share/app-installers-ut/test_samples/plugins/libtest-metadata-plugin.so"