Changeset: b000083da0f8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b000083da0f8
Modified Files:
        buildtools/conf/rules.mk
        monetdb5/mal/mal_interpreter.mx
        monetdb5/optimizer/Tests/dataflow3.stable.out.single
        monetdb5/tools/Tests/mserver5--help.stable.err.Windows
Branch: jacqueline
Log Message:

Merged from default


diffs (truncated from 6554 to 300 lines):

diff --git a/buildtools/ChangeLog.Dec2011 b/buildtools/ChangeLog.Dec2011
--- a/buildtools/ChangeLog.Dec2011
+++ b/buildtools/ChangeLog.Dec2011
@@ -1,3 +1,7 @@
 # ChangeLog file for buildtools
 # This file is updated with Maddlog
 
+* Tue Feb  7 2012 Sjoerd Mullender <sjo...@acm.org>
+- On Debian and Ubuntu, install Python modules in dist-packages instead
+  of site-packages.  This fixed bug 2997.
+
diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py
--- a/buildtools/autogen/autogen/am.py
+++ b/buildtools/autogen/autogen/am.py
@@ -1046,7 +1046,9 @@ def am_python(fd, var, python, am):
         fd.write("\t$(PYTHON) '%s' build\n" % f)
     fd.write('install-exec-local-%s:\n' % var)
     for f in python['FILES']:
