diff options
-rw-r--r-- | Makefile.am | 14 | ||||
-rw-r--r-- | src/cli_shell_api.cpp | 8 | ||||
-rw-r--r-- | src/cstore/cstore.cpp | 11 | ||||
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.cpp | 18 | ||||
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.hpp | 3 |
5 files changed, 36 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am index ac9f0cd..cbd5ea6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,11 +13,12 @@ if USE_UNIONFSFUSE USE_UNIONFSFUSE = -DUSE_UNIONFSFUSE=1 endif -AM_CFLAGS = -I src -Wall -I /usr/include/glib-2.0 -I /usr/lib/glib-2.0/include $(USE_UNIONFSFUSE) -AM_CXXFLAGS = -I src -Wall -Werror $(USE_UNIONFSFUSE) -AM_CXXFLAGS += -I /usr/include/glib-2.0 -I /usr/lib/glib-2.0/include +AM_CFLAGS = -g -I src -Wall `pkg-config --cflags gio-2.0 gobject-2.0 glib-2.0` $(USE_UNIONFSFUSE) +AM_CXXFLAGS = -g -I src -Wall -Werror $(USE_UNIONFSFUSE) +AM_CXXFLAGS += `pkg-config --cflags gio-2.0 gobject-2.0 glib-2.0` AM_YFLAGS = -d --name-prefix=yy_`basename $* .y`_ AM_LFLAGS = --prefix=yy_`basename $* .l`_ -olex.yy.c +AM_LDFLAGS = `pkg-config --libs gio-2.0 gobject-2.0 glib-2.0` completion_DATA = etc/bash_completion.d/vyatta-cfg initd_SCRIPTS = etc/init.d/vyatta-router @@ -37,8 +38,9 @@ src/cparse/cparse_lex.c: src/cparse/cparse_lex.l src/cparse/cparse.cpp flex -P cparse_ -o $@ $< lib_LTLIBRARIES = src/libvyatta-cfg.la -src_libvyatta_cfg_la_LIBADD = /usr/lib/libglib-2.0.la -src_libvyatta_cfg_la_LIBADD += /usr/lib/libgio-2.0.la +src_libvyatta_cfg_la_LIBADD = -lglib-2.0 +src_libvyatta_cfg_la_LIBADD += -lgio-2.0 +src_libvyatta_cfg_la_LIBADD += -lgobject-2.0 src_libvyatta_cfg_la_LIBADD += -lboost_system src_libvyatta_cfg_la_LIBADD += -lboost_filesystem src_libvyatta_cfg_la_LIBADD += -lapt-pkg @@ -61,7 +63,7 @@ CLEANFILES = src/cli_parse.c src/cli_parse.h src/cli_def.c src/cli_val.c CLEANFILES += src/cparse/cparse.cpp src/cparse/cparse.h CLEANFILES += src/cparse/cparse_lex.c LDADD = src/libvyatta-cfg.la -LDADD += /usr/lib/libglib-2.0.la +#LDADD += /usr/lib/libglib-2.0.la vincludedir = $(includedir)/vyatta-cfg vinclude_HEADERS = src/cli_cstore.h diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp index aa8eafd..8a38a63 100644 --- a/src/cli_shell_api.cpp +++ b/src/cli_shell_api.cpp @@ -686,7 +686,7 @@ static OpT ops[] = { OP(cfReturnValue, -1, NULL, 2, "Must specify config file and path", false), OP(cfReturnValues, -1, NULL, 2, "Must specify config file and path", false), - {NULL, -1, NULL, -1, NULL, NULL, false} + {NULL, -1, NULL, -1, NULL, false, NULL} }; #define OP_exact_args ops[op_idx].op_exact_args #define OP_min_args ops[op_idx].op_min_args @@ -716,6 +716,12 @@ struct option options[] = { int main(int argc, char **argv) { + fprintf(stderr, "DEBUG %s", argv[0]); + for (int i = 1; i < argc; i++) { + fprintf(stderr, " '%s'", argv[i]); // DEBUG + } + fprintf(stderr, "\n"); // DEBUG + // handle options first int c = 0; while ((c = getopt_long(argc, argv, "", options, NULL)) != -1) { diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp index 43abebd..485dcdb 100644 --- a/src/cstore/cstore.cpp +++ b/src/cstore/cstore.cpp @@ -28,6 +28,7 @@ // for debian's version comparison algorithm #define APT_COMPATIBILITY 986 #include <apt-pkg/version.h> +#include <apt-pkg/debversion.h> #include <cli_cstore.h> #include <cstore/cstore.hpp> @@ -2023,7 +2024,14 @@ Cstore::assert_internal(bool cond, const char *fmt, ...) bool Cstore::sort_func_deb_version(string a, string b) { - return (pkgVersionCompare(a, b) < 0); + debVersioningSystem debVersioning; + + const char* A = a.c_str(); + const char* B = b.c_str(); + const char* Aend = A + a.length(); + const char* Bend = B + b.length(); + + return debVersioning.DoCmpVersion(A, Aend, B, Bend) > 0; } void @@ -2987,6 +2995,7 @@ Cstore::vexit_internal(const char *fmt, va_list alist) char buf[256]; vsnprintf(buf, 256, fmt, alist); output_internal("%s\n", buf); + fprintf(stderr, "DEBUG vexit_internal: %s\n", buf); // DEBUG if (Perl_get_context()) { /* we're in a perl context. do a croak to provide more information. * note that the message should not end in "\n", or the croak message diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp index dccb626..1324d79 100644 --- a/src/cstore/unionfs/cstore-unionfs.cpp +++ b/src/cstore/unionfs/cstore-unionfs.cpp @@ -393,7 +393,7 @@ UnionfsCstore::setupSession() try { b_fs::directory_iterator di(work_base.path_cstr()); for (; di != b_fs::directory_iterator(); ++di) { - old_config = di->path().file_string().c_str(); + old_config = di->path().c_str(); if (path_is_directory(old_config)) { directories.push_back(old_config); } @@ -1211,12 +1211,12 @@ UnionfsCstore::unmark_deactivated_descendants() vector<b_fs::path> markers; b_fs::recursive_directory_iterator di(get_work_path().path_cstr()); for (; di != b_fs::recursive_directory_iterator(); ++di) { - if (!path_is_regular(di->path().file_string().c_str()) + if (!path_is_regular(di->path().c_str()) || di->path().filename() != C_MARKER_DEACTIVATE) { // not marker continue; } - const char *ppath = di->path().parent_path().file_string().c_str(); + const char *ppath = di->path().parent_path().c_str(); if (strcmp(ppath, get_work_path().path_cstr()) == 0) { // don't unmark the node itself continue; @@ -1279,7 +1279,7 @@ UnionfsCstore::unmark_changed_with_descendants() vector<b_fs::path> markers; b_fs::recursive_directory_iterator di(get_work_path().path_cstr()); for (; di != b_fs::recursive_directory_iterator(); ++di) { - if (!path_is_regular(di->path().file_string().c_str()) + if (!path_is_regular(di->path().c_str()) || di->path().filename() != C_MARKER_CHANGED) { // not marker continue; @@ -1338,7 +1338,7 @@ UnionfsCstore::discard_changes(unsigned long long& num_removed) // iterate through all entries in change root b_fs::directory_iterator di(change_root.path_cstr()); for (; di != b_fs::directory_iterator(); ++di) { - if (path_is_directory(di->path().file_string().c_str())) { + if (path_is_directory(di->path().c_str())) { directories.push_back(di->path()); } else { files.push_back(di->path()); @@ -1471,10 +1471,10 @@ UnionfsCstore::check_dir_entries(const FsPath& root, vector<string> *cnodes, try { b_fs::directory_iterator di(root.path_cstr()); for (; di != b_fs::directory_iterator(); ++di) { - string cname = di->path().filename(); + string cname = di->path().filename().c_str(); if (filter_nodes) { // must be directory - if (!path_is_directory(di->path().file_string().c_str())) { + if (!path_is_directory(di->path().c_str())) { continue; } // name cannot start with "." @@ -1573,14 +1573,14 @@ UnionfsCstore::recursive_copy_dir(const FsPath& src, const FsPath& dst, b_fs::recursive_directory_iterator di(src_str); for (; di != b_fs::recursive_directory_iterator(); ++di) { - const char *oname = di->path().file_string().c_str(); + const char *oname = di->path().c_str(); string nname = oname; nname.replace(0, src_str.length(), dst_str); if (path_is_directory(oname)) { b_fs::create_directory(nname); } else { if (filter_dot_entries) { - string of = di->path().filename(); + string of = di->path().filename().c_str(); if (!of.empty() && of.at(0) == '.') { // filter dot files (with exceptions) if (of != C_COMMENT_FILE) { diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp index fa504ab..95c2b63 100644 --- a/src/cstore/unionfs/cstore-unionfs.hpp +++ b/src/cstore/unionfs/cstore-unionfs.hpp @@ -291,7 +291,8 @@ private: // boost fs operations wrappers bool b_fs_get_file_status(const char *path, b_fs::file_status& fs) { b_s::error_code ec; - fs = b_fs::detail::status_api(path, ec); + b_s::error_code* p_ec = &ec; + fs = b_fs::detail::status(path, p_ec); return (!ec); }; bool path_exists(const char *path); |