← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/fix-website-failures into lp:zorba

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/fix-website-failures into lp:zorba.

Requested reviews:
  Zorba Coders (zorba-coders)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix-website-failures/+merge/91574

This fixes several problems either caused by the recent zorba-xquery.com changes, or discovered while implementing those fixes.
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix-website-failures/+merge/91574
Your team Zorba Coders is requested to review the proposed merge of lp:~zorba-coders/zorba/fix-website-failures into lp:zorba.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2012-01-20 13:37:12 +0000
+++ CMakeLists.txt	2012-02-05 12:38:21 +0000
@@ -498,14 +498,15 @@
 # Subdirectory ordering: We need to include "test" before "config" so
 # ZorbaConfig knows about testdriver. We need to include "config"
 # before "modules" so external modules will be able to find
-# ZorbaConfig.cmake.
+# ZorbaConfig.cmake. We need to include "modules" before "include" so
+# config.h can know eg. whether we found CURL.
 
 ADD_SUBDIRECTORY(test)
 ADD_SUBDIRECTORY(config)
-ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(doc)
 ADD_SUBDIRECTORY(schemas)
 ADD_SUBDIRECTORY(modules)
+ADD_SUBDIRECTORY(include)
 
 ADD_DEFINITIONS(-Dzorba_EXPORTS)
 ADD_SUBDIRECTORY(src)

=== modified file 'include/zorba/config.h.cmake'
--- include/zorba/config.h.cmake	2012-01-11 17:30:25 +0000
+++ include/zorba/config.h.cmake	2012-02-05 12:38:21 +0000
@@ -69,6 +69,9 @@
 #cmakedefine ZORBA_HAVE_MS_UINT32
 #cmakedefine ZORBA_HAVE_UINT32_T
 
+// Platform libraries
+#cmakedefine ZORBA_HAVE_CURL
+
 #ifdef ZORBA_HAVE_STDINT_H
 # include <stdint.h>
 #endif

=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt	2012-01-11 17:30:25 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt	2012-02-05 12:38:21 +0000
@@ -16,6 +16,7 @@
 #
 # cURL
 #
+SET (CURL_FOUND)
 IF(ZORBA_SUPPRESS_CURL)
   MESSAGE(STATUS "ZORBA_SUPPRESS_CURL is true - not searching for cURL library")
 ELSE(ZORBA_SUPPRESS_CURL)
@@ -36,6 +37,8 @@
     MESSAGE(STATUS "The cURL library was not found - http-client will not be built")
   ENDIF(CURL_FOUND)
 ENDIF(ZORBA_SUPPRESS_CURL)