-        fd.write("\t$(PYTHON) '%s' install --prefix='$(DESTDIR)$(prefix)'\n" % 
f)
+        # see buildtools/conf/rules.mk for PY_INSTALL_LAYOUT
+        # it is needed to install into dist-packages on Debian/Ubuntu
+        fd.write("\t$(PYTHON) '%s' install $(PY_INSTALL_LAYOUT) 
--prefix='$(DESTDIR)$(prefix)'\n" % f)
     fd.write('uninstall-local-%s:\n' % var)
     for pkgdir in sorted(pkgdirs, reverse = True):
         fd.write("\trm -r '$(DESTDIR)$(prefix)/$(PYTHON_LIBDIR)/%s'\n" % 
pkgdir)
diff --git a/buildtools/conf/rules.mk b/buildtools/conf/rules.mk
--- a/buildtools/conf/rules.mk
+++ b/buildtools/conf/rules.mk
@@ -119,3 +119,8 @@ MX = $(top_builddir)/buildtools/Mx/Mx
        $(CP) $< $@
 
 SUFFIXES-local: $(BUILT_SOURCES)
+
+ifdef DEB_BUILD_ARCH
+# see buildtools/autogen/autogen/am.py:am_python()
+PY_INSTALL_LAYOUT = --install-layout=deb
+endif
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <sys/stat.h>
 #include <errno.h>
 #include <signal.h>
 #include <unistd.h>
@@ -44,6 +45,12 @@
 # endif
 #endif
 
+enum modes {
+    MAL,
+    SQL
+};
+static enum modes mode = SQL;
+
 #define COUNTERSDEFAULT "ISTest"
 
 static struct {
@@ -318,8 +325,14 @@ main(int argc, char **argv)
        char *dbname = NULL;
        char *user = NULL;
        char *password = NULL;
+       char *language = NULL;
+
+       /* some .monetdb properties are used by mclient, perhaps we need them 
as well later */
+       struct stat statb;
+
        char **alts, **oalts;
        wthread *walk;
+       stream * config = NULL;
 
        static struct option long_options[8] = {
                { "dbname", 1, 0, 'd' },
@@ -330,6 +343,74 @@ main(int argc, char **argv)
                { "help", 0, 0, '?' },
                { 0, 0, 0, 0 }
        };
+
+       /* parse config file first, command line options override */
+       if (getenv("DOTMONETDBFILE") == NULL) {
+               if (stat(".monetdb", &statb) == 0) {
+                       config = open_rastream(".monetdb");
+               } else if (getenv("HOME") != NULL) {
+                       char buf[1024];
+                       snprintf(buf, sizeof(buf), "%s/.monetdb", 
getenv("HOME"));
+                       if (stat(buf, &statb) == 0) {
+                               config = open_rastream(buf);
+                       }
+               }
+       } else {
+               char *cfile = getenv("DOTMONETDBFILE");
+               if (strcmp(cfile, "") != 0) {
+                       if (stat(cfile, &statb) == 0) {
+                               config = open_rastream(cfile);
+                       } else {
+                               fprintf(stderr,
+                                             "failed to open file '%s': %s\n",
+                                             cfile, strerror(errno));
+                       }
+               }
+       }
+
+       if (config != NULL) {
+               char buf[1024];
+               char *q;
+               ssize_t len;
+               int line = 0;
+               while ((len = mnstr_readline(config, buf, sizeof(buf) - 1)) > 
0) {
+                       line++;
+                       buf[len - 1] = '\0';    /* drop newline */
+                       if (buf[0] == '#' || buf[0] == '\0')
+                               continue;
+                       if ((q = strchr(buf, '=')) == NULL) {
+                               fprintf(stderr, "%s:%d: syntax error: %s\n", 
mnstr_name(config), line, buf);
+                               continue;
+                       }
+                       *q++ = '\0';
+                       /* this basically sucks big time, as I can't easily set
+                        * a default, hence I only do things I think are useful
+                        * for now, needs a better solution */
+                       if (strcmp(buf, "user") == 0) {
+                               user = strdup(q);       /* leak */
+                       } else if (strcmp(buf, "password") == 0 || strcmp(buf, 
"passwd") == 0) {
+                               password = strdup(q);   /* leak */
+                       } else if (strcmp(buf, "language") == 0) {
+                               language = strdup(q);   /* leak */
+                               if (strcmp(language, "sql") == 0) {
+                                       mode = SQL;
+                               } else if (strcmp(language, "mal") == 0) {
+                                       mode = MAL;
+                               } else {
+                                       /* make sure we don't set garbage */
+                                       fprintf(stderr,
+                                                 "%s:%d: unsupported "
+                                                 "language: %s\n",
+                                                 mnstr_name(config),
+                                                 line, q);
+                                       free(language);
+                                       language = NULL;
+                               }
+                       }
+               }
+               mnstr_destroy(config);
+       }
+
        while (1) {
                int option_index = 0;
                int c = getopt_long(argc, argv, "d:u:P:p:?:h:g",
diff --git a/debian/python-monetdb.install b/debian/python-monetdb.install
--- a/debian/python-monetdb.install
+++ b/debian/python-monetdb.install
@@ -1,2 +1,2 @@
-debian/tmp/usr/lib/python2.6/site-packages/monetdb 
usr/lib/python2.6/site-packages
-debian/tmp/usr/lib/python2.6/site-packages/python_monetdb-*.egg-info 
usr/lib/python2.6/site-packages
+debian/tmp/usr/lib/python2.6/dist-packages/monetdb 
usr/lib/python2.6/dist-packages
+debian/tmp/usr/lib/python2.6/dist-packages/python_monetdb-*.egg-info 
usr/lib/python2.6/dist-packages
diff --git a/geom/BugTracker/Tests/X_crash.SF-1971632.stable.out 
b/geom/BugTracker/Tests/X_crash.SF-1971632.stable.out
--- a/geom/BugTracker/Tests/X_crash.SF-1971632.stable.out
+++ b/geom/BugTracker/Tests/X_crash.SF-1971632.stable.out
@@ -29,7 +29,7 @@ Ready.
 [ 1    ]
 [ 1    ]
 % sys.geoms # table_name
-% L5 # name
+% L1 # name
 % wrd # type
 % 1 # length
 [ 4    ]
diff --git a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out 
b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out
--- a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out
+++ b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.stable.out
@@ -15,7 +15,6 @@ stdout of test 'copy_into_crash.SF-19754
 
 
 Ready.
-!ERROR: ParseException: Unknown type: ''POINT'
 
 
 # 11:37:42 >  
diff --git a/monetdb5/mal/Tests/tst654.stable.out 
b/monetdb5/mal/Tests/tst654.stable.out
--- a/monetdb5/mal/Tests/tst654.stable.out
+++ b/monetdb5/mal/Tests/tst654.stable.out
@@ -125,7 +125,7 @@ end main;
 % int, str                     # type
 % false,false                  # dense
 % true,        false                   # sorted
-% true,        false                   # key
+% true,        true                    # key
 % 42,                          # min
 % 49,                          # max
 #-------------------------------#
diff --git a/monetdb5/mal/Tests/tst655.stable.out 
b/monetdb5/mal/Tests/tst655.stable.out
--- a/monetdb5/mal/Tests/tst655.stable.out
+++ b/monetdb5/mal/Tests/tst655.stable.out
@@ -47,7 +47,7 @@ end main;
 % int, str                     # type
 % false,false                  # dense
 % true,        false                   # sorted
-% true,        false                   # key
+% true,        true                    # key
 % 42,                          # min
 % 49,                          # max
 #-------------------------------#
diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -89,7 +89,7 @@ mal_export int DFLOWadmission(lng argcla
 #define heapinfo(X) if ((X) && (X)->base) vol = (X)->free; else vol = 0;
 #define hashinfo(X) if ((X) && (X)->mask) vol = ((X)->mask + (X)->lim + 1) * 
sizeof(int) + sizeof(*(X)); else vol = 0;
 
-#define FREE_EXCEPTION(p) { if (p && p != M5OutOfMemory) GDKfree(p); }
+#define FREE_EXCEPTION(p) do { if (p && p != M5OutOfMemory) GDKfree(p); } 
while (0)
 
 /*
  * @-
@@ -134,12 +134,13 @@ ptr getArgReference(MalStkPtr stk, Instr
 void showErrors(Client cntxt)
 {
        int i;
-       if (cntxt->errbuf && *cntxt->errbuf) {
-               i = (int)strlen(cntxt->errbuf);
-               mnstr_printf(cntxt->fdout, "%s", cntxt->errbuf);
-               if (cntxt->errbuf[i - 1] != '\n')
+       char *errbuf = GDKerrbuf;
+       if (errbuf && *errbuf) {
+               i = (int)strlen(errbuf);
+               mnstr_printf(cntxt->fdout, "%s", errbuf);
+               if (errbuf[i - 1] != '\n')
                        mnstr_printf(cntxt->fdout, "\n");
-               cntxt->errbuf[0] = '\0';
+               errbuf[0] = '\0';
        }
 }
 /*
@@ -972,7 +973,6 @@ DFLOWstep(FlowTask *t, FlowStatus fs)
        printf("#EXECUTE THREAD %d \n", tid);
        printInstruction(GDKstdout, flow->mb, 0, pci, LIST_MAL_STMT | 
LIST_MAPI);
 #endif
-       THRset_errbuf(THRget(THRgettid()), cntxt->errbuf);  /* where to leave 
errors */
        if (stk->cmd || mb->trap) {
                lng tm = 0;
                if (oldtimer)
@@ -1079,6 +1079,8 @@ runDFLOWworker(void *t)
        int i, local = 0, last = 0;
 
        thr = THRnew(MT_getpid(), "DFLOWworker");
+       GDKsetbuf(GDKmalloc(GDKMAXERRLEN));     /* where to leave errors */
+       GDKerrbuf[0] = 0;
        while (task) {
                local = nxtfs != 0;
                if (nxtfs == 0)
@@ -1137,6 +1139,8 @@ runDFLOWworker(void *t)
                else
                        q_enqueue(task->flow->done, fs);
        }
+       GDKfree(GDKerrbuf);
+       GDKsetbuf(0);
        THRdel(thr);
 }
 
@@ -2374,32 +2378,35 @@ mal_export str catchKernelException(Clie
 str catchKernelException(Client cntxt, str ret)
 {
        str z;
-       if (cntxt->errbuf && cntxt->errbuf[0]) {
+       char *errbuf = GDKerrbuf;
+       (void) cntxt;
+       if (errbuf && errbuf[0]) {
                if (ret != MAL_SUCCEED) {
-                       z = (char*)GDKmalloc(strlen(ret) + 
strlen(cntxt->errbuf) + 2);
+                       z = (char*)GDKmalloc(strlen(ret) + strlen(errbuf) + 2);
                        if (z) {
                                strcpy(z, ret);
                                if (z[strlen(z) - 1] != '\n') strcat(z, "\n");
-                               strcat(z, cntxt->errbuf);
+                               strcat(z, errbuf);
                        }
                } else {
                        /* trap hidden (GDK) exception */
-                       z = (char*)GDKmalloc(strlen("GDKerror:") + 
strlen(cntxt->errbuf) + 2);
+                       z = (char*)GDKmalloc(strlen("GDKerror:") + 
strlen(errbuf) + 2);
                        if (z)
-                               sprintf(z, "GDKerror:%s\n", cntxt->errbuf);
+                               sprintf(z, "GDKerror:%s\n", errbuf);
                }
                /* did we eat the error away of not */
                if (z)
-                       cntxt->errbuf[0] = '\0';
+                       errbuf[0] = '\0';
        } else
                z = ret;
        return z;
 }
 @= exceptionHndlr
-if (cntxt->errbuf && cntxt->errbuf[0]) {
+if (GDKerrbuf && GDKerrbuf[0]) {
        str oldret = ret;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to