1 |
graaff 11/12/04 10:12:59 |
2 |
|
3 |
Added: gorg-0.6.4-ruby19-date.patch |
4 |
gorg-0.6.4-ruby19.patch |
5 |
Log: |
6 |
Convert to ruby-ng.eclass. Add ruby19 support. Thanks to naota for patches and testing in bug 315487. |
7 |
|
8 |
(Portage version: 2.1.10.11/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 www-servers/gorg/files/gorg-0.6.4-ruby19-date.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/gorg/files/gorg-0.6.4-ruby19-date.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/gorg/files/gorg-0.6.4-ruby19-date.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: gorg-0.6.4-ruby19-date.patch |
17 |
=================================================================== |
18 |
diff --git a/lib/gorg/cache.rb b/lib/gorg/cache.rb |
19 |
index 543b6a2..00ad1ab 100644 |
20 |
--- a/lib/gorg/cache.rb |
21 |
+++ b/lib/gorg/cache.rb |
22 |
@@ -22,7 +22,13 @@ |
23 |
# . a list of parameters as received by a webserver e.g. |
24 |
# . a list of files it depends on |
25 |
|
26 |
-require "parsedate" |
27 |
+begin |
28 |
+ require "parsedate" |
29 |
+ $haveparsedate = true |
30 |
+rescue LoadError |
31 |
+ require "time" |
32 |
+ $haveparsedate = false |
33 |
+end |
34 |
require "fileutils" |
35 |
require "find" |
36 |
require "digest" |
37 |
@@ -106,7 +112,11 @@ module Cache |
38 |
|
39 |
fst = File.stat(f) |
40 |
raise "Size of #{f} has changed from #{fst.size} to #{s.to_i}" unless fst.size == s.to_i |
41 |
- raise "Timestamp of #{f} has changed" unless Time.utc(*ParseDate.parsedate(d)) == fst.mtime.utc |
42 |
+ if $haveparsedate |
43 |
+ raise "Timestamp of #{f} has changed" unless Time.utc(*ParseDate.parsedate(d)) == fst.mtime.utc |
44 |
+ else |
45 |
+ raise "Timestamp of #{f} has changed" unless Time.parse(d) == fst.mtime.utc |
46 |
+ end |
47 |
end |
48 |
mline = meta.shift |
49 |
end |
50 |
|
51 |
|
52 |
|
53 |
1.1 www-servers/gorg/files/gorg-0.6.4-ruby19.patch |
54 |
|
55 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/gorg/files/gorg-0.6.4-ruby19.patch?rev=1.1&view=markup |
56 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/gorg/files/gorg-0.6.4-ruby19.patch?rev=1.1&content-type=text/plain |
57 |
|
58 |
Index: gorg-0.6.4-ruby19.patch |
59 |
=================================================================== |
60 |
diff --git a/ext/gorg/xsl/xsl.c b/ext/gorg/xsl/xsl.c |
61 |
index d8d40b6..58ffc49 100644 |
62 |
--- a/ext/gorg/xsl/xsl.c |
63 |
+++ b/ext/gorg/xsl/xsl.c |
64 |
@@ -20,6 +20,13 @@ |
65 |
|
66 |
#include "xsl.h" |
67 |
|
68 |
+#ifndef RARRAY_LEN |
69 |
+#define RARRAY_LEN(a) RARRAY(a)->len |
70 |
+#endif |
71 |
+#ifndef RSTRING_LEN |
72 |
+#define RSTRING_LEN(str) RSTRING(str)->len |
73 |
+#endif |
74 |
+ |
75 |
/* |
76 |
* Copied from xmlIO.c from libxml2 |
77 |
*/ |
78 |
@@ -156,8 +163,8 @@ void *XRootOpen (const char *filename, const char* rw) { |
79 |
|
80 |
if (g_xroot != Qnil) |
81 |
{ |
82 |
- rbxrootPtr = RSTRING(g_xroot)->ptr; |
83 |
- rbxrootLen = RSTRING(g_xroot)->len; |
84 |
+ rbxrootPtr = RSTRING_PTR(g_xroot); |
85 |
+ rbxrootLen = RSTRING_LEN(g_xroot); |
86 |
} |
87 |
path = (char *) malloc((strlen(filename) + rbxrootLen + 1) * sizeof(char)); |
88 |
if (path == NULL) |
89 |
@@ -284,10 +291,10 @@ void xslMessageHandler(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) |
90 |
*/ |
91 |
int looksLikeXML(VALUE v) |
92 |
{ |
93 |
- return (RSTRING(v)->len > FILENAME_MAX) |
94 |
- || (!strncmp(RSTRING(v)->ptr, "<?xml", 5)) |
95 |
- || (!strncmp(RSTRING(v)->ptr, "<?xsl", 5)) |
96 |
- || (strstr(RSTRING(v)->ptr, "\n")); |
97 |
+ return (RSTRING_LEN(v) > FILENAME_MAX) |
98 |
+ || (!strncmp(RSTRING_PTR(v), "<?xml", 5)) |
99 |
+ || (!strncmp(RSTRING_PTR(v), "<?xsl", 5)) |
100 |
+ || (strstr(RSTRING_PTR(v), "\n")); |
101 |
// We could also try with " " but some are stupid enough to use spaces in filenames |
102 |
} |
103 |
|
104 |
@@ -456,7 +463,7 @@ VALUE check_params(VALUE xparams) |
105 |
// empty array => Qnil |
106 |
// array.length==2, could be 2 params [[p1,v1],[p2,v2]] or 1 param [p,v] |
107 |
// if both items are arrays, we have a list of params, otherwise we have a single param |
108 |
- len = RARRAY(ary)->len; |
109 |
+ len = RARRAY_LEN(ary); |
110 |
switch (len) |
111 |
{ |
112 |
case 0: |
113 |
@@ -522,17 +529,17 @@ char *build_params(VALUE rbparams) |
114 |
|
115 |
// Compute total block size in one go |
116 |
tempval = rb_funcall(rbparams, id.to_s, 0); |
117 |
- ret = malloc ( ((RARRAY(rbparams)->len)*2+1) * sizeof(void *) // Two pointers per [param, value] + 1 NULL |
118 |
- + (RARRAY(rbparams)->len) * 4 * sizeof(char) // Quotes around values + 1 NULL per value |
119 |
- + (RSTRING(tempval)->len) * sizeof(char) // Size of param names & values |
120 |
+ ret = malloc ( ((RARRAY_LEN(rbparams))*2+1) * sizeof(void *) // Two pointers per [param, value] + 1 NULL |
121 |
+ + (RARRAY_LEN(rbparams)) * 4 * sizeof(char) // Quotes around values + 1 NULL per value |
122 |
+ + (RSTRING_LEN(tempval)) * sizeof(char) // Size of param names & values |
123 |
); |
124 |
if ( ret==NULL) |
125 |
return NULL; // out of memory |
126 |
|
127 |
paramPtr = (char **)ret; |
128 |
- paramData = ret + ((RARRAY(rbparams)->len)*2+1) * sizeof(void *); |
129 |
+ paramData = ret + ((RARRAY_LEN(rbparams))*2+1) * sizeof(void *); |
130 |
// Copy each param name & value |
131 |
- for (i=0; i<RARRAY(rbparams)->len; ++i) |
132 |
+ for (i=0; i<RARRAY_LEN(rbparams); ++i) |
133 |
{ |
134 |
tempval = rb_ary_entry(rbparams, i); // ith param, i.e. [name, value] |
135 |
|
136 |
@@ -542,9 +549,9 @@ char *build_params(VALUE rbparams) |
137 |
// Add param name address to list of pointers |
138 |
*paramPtr++ = paramData; |
139 |
// Copy param name into data block |
140 |
- strcpy(paramData, RSTRING(tempstr)->ptr); |
141 |
+ strcpy(paramData, RSTRING_PTR(tempstr)); |
142 |
// Move data pointer after inserted string |
143 |
- paramData += 1+ RSTRING(tempstr)->len; |
144 |
+ paramData += 1+ RSTRING_LEN(tempstr); |
145 |
|
146 |
// 2. Copy param value, quoting it with ' or " |
147 |
|
148 |
@@ -552,7 +559,7 @@ char *build_params(VALUE rbparams) |
149 |
// Don't bother if param is a mix of ' and ", users should know better :-) |
150 |
// or it's been checked already. Here we expect params to be OK. |
151 |
quotingChar = '"'; |
152 |
- if ( strchr(RSTRING(tempstr)->ptr, quotingChar) ) |
153 |
+ if ( strchr(RSTRING_PTR(tempstr), quotingChar) ) |
154 |
quotingChar = '\''; // Use ' instead of " |
155 |
|
156 |
// Add para value address in list of pointers |
157 |
@@ -561,9 +568,9 @@ char *build_params(VALUE rbparams) |
158 |
// Start with quoting character |
159 |
*paramData++ = quotingChar; |
160 |
// Copy value |
161 |
- strcpy(paramData, RSTRING(tempstr)->ptr); |
162 |
+ strcpy(paramData, RSTRING_PTR(tempstr)); |
163 |
// Move data pointer after inserted string |
164 |
- paramData += RSTRING(tempstr)->len; |
165 |
+ paramData += RSTRING_LEN(tempstr); |
166 |
// Close quote |
167 |
*paramData++ = quotingChar; |
168 |
// End string with \0 |
169 |
@@ -593,13 +600,13 @@ VALUE xsl_process_real(VALUE none, VALUE self) |
170 |
if (NIL_P(rbxml)) |
171 |
rb_raise(rb_eArgError, "No XML data"); |
172 |
rbxml = StringValue(rbxml); |
173 |
- if (!RSTRING(rbxml)->len) |
174 |
+ if (!RSTRING_LEN(rbxml)) |
175 |
rb_raise(rb_eArgError, "No XML data"); |
176 |
rbxsl = rb_iv_get(self, "@xsl"); |
177 |
if (NIL_P(rbxsl)) |
178 |
rb_raise(rb_eArgError, "No Stylesheet"); |
179 |
rbxsl = StringValue(rbxsl); |
180 |
- if (!RSTRING(rbxsl)->len) |
181 |
+ if (!RSTRING_LEN(rbxsl)) |
182 |
rb_raise(rb_eArgError, "No Stylesheet"); |
183 |
rbxroot = rb_iv_get(self, "@xroot"); |
184 |
rbparams = check_params(rb_iv_get(self, "@xparams")); |
185 |
@@ -625,7 +632,7 @@ VALUE xsl_process_real(VALUE none, VALUE self) |
186 |
// Parse XSL |
187 |
if (looksLikeXML(rbxsl)) |
188 |
{ |
189 |
- myPointers.docxsl = xmlParseMemory(RSTRING(rbxsl)->ptr, RSTRING(rbxsl)->len); |
190 |
+ myPointers.docxsl = xmlParseMemory(RSTRING_PTR(rbxsl), RSTRING_LEN(rbxsl)); |
191 |
// myPointers.docxsl = xmlReadMemory(RSTRING(rbxsl)->ptr, RSTRING(rbxsl)->len, ".", NULL, 0); |
192 |
if (myPointers.docxsl == NULL) |
193 |
{ |
194 |
@@ -641,7 +648,7 @@ VALUE xsl_process_real(VALUE none, VALUE self) |
195 |
} |
196 |
else // xsl is a filename |
197 |
{ |
198 |
- myPointers.xsl = xsltParseStylesheetFile(RSTRING(rbxsl)->ptr); |
199 |
+ myPointers.xsl = xsltParseStylesheetFile(RSTRING_PTR(rbxsl)); |
200 |
if (myPointers.xsl == NULL) |
201 |
{ |
202 |
my_raise(self, &myPointers, rb_eSystemCallError, "XSL file loading error"); |
203 |
@@ -652,7 +659,7 @@ VALUE xsl_process_real(VALUE none, VALUE self) |
204 |
// Parse XML |
205 |
if (looksLikeXML(rbxml)) |
206 |
{ |
207 |
- myPointers.docxml = xmlReadMemory(RSTRING(rbxml)->ptr, RSTRING(rbxml)->len, ".", NULL, xmlOptions); |
208 |
+ myPointers.docxml = xmlReadMemory(RSTRING_PTR(rbxml), RSTRING_LEN(rbxml), ".", NULL, xmlOptions); |
209 |
if (myPointers.docxml == NULL) |
210 |
{ |
211 |
my_raise(self, &myPointers, rb_eSystemCallError, "XML parsing error"); |
212 |
@@ -661,7 +668,7 @@ VALUE xsl_process_real(VALUE none, VALUE self) |
213 |
} |
214 |
else // xml is a filename |
215 |
{ |
216 |
- myPointers.docxml = xmlReadFile(RSTRING(rbxml)->ptr, NULL, xmlOptions); |
217 |
+ myPointers.docxml = xmlReadFile(RSTRING_PTR(rbxml), NULL, xmlOptions); |
218 |
if (myPointers.docxml == NULL) |
219 |
{ |
220 |
my_raise(self, &myPointers, rb_eSystemCallError, "XML file parsing error"); |