1
0
Fork 0

added devel relative paths

This commit is contained in:
Frank Celler 2012-03-13 13:44:14 +01:00
parent 1c3b7d6b49
commit 8360203aff
8 changed files with 132 additions and 88 deletions

View File

@ -90,12 +90,6 @@ ApplicationAdminServer::ApplicationAdminServer ()
_version(),
_versionData(0) {
_pathOptions = new PathHandler::Options();
#ifndef TRI_ENABLE_RELATIVE
#ifdef _PKGDATADIR_
_adminDirectory = string(_PKGDATADIR_) + "/html/admin";
#endif
#endif
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -42,10 +42,16 @@
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief enable relative paths
/// @brief enable relative system paths
////////////////////////////////////////////////////////////////////////////////
#undef TRI_ENABLE_RELATIVE
#undef TRI_ENABLE_RELATIVE_SYSTEM
////////////////////////////////////////////////////////////////////////////////
/// @brief enable relative development paths
////////////////////////////////////////////////////////////////////////////////
#undef TRI_ENABLE_RELATIVE_DEVEL
////////////////////////////////////////////////////////////////////////////////
/// @brief enable calculation of timing figures

View File

@ -201,15 +201,36 @@ AvocadoServer::AvocadoServer (int argc, char** argv)
}
}
#ifdef TRI_ENABLE_RELATIVE
// .............................................................................
// use relative system paths
// .............................................................................
#ifdef TRI_ENABLE_RELATIVE_SYSTEM
_workingDirectory = _binaryPath + "/../tmp";
_systemActionPath = _binaryPath + "/../share/avocado/js/system";
_startupModules = _binaryPath + "/../share/avocado/js/modules";
_systemActionPath = _binaryPath + "/../share/avocado/js/actions/system";
_startupModules = _binaryPath + "/../share/avocado/js/server/modules"
+ ";" + _binaryPath + "/../share/avocado/js/common/modules";
_databasePath = _binaryPath + "/../var/avocado";
#else
// .............................................................................
// use relative development paths
// .............................................................................
#ifdef TRI_ENABLE_RELATIVE_DEVEL
_systemActionPath = _binaryPath + "/js/actions/system";
_startupModules = _binaryPath + "/js/server/modules"
+ ";" + _binaryPath + "/js/common/modules";
#else
// .............................................................................
// use absolute paths
// .............................................................................
_workingDirectory = "/var/tmp";
#ifdef _PKGDATADIR_
@ -221,6 +242,7 @@ AvocadoServer::AvocadoServer (int argc, char** argv)
_databasePath = _DATABASEDIR_;
#endif
#endif
#endif
}
@ -244,12 +266,6 @@ AvocadoServer::AvocadoServer (int argc, char** argv)
void AvocadoServer::buildApplicationServer () {
_applicationServer = ApplicationServerDispatcher::create("[<options>] <database-directory>", TRIAGENS_VERSION);
#ifdef TRI_ENABLE_RELATIVE
_applicationServer->setSystemConfigFile("avocado.conf", _binaryPath + "/../etc/");
#else
_applicationServer->setSystemConfigFile("avocado.conf");
#endif
_applicationServer->setUserConfigFile(".avocado/avocado.conf");
// .............................................................................
@ -265,15 +281,40 @@ void AvocadoServer::buildApplicationServer () {
_applicationAdminServer = ApplicationAdminServer::create(_applicationServer);
_applicationServer->addFeature(_applicationAdminServer);
#ifdef TRI_ENABLE_RELATIVE
_applicationAdminServer->allowAdminDirectory(_binaryPath + "/../share/avocado/html/admin");
#else
_applicationAdminServer->allowAdminDirectory();
#endif
_applicationAdminServer->allowLogViewer();
_applicationAdminServer->allowVersion("avocado", TRIAGENS_VERSION);
// .............................................................................
// use relative system paths
// .............................................................................
#ifdef TRI_ENABLE_RELATIVE_SYSTEM
_applicationServer->setSystemConfigFile("avocado.conf", _binaryPath + "/../etc/");
_applicationAdminServer->allowAdminDirectory(_binaryPath + "/../share/avocado/html/admin");
#else
// .............................................................................
// use relative development paths
// .............................................................................
#ifdef TRI_ENABLE_RELATIVE_DEVEL
_applicationAdminServer->allowAdminDirectory(_binaryPath + "/html/admin");
#else
// .............................................................................
// use absolute paths
// .............................................................................
_applicationServer->setSystemConfigFile("avocado.conf");
_applicationAdminServer->allowAdminDirectory(string(_PKGDATADIR_) + "/html/admin");
#endif
#endif
// .............................................................................
// a http server
// .............................................................................

View File

@ -1212,6 +1212,7 @@ static void FilterDataHashQuery(collection_cursor_t* cursor,TRI_query_t* query,
HashIndexElements* hashElements;
TRI_doc_mptr_t* wtr;
TRI_doc_mptr_t* doc;
size_t j;
cursor->base._context = context;
cursor->base._select = query->_select->clone(query->_select);
@ -1260,7 +1261,7 @@ static void FilterDataHashQuery(collection_cursor_t* cursor,TRI_query_t* query,
cursor->_current = 0;
cursor->_currentRow = 0;
for (size_t j = 0; j < hashElements->_numElements; ++j) {
for (j = 0; j < hashElements->_numElements; ++j) {
// should not be necessary to check that documents have not been deleted
doc = (TRI_doc_mptr_t*)((hashElements->_elements[j]).data);
if (doc->_deletion) {
@ -1305,6 +1306,7 @@ static void FilterDataSLQuery(collection_cursor_t* cursor,TRI_query_t* query,
SkiplistIndexElements* skiplistElements;
TRI_doc_mptr_t* wtr;
TRI_doc_mptr_t* doc;
size_t j;
cursor->base._context = context;
cursor->base._select = query->_select->clone(query->_select);
@ -1353,7 +1355,7 @@ static void FilterDataSLQuery(collection_cursor_t* cursor,TRI_query_t* query,
cursor->_current = 0;
cursor->_currentRow = 0;
for (size_t j = 0; j < skiplistElements->_numElements; ++j) {
for (j = 0; j < skiplistElements->_numElements; ++j) {
// should not be necessary to check that documents have not been deleted
doc = (TRI_doc_mptr_t*)((skiplistElements->_elements[j]).data);
if (doc->_deletion) {

View File

@ -1186,6 +1186,7 @@ static bool OpenIndexIterator (char const* filename, void* data) {
char fieldChar[30];
char* error;
int intCount;
int j;
// load json description of the index
json = TRI_JsonFile(filename, &error);
@ -1311,7 +1312,7 @@ static bool OpenIndexIterator (char const* filename, void* data) {
TRI_InitVector(&attributes, sizeof(char*));
// find fields
for (int j = 0; j < intCount; ++j) {
for (j = 0; j < intCount; ++j) {
sprintf(fieldChar, "field_%i", j);
fieldStr = TRI_LookupArrayJson(json, fieldChar);
@ -2352,6 +2353,7 @@ static TRI_index_t* CreateHashIndexSimCollection (TRI_sim_collection_t* collecti
TRI_shaper_t* shaper;
TRI_vector_t shapes;
bool ok;
size_t j;
idx = NULL;
shaper = collection->base._shaper;
@ -2362,7 +2364,7 @@ static TRI_index_t* CreateHashIndexSimCollection (TRI_sim_collection_t* collecti
// Determine the shape ids for the attributes
// ...........................................................................
for (size_t j = 0; j < attributes->_length; ++j) {
for (j = 0; j < attributes->_length; ++j) {
char* shapeString;
TRI_shape_pid_t shape;
@ -2438,6 +2440,7 @@ static TRI_index_t* CreateSkiplistIndexSimCollection (TRI_sim_collection_t* coll
TRI_index_t* idx = NULL;
TRI_shaper_t* shaper = collection->base._shaper;
TRI_vector_t shapes;
size_t j;
TRI_InitVector(&shapes, sizeof(TRI_shape_pid_t));
@ -2445,7 +2448,7 @@ static TRI_index_t* CreateSkiplistIndexSimCollection (TRI_sim_collection_t* coll
// ...........................................................................
// Determine the shape ids for the attributes
// ...........................................................................
for (size_t j = 0; j < attributes->_length; ++j) {
for (j = 0; j < attributes->_length; ++j) {
char* shapeString = *((char**)(TRI_AtVector(attributes,j)));
TRI_shape_pid_t shape = shaper->findAttributePathByName(shaper, shapeString);
TRI_PushBackVector(&shapes,&shape);
@ -2580,6 +2583,7 @@ TRI_index_t* TRI_LookupGeoIndex2SimCollection (TRI_sim_collection_t* collection,
TRI_index_t* TRI_LookupHashIndexSimCollection (TRI_sim_collection_t* collection,
const TRI_vector_t* shapes) {
TRI_index_t* matchedIndex = NULL;
size_t j, k;
// ...........................................................................
// Note: This function does NOT differentiate between non-unique and unique
@ -2592,7 +2596,7 @@ TRI_index_t* TRI_LookupHashIndexSimCollection (TRI_sim_collection_t* collection,
// go through every index and see if we have a match
// ...........................................................................
for (size_t j = 0; j < collection->_indexes._length; ++j) {
for (j = 0; j < collection->_indexes._length; ++j) {
TRI_index_t* idx = collection->_indexes._buffer[j];
TRI_hash_index_t* hashIndex = (TRI_hash_index_t*) idx;
bool found = true;
@ -2621,7 +2625,7 @@ TRI_index_t* TRI_LookupHashIndexSimCollection (TRI_sim_collection_t* collection,
// Go through all the attributes and see if they match
// .........................................................................
for (size_t k = 0; k < shapes->_length; ++k) {
for (k = 0; k < shapes->_length; ++k) {
TRI_shape_pid_t field = *((TRI_shape_pid_t*)(TRI_AtVector(hashIndex->_shapeList,k)));
TRI_shape_pid_t shape = *((TRI_shape_pid_t*)(TRI_AtVector(shapes,k)));
if (field != shape) {
@ -2648,6 +2652,7 @@ TRI_index_t* TRI_LookupHashIndexSimCollection (TRI_sim_collection_t* collection,
TRI_index_t* TRI_LookupSkiplistIndexSimCollection (TRI_sim_collection_t* collection,
const TRI_vector_t* shapes) {
TRI_index_t* matchedIndex = NULL;
size_t j, k;
// ...........................................................................
// Note: This function does NOT differentiate between non-unique and unique
@ -2660,7 +2665,7 @@ TRI_index_t* TRI_LookupSkiplistIndexSimCollection (TRI_sim_collection_t* collect
// go through every index and see if we have a match
// ...........................................................................
for (size_t j = 0; j < collection->_indexes._length; ++j) {
for (j = 0; j < collection->_indexes._length; ++j) {
TRI_index_t* idx = collection->_indexes._buffer[j];
TRI_skiplist_index_t* skiplistIndex = (TRI_skiplist_index_t*) idx;
bool found = true;
@ -2689,7 +2694,7 @@ TRI_index_t* TRI_LookupSkiplistIndexSimCollection (TRI_sim_collection_t* collect
// Go through all the attributes and see if they match
// .........................................................................
for (size_t k = 0; k < shapes->_length; ++k) {
for (k = 0; k < shapes->_length; ++k) {
TRI_shape_pid_t field = *((TRI_shape_pid_t*)(TRI_AtVector(skiplistIndex->_shapeList,k)));
TRI_shape_pid_t shape = *((TRI_shape_pid_t*)(TRI_AtVector(shapes,k)));
if (field != shape) {

72
configure vendored
View File

@ -729,8 +729,6 @@ build_cpu
build
ENABLE_INSTALL_DBDIR_FALSE
ENABLE_INSTALL_DBDIR_TRUE
ENABLE_RELATIVE_FALSE
ENABLE_RELATIVE_TRUE
ENABLE_ALL_IN_ONE_FALSE
ENABLE_ALL_IN_ONE_TRUE
ENABLE_FLEX_FALSE
@ -781,8 +779,8 @@ enable_option_checking
enable_bison
enable_flex
enable_all_in_one
enable_relative
enable_install_dbdir
enable_relative
enable_silent_rules
enable_dependency_tracking
enable_error_on_warning
@ -1452,8 +1450,9 @@ Optional Features:
--enable-bison enable BISON
--enable-flex enable FLEX
--enable-all-in-one enable supplied V8, BOOST, LIBEV
--enable-relative all path are relative to the binary
--enable-install-dbdir install an empty database directory
--enable-relative all path are relative to the binary (yes/no/devel
[default])
--enable-silent-rules less verbose build output (undo: `make V=1')
--disable-silent-rules verbose build output (undo: `make V=0')
--disable-dependency-tracking speeds up one-time build
@ -2575,32 +2574,6 @@ else
fi
# Check whether --enable-relative was given.
if test "${enable_relative+set}" = set; then :
enableval=$enable_relative; tr_RELATIVE="${enableval:-yes}"
else
tr_RELATIVE=no
fi
if test "x$tr_RELATIVE" = xyes; then
cat >>confdefs.h <<_ACEOF
#define TRI_ENABLE_RELATIVE 1
_ACEOF
fi
if test "x$tr_RELATIVE" = xyes; then
ENABLE_RELATIVE_TRUE=
ENABLE_RELATIVE_FALSE='#'
else
ENABLE_RELATIVE_TRUE='#'
ENABLE_RELATIVE_FALSE=
fi
# Check whether --enable-install-dbdir was given.
if test "${enable_install_dbdir+set}" = set; then :
enableval=$enable_install_dbdir; tr_DBDIR="${enableval:-yes}"
@ -2619,6 +2592,31 @@ else
fi
# Check whether --enable-relative was given.
if test "${enable_relative+set}" = set; then :
enableval=$enable_relative; tr_RELATIVE="${enableval:-devel}"
else
tr_RELATIVE=devel
fi
if test "x$tr_RELATIVE" = xyes; then
cat >>confdefs.h <<_ACEOF
#define TRI_ENABLE_RELATIVE_SYSTEM 1
_ACEOF
else
if test "x$tr_RELATIVE" = xdevel; then
cat >>confdefs.h <<_ACEOF
#define TRI_ENABLE_RELATIVE_DEVEL 1
_ACEOF
fi
fi
@ -5293,7 +5291,7 @@ fi
if test x$GCC == xyes; then
WALL="-pedantic -Wall -Winit-self -Wno-long-long"
WALL="-Wall -Winit-self -Wno-long-long -Wno-variadic-macros"
if test x$tr_WERROR == xyes; then
WALL="${WALL} -Werror"
@ -5304,7 +5302,7 @@ if test x$GCC == xyes; then
fi
WALLC="${WALL} -Wshadow -Wstrict-prototypes -Wdeclaration-after-statement"
WALLCXX="${WALL} -Woverloaded-virtual -Wno-variadic-macros"
WALLCXX="${WALL} -Woverloaded-virtual"
case $CXX in
*clang++*)
@ -5319,7 +5317,7 @@ if test x$GCC == xyes; then
WALLCXX="${WALLCXX} -Weffc++"
fi
CFLAGS="${CFLAGS} -std=gnu99 ${WALLC}"
CFLAGS="${CFLAGS} -std=gnu90 ${WALLC}"
CXXFLAGS="${CXXFLAGS} ${WALLCXX}"
fi
@ -6752,8 +6750,8 @@ else
BASIC_INFO="$BASIC_INFO|BISON: disabled"
fi
if test "x$tr_RELATIVE" = xyes; then
BASIC_INFO="$BASIC_INFO|RELATIVE PATHS: enabled"
if test "x$tr_RELATIVE" != xno; then
BASIC_INFO="$BASIC_INFO|RELATIVE PATHS: $tr_RELATIVE"
else
BASIC_INFO="$BASIC_INFO|RELATIVE PATHS: disabled"
fi
@ -9306,10 +9304,6 @@ if test -z "${ENABLE_ALL_IN_ONE_TRUE}" && test -z "${ENABLE_ALL_IN_ONE_FALSE}";
as_fn_error $? "conditional \"ENABLE_ALL_IN_ONE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_RELATIVE_TRUE}" && test -z "${ENABLE_RELATIVE_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_RELATIVE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_INSTALL_DBDIR_TRUE}" && test -z "${ENABLE_INSTALL_DBDIR_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_INSTALL_DBDIR\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@ -43,18 +43,6 @@ AC_ARG_ENABLE(all-in-one,
AM_CONDITIONAL(ENABLE_ALL_IN_ONE, test "x$tr_ALL_IN_ONE" = xyes)
AC_ARG_ENABLE(relative,
AS_HELP_STRING([--enable-relative], [all path are relative to the binary]),
[tr_RELATIVE="${enableval:-yes}"],
[tr_RELATIVE=no]
)
if test "x$tr_RELATIVE" = xyes; then
AC_DEFINE_UNQUOTED(TRI_ENABLE_RELATIVE, 1, [true if relative paths should be used])
fi
AM_CONDITIONAL(ENABLE_RELATIVE, test "x$tr_RELATIVE" = xyes)
AC_ARG_ENABLE(install-dbdir,
AS_HELP_STRING([--enable-install-dbdir], [install an empty database directory]),
[tr_DBDIR="${enableval:-yes}"],
@ -63,6 +51,20 @@ AC_ARG_ENABLE(install-dbdir,
AM_CONDITIONAL(ENABLE_INSTALL_DBDIR, test "x$tr_DBDIR" = xyes)
AC_ARG_ENABLE(relative,
AS_HELP_STRING([--enable-relative], [all path are relative to the binary (yes/no/devel [default])]),
[tr_RELATIVE="${enableval:-devel}"],
[tr_RELATIVE=devel]
)
if test "x$tr_RELATIVE" = xyes; then
AC_DEFINE_UNQUOTED(TRI_ENABLE_RELATIVE_SYSTEM, 1, [true if relative system paths should be used])
else
if test "x$tr_RELATIVE" = xdevel; then
AC_DEFINE_UNQUOTED(TRI_ENABLE_RELATIVE_DEVEL, 1, [true if relative development paths should be used])
fi
fi
dnl ============================================================================
dnl CHECKS HOST, PROGRAMS, COMPILER, LIB, SYSTEM
dnl ============================================================================
@ -91,8 +93,8 @@ else
BASIC_INFO="$BASIC_INFO|BISON: disabled"
fi
if test "x$tr_RELATIVE" = xyes; then
BASIC_INFO="$BASIC_INFO|RELATIVE PATHS: enabled"
if test "x$tr_RELATIVE" != xno; then
BASIC_INFO="$BASIC_INFO|RELATIVE PATHS: $tr_RELATIVE"
else
BASIC_INFO="$BASIC_INFO|RELATIVE PATHS: disabled"
fi

View File

@ -81,7 +81,7 @@ AC_ARG_ENABLE(eff-cpp,
)
if test x$GCC == xyes; then
WALL="-pedantic -Wall -Winit-self -Wno-long-long"
WALL="-Wall -Winit-self -Wno-long-long -Wno-variadic-macros"
if test x$tr_WERROR == xyes; then
WALL="${WALL} -Werror"
@ -92,7 +92,7 @@ if test x$GCC == xyes; then
fi
WALLC="${WALL} -Wshadow -Wstrict-prototypes -Wdeclaration-after-statement"
WALLCXX="${WALL} -Woverloaded-virtual -Wno-variadic-macros"
WALLCXX="${WALL} -Woverloaded-virtual"
case $CXX in
*clang++*)
@ -107,7 +107,7 @@ if test x$GCC == xyes; then
WALLCXX="${WALLCXX} -Weffc++"
fi
CFLAGS="${CFLAGS} -std=gnu99 ${WALLC}"
CFLAGS="${CFLAGS} -std=gnu90 ${WALLC}"
CXXFLAGS="${CXXFLAGS} ${WALLCXX}"
fi