1 |
ssuominen 11/07/29 06:47:41 |
2 |
|
3 |
Modified: liblrdf-0.4.0-dontbuild-tests.patch |
4 |
Added: liblrdf-0.4.0-raptor2.patch |
5 |
Log: |
6 |
Use raptor2 instead of raptor wrt bug #375025 |
7 |
|
8 |
(Portage version: 2.2.0_alpha47/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.2 media-libs/liblrdf/files/liblrdf-0.4.0-dontbuild-tests.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/liblrdf/files/liblrdf-0.4.0-dontbuild-tests.patch?rev=1.2&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/liblrdf/files/liblrdf-0.4.0-dontbuild-tests.patch?rev=1.2&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/liblrdf/files/liblrdf-0.4.0-dontbuild-tests.patch?r1=1.1&r2=1.2 |
16 |
|
17 |
Index: liblrdf-0.4.0-dontbuild-tests.patch |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/media-libs/liblrdf/files/liblrdf-0.4.0-dontbuild-tests.patch,v |
20 |
retrieving revision 1.1 |
21 |
retrieving revision 1.2 |
22 |
diff -u -r1.1 -r1.2 |
23 |
--- liblrdf-0.4.0-dontbuild-tests.patch 16 Jun 2008 12:00:51 -0000 1.1 |
24 |
+++ liblrdf-0.4.0-dontbuild-tests.patch 29 Jul 2011 06:47:41 -0000 1.2 |
25 |
@@ -1,7 +1,7 @@ |
26 |
-Index: liblrdf-0.4.0/examples/Makefile.am |
27 |
-=================================================================== |
28 |
---- liblrdf-0.4.0.orig/examples/Makefile.am |
29 |
-+++ liblrdf-0.4.0/examples/Makefile.am |
30 |
+http://bugs.gentoo.org/226281 |
31 |
+ |
32 |
+--- examples/Makefile.am |
33 |
++++ examples/Makefile.am |
34 |
@@ -1,7 +1,9 @@ |
35 |
-noinst_PROGRAMS = showdefaults showtaxonomy dumpstatements export_test \ |
36 |
- subclass_test add_test instances_test remove_test multi_test \ |
37 |
|
38 |
|
39 |
|
40 |
1.1 media-libs/liblrdf/files/liblrdf-0.4.0-raptor2.patch |
41 |
|
42 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/liblrdf/files/liblrdf-0.4.0-raptor2.patch?rev=1.1&view=markup |
43 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-libs/liblrdf/files/liblrdf-0.4.0-raptor2.patch?rev=1.1&content-type=text/plain |
44 |
|
45 |
Index: liblrdf-0.4.0-raptor2.patch |
46 |
=================================================================== |
47 |
http://projects.archlinux.org/svntogit/packages.git/plain/liblrdf/trunk/raptor2.diff |
48 |
|
49 |
--- src/Makefile.am |
50 |
+++ src/Makefile.am |
51 |
@@ -4,5 +4,5 @@ lib_LTLIBRARIES = liblrdf.la |
52 |
noinst_HEADERS = lrdf_md5.h md5_loc.h ladspa.h |
53 |
|
54 |
liblrdf_la_SOURCES = lrdf.c lrdf_multi.c md5.c |
55 |
-liblrdf_la_LIBADD = -lraptor |
56 |
+liblrdf_la_LIBADD = -lraptor2 |
57 |
liblrdf_la_LDFLAGS = -version-info @LRDF_LIBTOOL_VERSION@ |
58 |
--- src/lrdf.c |
59 |
+++ src/lrdf.c |
60 |
@@ -18,6 +18,7 @@ |
61 |
static unsigned int lrdf_uid = 0; /* A unique(ish) id to append to genid's to |
62 |
* avoid clashses */ |
63 |
|
64 |
+static raptor_world *world = NULL; |
65 |
static lrdf_statement *triples = NULL; |
66 |
static lrdf_statement *free_triples; |
67 |
static lrdf_string_hash *resources_hash[LRDF_HASH_SIZE]; |
68 |
@@ -43,8 +44,7 @@ static void lrdf_remove_triple_hash(lrdf_triple_hash ** tbl, |
69 |
lrdf_hash hash, lrdf_statement * s); |
70 |
static void lrdf_add_closure_hash(lrdf_closure_hash ** tbl, |
71 |
lrdf_hash subject, lrdf_hash object); |
72 |
-static void lrdf_store(void *user_data, |
73 |
- const raptor_statement * statement); |
74 |
+static void lrdf_store(void *user_data, raptor_statement * statement); |
75 |
void lrdf_free_statements(lrdf_statement * s); |
76 |
void lrdf_copy_statement(lrdf_statement * from, lrdf_statement * to); |
77 |
void lrdf_rebuild_taxonomic_closure(lrdf_closure_hash ** fwd_tbl, |
78 |
@@ -71,7 +71,7 @@ void lrdf_init() |
79 |
unsigned int i; |
80 |
struct timeval tv; |
81 |
|
82 |
- raptor_init(); |
83 |
+ world = raptor_new_world(); |
84 |
lrdf_more_triples(256); |
85 |
|
86 |
/* A UID to add to genids to make them safer */ |
87 |
@@ -112,7 +112,8 @@ void lrdf_more_triples(int count) |
88 |
|
89 |
void lrdf_cleanup() |
90 |
{ |
91 |
- raptor_finish(); |
92 |
+ raptor_free_world(world); |
93 |
+ world = NULL; |
94 |
|
95 |
lrdf_free_string_hash(resources_hash); |
96 |
lrdf_free_string_hash(literals_hash); |
97 |
@@ -232,26 +233,29 @@ void lrdf_remove_matches(lrdf_statement *pattern) |
98 |
} |
99 |
} |
100 |
|
101 |
-static void lrdf_store(void *user_data, const raptor_statement * statement) |
102 |
+static const char *lrdf_term_as_string(char *tmp, int tmp_len, |
103 |
+ const raptor_term *term) |
104 |
+{ |
105 |
+ switch (term->type) { |
106 |
+ case RAPTOR_TERM_TYPE_URI: |
107 |
+ return (const char *) raptor_uri_as_string(term->value.uri); |
108 |
+ case RAPTOR_TERM_TYPE_LITERAL: |
109 |
+ return (const char *) term->value.literal.string; |
110 |
+ case RAPTOR_TERM_TYPE_BLANK: |
111 |
+ snprintf(tmp, tmp_len, "_:%s.%x", term->value.blank.string, lrdf_uid); |
112 |
+ return tmp; |
113 |
+ default: |
114 |
+ return "(?)"; |
115 |
+ } |
116 |
+} |
117 |
+ |
118 |
+static void lrdf_store(void *user_data, raptor_statement * statement) |
119 |
{ |
120 |
lrdf_statement *s = lrdf_alloc_statement(); |
121 |
char tmps[128], tmpp[128], tmpo[128]; |
122 |
- char *subj = (char *) statement->subject, |
123 |
- *pred = (char *) statement->predicate, |
124 |
- *obj = (char *) statement->object; |
125 |
- |
126 |
- if (statement->subject_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) { |
127 |
- snprintf(tmps, 127, "_:%s.%x", subj, lrdf_uid); |
128 |
- subj = tmps; |
129 |
- } |
130 |
- if (statement->predicate_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) { |
131 |
- snprintf(tmpp, 127, "_:%s.%x", pred, lrdf_uid); |
132 |
- pred = tmpp; |
133 |
- } |
134 |
- if (statement->object_type == RAPTOR_IDENTIFIER_TYPE_ANONYMOUS) { |
135 |
- snprintf(tmpo, 127, "_:%s.%x", obj, lrdf_uid); |
136 |
- obj = tmpo; |
137 |
- } |
138 |
+ const char *subj = lrdf_term_as_string(tmps, 128, statement->subject), |
139 |
+ *pred = lrdf_term_as_string(tmpp, 128, statement->predicate), |
140 |
+ *obj = lrdf_term_as_string(tmpo, 128, statement->object); |
141 |
|
142 |
s->shash = lrdf_gen_hash(subj); |
143 |
s->phash = lrdf_gen_hash(pred); |
144 |
@@ -261,7 +265,7 @@ static void lrdf_store(void *user_data, const raptor_statement * statement) |
145 |
|
146 |
s->subject = lrdf_check_hash(resources_hash, s->shash, subj); |
147 |
s->predicate = lrdf_check_hash(resources_hash, s->phash, pred); |
148 |
- if (statement->object_type == RAPTOR_IDENTIFIER_TYPE_LITERAL) { |
149 |
+ if (statement->object->type == RAPTOR_TERM_TYPE_LITERAL) { |
150 |
s->object = lrdf_check_hash(literals_hash, s->ohash, obj); |
151 |
s->object_type = lrdf_literal; |
152 |
} else { |
153 |
@@ -537,28 +541,22 @@ void lrdf_rebuild_taxonomic_closure(lrdf_closure_hash ** fwd_tbl, |
154 |
free(pathto); |
155 |
} |
156 |
|
157 |
-static void lrdf_error_handler(void *data, raptor_locator * locator, |
158 |
- const char *message); |
159 |
+static void lrdf_log_handler(void *data, raptor_log_message *message); |
160 |
|
161 |
-static void lrdf_error_handler(void *data, raptor_locator * locator, |
162 |
- const char *message) |
163 |
+static void lrdf_log_handler(void *data, raptor_log_message *message) |
164 |
{ |
165 |
- fprintf(stderr, "liblrdf: error - "); |
166 |
- raptor_print_locator(stderr, locator); |
167 |
- fprintf(stderr, " - %s\n", message); |
168 |
- |
169 |
- raptor_parse_abort((raptor_parser*)data); |
170 |
-} |
171 |
+ const char *severity = "error"; |
172 |
+ if (message->level == RAPTOR_LOG_LEVEL_WARN) { |
173 |
+ severity = "warning"; |
174 |
+ } |
175 |
|
176 |
-static void lrdf_warning_handler(void *data, raptor_locator * locator, |
177 |
- const char *message); |
178 |
+ fprintf(stderr, "liblrdf: %s - ", severity); |
179 |
+ raptor_locator_print(message->locator, stderr); |
180 |
+ fprintf(stderr, " - %s\n", message->text); |
181 |
|
182 |
-static void lrdf_warning_handler(void *data, raptor_locator * locator, |
183 |
- const char *message) |
184 |
-{ |
185 |
- fprintf(stderr, "liblrdf: warning - "); |
186 |
- raptor_print_locator(stderr, locator); |
187 |
- fprintf(stderr, " - %s\n", message); |
188 |
+ if (message->level != RAPTOR_LOG_LEVEL_WARN) { |
189 |
+ raptor_parser_parse_abort((raptor_parser*)data); |
190 |
+ } |
191 |
} |
192 |
|
193 |
|
194 |
@@ -593,15 +591,15 @@ int lrdf_read_file_intl(const char *uri) |
195 |
lrdf_hash source; |
196 |
|
197 |
//printf("lrdf: reading %s\n", uri); |
198 |
- ruri = raptor_new_uri(uri); |
199 |
- furi = raptor_new_uri(uri); |
200 |
+ ruri = raptor_new_uri(world, (const unsigned char *) uri); |
201 |
+ furi = raptor_new_uri(world, (const unsigned char *) uri); |
202 |
source = lrdf_gen_hash(uri); |
203 |
lrdf_check_hash(resources_hash, source, uri); |
204 |
|
205 |
if (strstr(uri, ".rdf")) { |
206 |
- parser = raptor_new_parser("rdfxml"); |
207 |
+ parser = raptor_new_parser(world, "rdfxml"); |
208 |
} else { |
209 |
- parser = raptor_new_parser("ntriples"); |
210 |
+ parser = raptor_new_parser(world, "ntriples"); |
211 |
} |
212 |
if (!parser) { |
213 |
fprintf(stderr, "liblrdf: failed to create parser\n"); |
214 |
@@ -609,12 +607,11 @@ int lrdf_read_file_intl(const char *uri) |
215 |
return 1; |
216 |
} |
217 |
|
218 |
- raptor_set_error_handler(parser, parser, lrdf_error_handler); |
219 |
- raptor_set_warning_handler(parser, NULL, lrdf_warning_handler); |
220 |
- raptor_set_statement_handler(parser, &source, lrdf_store); |
221 |
- raptor_set_default_generate_id_parameters(parser, NULL, ++lrdf_uid); |
222 |
+ raptor_world_set_log_handler(world, parser, lrdf_log_handler); |
223 |
+ raptor_parser_set_statement_handler(parser, &source, lrdf_store); |
224 |
+ raptor_world_set_generate_bnodeid_parameters(world, NULL, ++lrdf_uid); |
225 |
|
226 |
- if (raptor_parse_file(parser, furi, ruri)) { |
227 |
+ if (raptor_parser_parse_file(parser, furi, ruri)) { |
228 |
raptor_free_uri(furi); |
229 |
raptor_free_uri(ruri); |
230 |
raptor_free_parser(parser); |
231 |
--- configure.ac |
232 |
+++ configure.ac |
233 |
@@ -18,7 +18,7 @@ |
234 |
AC_HEADER_STDC |
235 |
AC_CHECK_HEADERS([errno.h limits.h stdlib.h string.h unistd.h]) |
236 |
|
237 |
-PKG_CHECK_MODULES(RAPTOR, raptor >= 0.9.11) |
238 |
+PKG_CHECK_MODULES(RAPTOR, raptor2 >= 0.9.11) |
239 |
|
240 |
# Checks for typedefs, structures, and compiler characteristics. |
241 |
AC_C_CONST |