+SET(ZORBA_HAVE_CURL ${CURL_FOUND} CACHE BOOL "Whether Zorba found cURL" FORCE)
+MARK_AS_ADVANCED(ZORBA_HAVE_CURL)
 
 DECLARE_ZORBA_SCHEMA(FILE xqdoc.xsd URI "http://www.xqdoc.org/1.0";)
 DECLARE_ZORBA_MODULE(FILE datetime.xq VERSION 2.0

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2012-02-02 09:56:52 +0000
+++ src/context/static_context.cpp	2012-02-05 12:38:21 +0000
@@ -1569,9 +1569,10 @@
   for (std::vector<zstring>::iterator url = aUrls.begin();
        url != aUrls.end(); url++) 
   {
-    // if the http-client module is not available, we must not search
-    // for it by calling the http-client...
-    if (*url == "http://www.zorba-xquery.com/modules/http-client";)
+    // We should never try to load the http-client module using its original URI,
+    // because that URI starts with http:, so we'll try to load the http-client
+    // module, leading to a stack overflow.
+    if (ascii::begins_with(*url, "http://www.zorba-xquery.com/modules/http-client";))
     {
       continue;
     }

=== modified file 'src/util/http_util.cpp'
--- src/util/http_util.cpp	2012-01-11 17:30:25 +0000
+++ src/util/http_util.cpp	2012-02-05 12:38:21 +0000
@@ -28,7 +28,7 @@
 namespace zorba {
   
   HttpStream::HttpStream(const zstring& aUri)
-  : theDidInit(false), theUri(aUri)
+    : theUri(aUri)
   {
   }
   
@@ -42,6 +42,9 @@
   
   void HttpStream::init()
   {
+    bool succeed = false;
+
+#ifdef ZORBA_HAVE_CURL
     Zorba* lInstance = Zorba::getInstance(0);
     theStaticContext = lInstance->createStaticContext();
     ItemFactory* lFactory = lInstance->getItemFactory();
@@ -75,7 +78,7 @@
     Iterator_t lIter = lItem.getAttributes();
     lIter->open();
     Item lAttr;
-    bool succeed = true;
+    succeed = true;
     while (lIter->next(lAttr)) {
       Item lName;
       lAttr.getNodeName(lName);
@@ -89,6 +92,8 @@
       }
     }
     lIter->close();
+#endif /* ZORBA_HAVE_CURL */
+
     if (!succeed)
       throw os_error::exception("", theUri.c_str(), "Could not create stream resource");
     theIterator->next(theStreamableString);

=== modified file 'src/util/http_util.h'
--- src/util/http_util.h	2011-08-20 01:30:48 +0000
+++ src/util/http_util.h	2012-02-05 12:38:21 +0000
@@ -27,7 +27,6 @@
   public:
     std::istream& getStream();
     void init();
-    bool didInit() { return theDidInit; }
     StreamReleaser getStreamReleaser();
     void setStreamReleaser(StreamReleaser aReleaser);
   private:
@@ -35,7 +34,6 @@
     StaticContext_t theStaticContext;
     Item theStreamableString;
     Iterator_t theIterator;
-    bool theDidInit;
     const zstring& theUri;
   };
 }

=== added file 'test/http-test-data/docroot/http-test-data/http2.xml'
--- test/http-test-data/docroot/http-test-data/http2.xml	1970-01-01 00:00:00 +0000
+++ test/http-test-data/docroot/http-test-data/http2.xml	2012-02-05 12:38:21 +0000
@@ -0,0 +1,4 @@
+<x:doc xmlns:x="http://www.zorba-xquery.com/http-test-data";>
+  <x:title>Document Title</x:title>
+  <x:body>Document Body</x:body>
+</x:doc>

=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq'
--- test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq	2011-08-05 09:31:11 +0000
+++ test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
 (: Fetch a valid module URI but as SOME_CONTENT :)
 import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch#2.0";;
 
-fetch:content("http://www.zorba-xquery.com/modules/ext";, "SOME_CONTENT")
+fetch:content("http://www.flworfound.org/modules/ext";, "SOME_CONTENT")

=== modified file 'test/rbkt/Queries/zorba/store/example_3.xq'
--- test/rbkt/Queries/zorba/store/example_3.xq	2011-08-04 02:14:56 +0000
+++ test/rbkt/Queries/zorba/store/example_3.xq	2012-02-05 12:38:21 +0000
@@ -2,17 +2,17 @@
 
 import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents";;
 
-declare namespace xhtml = "http://www.w3.org/1999/xhtml";;
+declare namespace x = "http://www.zorba-xquery.com/http-test-data";;
 
-let $mydoc := http:get-node("http://zorba-xquery.com/rest-tests/doc.html";)[2]
+let $mydoc := http:get-node("http://zorbatest.lambda.nu:8080/http-test-data/http2.xml";)[2]
 return
   {
     doc:put("mydoc.xml", $mydoc); (: add the document with name mydoc.xml :)
 
     replace value of node
-      doc:document("mydoc.xml")//xhtml:title
+      doc:document("mydoc.xml")//x:title
     with
       "Excel Functions";
 
-    doc:document("mydoc.xml")//xhtml:title/text()
+    doc:document("mydoc.xml")//x:title/text()
   }

=== modified file 'test/rbkt/Queries/zorba/versioning/import-chain1.xq'
--- test/rbkt/Queries/zorba/versioning/import-chain1.xq	2011-06-06 09:11:29 +0000
+++ test/rbkt/Queries/zorba/versioning/import-chain1.xq	2012-02-05 12:38:21 +0000
@@ -1,6 +1,6 @@
 (: Test that importing a version in the main module and a library module :)
 (: is OK, so long as the versions don't conflict. :)
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#2.3";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#2.3";;
 import module namespace modB = "http://www.zorba-xquery.com/modules/B";;
 
 modB:hello()

=== modified file 'test/rbkt/Queries/zorba/versioning/import-chain2.xq'
--- test/rbkt/Queries/zorba/versioning/import-chain2.xq	2011-06-06 09:11:29 +0000
+++ test/rbkt/Queries/zorba/versioning/import-chain2.xq	2012-02-05 12:38:21 +0000
@@ -1,6 +1,6 @@
 (: Test that importing a version in the main module and a library module :)
 (: raises an error when the versions conflict. :)
 import module namespace modA = "http://www.zorba-xquery.com/modules/A";;
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#2.3";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#2.3";;
 
 modA:hello()

=== modified file 'test/rbkt/Queries/zorba/versioning/import1.xq'
--- test/rbkt/Queries/zorba/versioning/import1.xq	2011-06-06 09:11:29 +0000
+++ test/rbkt/Queries/zorba/versioning/import1.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
 (: Test that we can import a versioned module. :)
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#2.1";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#2.1";;
 
 vm:hello()

=== modified file 'test/rbkt/Queries/zorba/versioning/import2.xq'
--- test/rbkt/Queries/zorba/versioning/import2.xq	2011-06-06 09:11:29 +0000
+++ test/rbkt/Queries/zorba/versioning/import2.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
 (: Test that importing a versioned module gets the right version. :)
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#1.3";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#1.3";;
 
 vm:version()

=== modified file 'test/rbkt/Queries/zorba/versioning/import3.xq'
--- test/rbkt/Queries/zorba/versioning/import3.xq	2011-06-06 09:11:29 +0000
+++ test/rbkt/Queries/zorba/versioning/import3.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
 (: Test that importing a range of versions gets the highest available. :)
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#1.3-2.0";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#1.3-2.0";;
 
 vm:version()

=== modified file 'test/rbkt/Queries/zorba/versioning/import4.xq'
--- test/rbkt/Queries/zorba/versioning/import4.xq	2011-06-06 09:11:29 +0000
+++ test/rbkt/Queries/zorba/versioning/import4.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
 (: Test that importing an explicit version gets the right version. :)
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#2.3!";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#2.3!";;
 
 vm:version()

=== modified file 'test/rbkt/Queries/zorba/versioning/import5.xq'
--- test/rbkt/Queries/zorba/versioning/import5.xq	2011-06-06 09:11:29 +0000
+++ test/rbkt/Queries/zorba/versioning/import5.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
 (: Test that importing a non-existent explicit version gets an error. :)
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#2.2!";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#2.2!";;
 
 vm:version()

=== modified file 'test/rbkt/Queries/zorba/versioning/import6.xq'
--- test/rbkt/Queries/zorba/versioning/import6.xq	2011-06-21 07:39:45 +0000
+++ test/rbkt/Queries/zorba/versioning/import6.xq	2012-02-05 12:38:21 +0000
@@ -1,6 +1,6 @@
 (: Test that an exact import with non-0 patch level does not match :)
 (: module with no patch level specified. :)
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#2.3.5!";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#2.3.5!";;
 
 vm:version()
 

=== modified file 'test/rbkt/Queries/zorba/versioning/import7.xq'
--- test/rbkt/Queries/zorba/versioning/import7.xq	2011-06-21 07:39:45 +0000
+++ test/rbkt/Queries/zorba/versioning/import7.xq	2012-02-05 12:38:21 +0000
@@ -1,5 +1,5 @@
 (: Test importing a module with an invalid version specification :)
 
-import module namespace bad = "http://www.zorba-xquery.com/modules/bad-ver#1.0";;
+import module namespace bad = "http://www.flworfound.org/modules/bad-ver#1.0";;
 
 bad:version()

=== modified file 'test/rbkt/modules/CMakeLists.txt'
--- test/rbkt/modules/CMakeLists.txt	2012-02-02 09:56:52 +0000
+++ test/rbkt/modules/CMakeLists.txt	2012-02-05 12:38:21 +0000
@@ -15,11 +15,11 @@
 # Build and install any test modules.  (Parameters are scrambled about
 # as a test for DECLARE_ZORBA_MODULE parsing them.)
 DECLARE_ZORBA_MODULE(FILE "ver2.xq"
-  URI "http://www.zorba-xquery.com/modules/ver"; VERSION 2.3 TEST_ONLY)
-DECLARE_ZORBA_MODULE(URI "http://www.zorba-xquery.com/modules/ver"; VERSION 1.4
+  URI "http://www.flworfound.org/modules/ver"; VERSION 2.3 TEST_ONLY)
+DECLARE_ZORBA_MODULE(URI "http://www.flworfound.org/modules/ver"; VERSION 1.4
   FILE "${CMAKE_CURRENT_SOURCE_DIR}/ver.xq" TEST_ONLY)
 
-DECLARE_ZORBA_MODULE(URI "http://www.zorba-xquery.com/modules/bad-ver";
+DECLARE_ZORBA_MODULE(URI "http://www.flworfound.org/modules/bad-ver";
   FILE "bad-ver.xq" VERSION 1.4 TEST_ONLY)
 
 DECLARE_ZORBA_MODULE(URI "http://www.zorba-xquery.com/modules/A"; VERSION 1.0

=== modified file 'test/rbkt/modules/bad-ver.xq'
--- test/rbkt/modules/bad-ver.xq	2011-06-21 07:39:45 +0000
+++ test/rbkt/modules/bad-ver.xq	2012-02-05 12:38:21 +0000
@@ -1,6 +1,6 @@
 (: This module has an illegal version specification :)
 
-module namespace vm = "http://www.zorba-xquery.com/modules/bad-ver";;
+module namespace vm = "http://www.flworfound.org/modules/bad-ver";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "1.4.";

=== modified file 'test/rbkt/modules/module-A.xq'
--- test/rbkt/modules/module-A.xq	2011-06-21 07:39:45 +0000
+++ test/rbkt/modules/module-A.xq	2012-02-05 12:38:21 +0000
@@ -2,7 +2,7 @@
 
 (: This module exists only to import a specific version of the "ver" module. :)
 
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#1.0";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#1.0";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "1.0";

=== modified file 'test/rbkt/modules/module-B.xq'
--- test/rbkt/modules/module-B.xq	2011-06-21 07:39:45 +0000
+++ test/rbkt/modules/module-B.xq	2012-02-05 12:38:21 +0000
@@ -2,7 +2,7 @@
 
 (: This module exists only to import a specific version of the "ver" module. :)
 
-import module namespace vm = "http://www.zorba-xquery.com/modules/ver#2.0";;
+import module namespace vm = "http://www.flworfound.org/modules/ver#2.0";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "1.0";

=== modified file 'test/rbkt/modules/ver.xq'
--- test/rbkt/modules/ver.xq	2011-06-21 07:39:45 +0000
+++ test/rbkt/modules/ver.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
-module namespace vm = "http://www.zorba-xquery.com/modules/ver";;
+module namespace vm = "http://www.flworfound.org/modules/ver";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "1.4.5";

=== modified file 'test/rbkt/modules/ver2.xq'
--- test/rbkt/modules/ver2.xq	2011-06-21 07:39:45 +0000
+++ test/rbkt/modules/ver2.xq	2012-02-05 12:38:21 +0000
@@ -1,4 +1,4 @@
-module namespace vm = "http://www.zorba-xquery.com/modules/ver";;
+module namespace vm = "http://www.flworfound.org/modules/ver";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "2.3";


Follow ups