mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/ArangoDB/ArangoDB into devel
This commit is contained in:
commit
3d34f33f20
|
@ -105,7 +105,7 @@ static int runServer(int argc, char** argv) {
|
|||
auto options = std::make_shared<options::ProgramOptions>(
|
||||
argv[0], "Usage: " + name + " [<options>]", "For more information use:");
|
||||
|
||||
application_features::ApplicationServer server(options);
|
||||
application_features::ApplicationServer server(options, SBIN_DIRECTORY);
|
||||
|
||||
std::vector<std::string> nonServerFeatures = {
|
||||
"Action", "Affinity",
|
||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc, char* argv[]) {
|
|||
std::shared_ptr<options::ProgramOptions> options(new options::ProgramOptions(
|
||||
argv[0], "Usage: arangobench [<options>]", "For more information use:"));
|
||||
|
||||
ApplicationServer server(options);
|
||||
ApplicationServer server(options, BIN_DIRECTORY);
|
||||
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ int main(int argc, char* argv[]) {
|
|||
std::shared_ptr<options::ProgramOptions> options(new options::ProgramOptions(
|
||||
argv[0], "Usage: arangodump [<options>]", "For more information use:"));
|
||||
|
||||
ApplicationServer server(options);
|
||||
ApplicationServer server(options, BIN_DIRECTORY);
|
||||
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
|
|||
std::shared_ptr<options::ProgramOptions> options(new options::ProgramOptions(
|
||||
argv[0], "Usage: arangoimp [<options>]", "For more information use:"));
|
||||
|
||||
ApplicationServer server(options);
|
||||
ApplicationServer server(options, BIN_DIRECTORY);
|
||||
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
|
|||
std::shared_ptr<options::ProgramOptions> options(new options::ProgramOptions(
|
||||
argv[0], "Usage: arangorestore [<options>]", "For more information use:"));
|
||||
|
||||
ApplicationServer server(options);
|
||||
ApplicationServer server(options, BIN_DIRECTORY);
|
||||
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char* argv[]) {
|
|||
std::shared_ptr<options::ProgramOptions> options(new options::ProgramOptions(
|
||||
argv[0], "Usage: " + name + " [<options>]", "For more information use:"));
|
||||
|
||||
ApplicationServer server(options);
|
||||
ApplicationServer server(options, BIN_DIRECTORY);
|
||||
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
|
|||
std::shared_ptr<options::ProgramOptions> options(new options::ProgramOptions(
|
||||
argv[0], "Usage: arangovpack [<options>]", "For more information use:"));
|
||||
|
||||
ApplicationServer server(options);
|
||||
ApplicationServer server(options, BIN_DIRECTORY);
|
||||
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ void ApplicationFeature::collectOptions(std::shared_ptr<ProgramOptions>) {}
|
|||
|
||||
// load options from somewhere. this method will only be called for enabled
|
||||
// features
|
||||
void ApplicationFeature::loadOptions(std::shared_ptr<ProgramOptions>) {}
|
||||
void ApplicationFeature::loadOptions(std::shared_ptr<ProgramOptions>,
|
||||
const char* binaryPath) {}
|
||||
|
||||
// validate the feature's options. this method will only be called for active
|
||||
// features, after the ApplicationServer has determined which features should be
|
||||
|
|
|
@ -102,7 +102,8 @@ class ApplicationFeature {
|
|||
|
||||
// load options from somewhere. this method will only be called for enabled
|
||||
// features
|
||||
virtual void loadOptions(std::shared_ptr<options::ProgramOptions>);
|
||||
virtual void loadOptions(std::shared_ptr<options::ProgramOptions>,
|
||||
const char* binaryPath);
|
||||
|
||||
// validate the feature's options. this method will only be called for active
|
||||
// features, after the ApplicationServer has determined which features should
|
||||
|
|
|
@ -34,8 +34,9 @@ using namespace arangodb::options;
|
|||
|
||||
ApplicationServer* ApplicationServer::server = nullptr;
|
||||
|
||||
ApplicationServer::ApplicationServer(std::shared_ptr<ProgramOptions> options)
|
||||
: _options(options), _stopping(false) {
|
||||
ApplicationServer::ApplicationServer(std::shared_ptr<ProgramOptions> options,
|
||||
const char *binaryPath)
|
||||
: _options(options), _stopping(false), _binaryPath(binaryPath) {
|
||||
if (ApplicationServer::server != nullptr) {
|
||||
LOG(ERR) << "ApplicationServer initialized twice";
|
||||
}
|
||||
|
@ -325,7 +326,7 @@ void ApplicationServer::parseOptions(int argc, char* argv[]) {
|
|||
for (auto it = _orderedFeatures.begin(); it != _orderedFeatures.end(); ++it) {
|
||||
if ((*it)->isEnabled()) {
|
||||
LOG_TOPIC(TRACE, Logger::STARTUP) << (*it)->name() << "::loadOptions";
|
||||
(*it)->loadOptions(_options);
|
||||
(*it)->loadOptions(_options, _binaryPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,8 @@ class ApplicationServer {
|
|||
static void forceDisableFeatures(std::vector<std::string> const&);
|
||||
|
||||
public:
|
||||
explicit ApplicationServer(std::shared_ptr<options::ProgramOptions>);
|
||||
explicit ApplicationServer(std::shared_ptr<options::ProgramOptions>,
|
||||
const char *binaryPath);
|
||||
|
||||
~ApplicationServer();
|
||||
|
||||
|
@ -303,6 +304,9 @@ class ApplicationServer {
|
|||
|
||||
// help section displayed
|
||||
std::string _helpSection;
|
||||
|
||||
// the install directory of this program:
|
||||
const char* _binaryPath;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,9 @@ void ConfigFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
new BooleanParameter(&_checkConfiguration));
|
||||
}
|
||||
|
||||
void ConfigFeature::loadOptions(std::shared_ptr<ProgramOptions> options) {
|
||||
loadConfigFile(options, _progname);
|
||||
void ConfigFeature::loadOptions(std::shared_ptr<ProgramOptions> options,
|
||||
const char* binaryPath) {
|
||||
loadConfigFile(options, _progname, binaryPath);
|
||||
|
||||
if (_checkConfiguration) {
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -72,7 +73,8 @@ void ConfigFeature::loadOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
}
|
||||
|
||||
void ConfigFeature::loadConfigFile(std::shared_ptr<ProgramOptions> options,
|
||||
std::string const& progname) {
|
||||
std::string const& progname,
|
||||
const char* binaryPath) {
|
||||
if (StringUtils::tolower(_file) == "none") {
|
||||
LOG_TOPIC(DEBUG, Logger::CONFIG) << "use no config file at all";
|
||||
return;
|
||||
|
@ -151,7 +153,7 @@ void ConfigFeature::loadConfigFile(std::shared_ptr<ProgramOptions> options,
|
|||
|
||||
if (!FileUtils::exists(filename)) {
|
||||
filename =
|
||||
FileUtils::buildFilename(FileUtils::configDirectory(), basename);
|
||||
FileUtils::buildFilename(FileUtils::configDirectory(binaryPath), basename);
|
||||
|
||||
LOG_TOPIC(DEBUG, Logger::CONFIG) << "checking '" << filename << "'";
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ class ConfigFeature final : public application_features::ApplicationFeature {
|
|||
|
||||
public:
|
||||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void loadOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void loadOptions(std::shared_ptr<options::ProgramOptions>,
|
||||
const char* binaryPath) override final;
|
||||
|
||||
private:
|
||||
std::string _file;
|
||||
|
@ -41,7 +42,8 @@ class ConfigFeature final : public application_features::ApplicationFeature {
|
|||
|
||||
private:
|
||||
void loadConfigFile(std::shared_ptr<options::ProgramOptions>,
|
||||
std::string const& progname);
|
||||
std::string const& progname,
|
||||
const char* binaryPath);
|
||||
|
||||
private:
|
||||
std::string _progname;
|
||||
|
|
|
@ -592,8 +592,8 @@ std::string homeDirectory() {
|
|||
return result;
|
||||
}
|
||||
|
||||
std::string configDirectory() {
|
||||
char* dir = TRI_LocateConfigDirectory();
|
||||
std::string configDirectory(const char* binaryPath) {
|
||||
char* dir = TRI_LocateConfigDirectory(binaryPath);
|
||||
|
||||
if (dir == nullptr) {
|
||||
return currentDirectory();
|
||||
|
|
|
@ -222,7 +222,7 @@ std::string homeDirectory();
|
|||
/// @brief returns the config directory
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string configDirectory();
|
||||
std::string configDirectory(const char* binaryPath);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the base name
|
||||
|
|
|
@ -2325,10 +2325,10 @@ void TRI_SetUserTempPath(std::string const& path) { TempPath = path; }
|
|||
|
||||
#if _WIN32
|
||||
|
||||
std::string TRI_LocateInstallDirectory() {
|
||||
return TRI_LocateBinaryPath(nullptr) +
|
||||
std::string(1, TRI_DIR_SEPARATOR_CHAR) + ".." +
|
||||
std::string(1, TRI_DIR_SEPARATOR_CHAR);
|
||||
std::string TRI_LocateInstallDirectory(const char *binaryPath) {
|
||||
std::string thisPath = TRI_LocateBinaryPath(null);
|
||||
return TRI_GetInstallRoot(thisPath, binaryPath) +
|
||||
std::string(1, TRI_DIR_SEPARATOR_CHAR);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -2341,14 +2341,14 @@ std::string TRI_LocateInstallDirectory() {
|
|||
|
||||
#if _WIN32
|
||||
|
||||
char* TRI_LocateConfigDirectory() {
|
||||
char* TRI_LocateConfigDirectory(const char* binaryPath) {
|
||||
char* v = LocateConfigDirectoryEnv();
|
||||
|
||||
if (v != nullptr) {
|
||||
return v;
|
||||
}
|
||||
|
||||
std::string r = TRI_LocateInstallDirectory();
|
||||
std::string r = TRI_LocateInstallDirectory(binaryPath);
|
||||
|
||||
r += _SYSCONFDIR_;
|
||||
|
||||
|
@ -2359,7 +2359,7 @@ char* TRI_LocateConfigDirectory() {
|
|||
|
||||
#elif defined(_SYSCONFDIR_)
|
||||
|
||||
char* TRI_LocateConfigDirectory() {
|
||||
char* TRI_LocateConfigDirectory(const char* binaryPath) {
|
||||
char* v = LocateConfigDirectoryEnv();
|
||||
|
||||
if (v != nullptr) {
|
||||
|
|
|
@ -343,7 +343,7 @@ std::string TRI_LocateInstallDirectory();
|
|||
/// @brief locate the configuration directory
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char* TRI_LocateConfigDirectory();
|
||||
char* TRI_LocateConfigDirectory(const char * binaryPath);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get the address of the null buffer
|
||||
|
|
|
@ -123,7 +123,8 @@ void LoggerFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
}
|
||||
|
||||
void LoggerFeature::loadOptions(
|
||||
std::shared_ptr<options::ProgramOptions> options) {
|
||||
std::shared_ptr<options::ProgramOptions> options,
|
||||
const char *binaryPath) {
|
||||
// for debugging purpose, we set the log levels NOW
|
||||
// this might be overwritten latter
|
||||
Logger::setLogLevel(_levels);
|
||||
|
|
|
@ -33,7 +33,8 @@ class LoggerFeature final : public application_features::ApplicationFeature {
|
|||
|
||||
public:
|
||||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void loadOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void loadOptions(std::shared_ptr<options::ProgramOptions>,
|
||||
const char *binaryPath) override final;
|
||||
void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void prepare() override final;
|
||||
void unprepare() override final;
|
||||
|
|
|
@ -14,6 +14,7 @@ cd ${DIR}/..
|
|||
--buildDir build-deb \
|
||||
--targetDir /var/tmp/ \
|
||||
--jemalloc \
|
||||
--noopt \
|
||||
$@
|
||||
|
||||
cd ${DIR}/..
|
||||
|
|
|
@ -13,6 +13,7 @@ cd ${DIR}/..
|
|||
--buildDir build-rpm \
|
||||
--targetDir /var/tmp/ \
|
||||
--jemalloc \
|
||||
--noopt \
|
||||
$@
|
||||
|
||||
cd ${DIR}/..
|
||||
|
|
Loading…
Reference in New Issue