]> git.pld-linux.org Git - packages/dbf2mysql.git/blob - dbf2mysql-debian.patch
- use http://ftp.debian.org/ url
[packages/dbf2mysql.git] / dbf2mysql-debian.patch
1 --- dbf2mysql-1.14a.orig/debian/changelog
2 +++ dbf2mysql-1.14a/debian/changelog
3 @@ -0,0 +1,137 @@
4 +dbf2mysql (1.14a-3.1) unstable; urgency=low
5 +
6 +  * Non-maintainer upload.
7 +  * Rebuild against libmysqlclient15-dev; libmysqlclient10-dev hasn't been
8 +    dropped yet, but hopefully will be for etch.  Closes: #343768.
9 +    - debian/patches/05_mysql_real_connect.dpatch: use mysql_real_connect(),
10 +      for libmysqlclient15 compatibility.
11 +
12 + -- Steve Langasek <vorlon@debian.org>  Fri, 17 Feb 2006 16:52:25 -0800
13 +
14 +dbf2mysql (1.14a-3) unstable; urgency=low
15 +
16 +  * Policy updated to 3.6.1
17 +  * Patch applied for umlauts.
18 +    (closes: #213958,#213959)
19 +  * Using dpatch support now for current and past patches.
20 +
21 + -- Francesco Paolo Lovergine <frankie@debian.org>  Tue,  7 Oct 2003 20:50:07 +0200
22 +
23 +dbf2mysql (1.14a-2) unstable; urgency=low
24 +
25 +  * Replaced mysql_connect with mysql_real_connect, SQLsock isn't used
26 +    anymore. (Bart Friederichs).
27 +  * README touched to reflect changes.
28 +
29 + -- Francesco Paolo Lovergine <frankie@debian.org>  Mon, 24 Feb 2003 18:30:26 +0100
30 +
31 +dbf2mysql (1.14a-1) unstable; urgency=low
32 +
33 +  * Patch for FoxPro (Christian Eyrich):
34 +       According to Erik Bachmanns XBase File Format Description all M Field
35 +       Types (including DBF_MTYPE_FPT) contain the block number as 10 digita
36 +       ASCII text. So handling it in DBF_MTYPE_FPT files as long value as the
37 +       current versions of dbf2mysql do is wrong. What I experienced with the
38 +       FoxPro files here confirm this.
39 +
40 +  * Patch for MySQL (Bart Friederichs):
41 +        I changed the dbf2mysql program to being able to enable the
42 +        local-infile option, that is needed for MySQL > 3.23.49 and >4.0.2. I
43 +        added an -L option to the command that enables it. It is tested and it
44 +        works. 
45 +
46 + -- Francesco Paolo Lovergine <frankie@debian.org>  Tue, 11 Feb 2003 14:47:22 +0100
47 +
48 +dbf2mysql (1.14-4) unstable; urgency=low
49 +
50 +  * Rebuilt to remove /usr/doc link
51 +  * Policy standard updated.
52 +
53 + -- Francesco Paolo Lovergine <frankie@debian.org>  Wed, 11 Dec 2002 15:20:56 +0100
54 +
55 +dbf2mysql (1.14-3) unstable; urgency=low
56 +
57 +  * Maintainer email corrected in control file.
58 +
59 + -- Francesco Paolo Lovergine <frankie@debian.org>  Mon, 26 Nov 2001 14:11:27 +0100
60 +
61 +dbf2mysql (1.14-2) unstable; urgency=low
62 +
63 +  * New maintainer. (closes: #93897)
64 +
65 + -- Francesco Paolo Lovergine <frankie@debian.org>  Tue, 20 Nov 2001 12:25:53 +0100
66 +
67 +dbf2mysql (1.14-1) unstable; urgency=high
68 +
69 +  * New upstream version, with support for MEMO fields.  Closes: #23719.
70 +  * dbf2mysql.c: Open temporary file with O_EXCL.
71 +  * debian/dbf2mysql.1: Updated and converted from POD to plain man so
72 +    that it can be forwarded upstream.
73 +  * Switched to debhelper 3.
74 +  * Conforms to Standards version 3.5.6:
75 +    * debian/copyright: Added upstream URL.
76 +    * debian/rules: Support the `debug' build option.
77 +
78 + -- Matej Vela <vela@debian.org>  Sun, 18 Nov 2001 21:45:13 +0100
79 +
80 +dbf2mysql (1.10d-3) unstable; urgency=high
81 +
82 +  * Maintainer set to Debian QA Group <packages@qa.debian.org>.
83 +  * Corrected the priority from extra to optional in
84 +    debian/control.
85 +
86 + -- Adrian Bunk <bunk@fs.tum.de>  Fri, 31 Aug 2001 23:43:44 +0200
87 +
88 +dbf2mysql (1.10d-2.0.1) unstable; urgency=low
89 +
90 +  * Non-maintainer upload
91 +  * recompile against current mysql packages to fix Depends: (closes: #43618)
92 +  * Add libmysql-dev to Build-Depends (closes: #78693)
93 +
94 + -- Steve Langasek <vorlon@debian.org>  Sat, 24 Feb 2001 12:55:00 -0600
95 +
96 +dbf2mysql (1.10d-2) unstable; urgency=high
97 +
98 +  * if not for frozen, then at least for unstable ..
99 +
100 + -- Heiko Schlittermann <heiko@lotte.sax.de>  Wed, 10 Feb 1999 02:26:53 +0100
101 +
102 +dbf2mysql (1.10d-1) frozen unstable; urgency=high
103 +
104 +  * re-upload, no changes beside including orig.tar.gz
105 +
106 + -- Heiko Schlittermann <heiko@lotte.sax.de>  Mon, 21 Dec 1998 22:27:22 +0100
107 +
108 +dbf2mysql (1.10d-1) frozen unstable contrib; urgency=high
109 +
110 +  * new upstream
111 +
112 + -- Heiko Schlittermann <heiko@lotte.sax.de>  Thu,  3 Dec 1998 19:22:25 +0100
113 +
114 +dbf2mysql (1.10b-3) stable contrib; urgency=high
115 +
116 +  * new compiled against the latest mysql libraries
117 +    (closes #28892)
118 +
119 + -- Heiko Schlittermann <heiko@lotte.sax.de>  Wed,  2 Sep 1998 00:16:19 +0200
120 +
121 +dbf2mysql (1.10b-2) contrib; urgency=low
122 +
123 +  * changed the distribution to only contrib ...
124 +    [Do I ever understand this???]
125 +
126 + -- Heiko Schlittermann <heiko@lotte.sax.de>  Tue, 7 Oct 1997 01:06:43 +0200
127 +
128 +dbf2mysql (1.10b-1) unstable contrib; urgency=low
129 +
130 +  * moved to contrib distribution, since it depends
131 +    on non-free mysql (bug ????, Martin Schulze)
132 +
133 + -- Heiko Schlittermann <heiko@lotte.sax.de>  Mon, 6 Oct 1997 22:38:17 +0200
134 +
135 +dbf2mysql (1.10b-0) unstable; urgency=low
136 +
137 +  * Initial Debian release
138 +  * Manpage added
139 +
140 + -- Heiko Schlittermann <heiko@lotte.sax.de>  Fri, 1 Aug 1997 09:56:45 +0200
141 --- dbf2mysql-1.14a.orig/debian/foxpro.diff
142 +++ dbf2mysql-1.14a/debian/foxpro.diff
143 @@ -0,0 +1,11 @@
144 +--- dbf2mysql-1.14-4/dbf.c     Sat Jul  8 02:19:51 2000
145 ++++ dbf.c      Mon Feb  3 13:47:16 2003
146 +@@ -570,8 +570,6 @@
147 +           switch(dbh->db_memo)
148 +           {
149 +             case DBF_MTYPE_FPT:
150 +-              blknum = get_long(dbffield);
151 +-              break;
152 +             case DBF_MTYPE_DBT3:
153 +             case DBF_MTYPE_DBT4:
154 +               strncpy(fields[t].db_contents, (char *)dbffield, fields[t].db_flen);
155 --- dbf2mysql-1.14a.orig/debian/control
156 +++ dbf2mysql-1.14a/debian/control
157 @@ -0,0 +1,13 @@
158 +Source: dbf2mysql
159 +Section: misc
160 +Priority: optional
161 +Maintainer: Francesco Paolo Lovergine <frankie@debian.org>
162 +Standards-Version: 3.6.1
163 +Build-Depends: debhelper (>= 3), dpatch, libmysqlclient15-dev | libmysqlclient-dev
164 +
165 +Package: dbf2mysql
166 +Architecture: any
167 +Depends: ${shlibs:Depends}
168 +Description: xBase <--> MySQL
169 + This program takes an xBase file and sends queries to an MySQL server to
170 + insert it into an MySQL table and vice versa.
171 --- dbf2mysql-1.14a.orig/debian/copyright
172 +++ dbf2mysql-1.14a/debian/copyright
173 @@ -0,0 +1,14 @@
174 +This is Debian's prepackaged version of the dbf2mysql utility.
175 +
176 +Upstream sources were obtained from
177 +<http://www.mysql.com/Downloads/Contrib/dbf2mysql-1.14.tar.gz>.
178 +
179 +The copyright found in the package README:
180 +
181 +  Use this piece of software as you want, modify it to suit your needs,
182 +  but please leave my name in place ok? :)
183 +
184 +The authors are:
185 +
186 +  Maarten Boekhold <boekhold@cindy.et.tudelft.nl>
187 +  Michael Widenius <monty@analytikerna.se>
188 --- dbf2mysql-1.14a.orig/debian/README.diff
189 +++ dbf2mysql-1.14a/debian/README.diff
190 @@ -0,0 +1,12 @@
191 +--- ../../dbf2mysql-1.14/README        2000-07-08 02:08:03.000000000 +0200
192 ++++ /tmp/README        2003-02-24 18:23:49.000000000 +0100
193 +@@ -84,6 +84,9 @@
194
195 + -r  Trim trailing and leading whitspaces from CHAR type fields data
196
197 ++-L  Enable LOAD DATA LOCAL INFILE, should be used with MySQL > 3.23.49 and
198 ++    > 4.0.2
199 ++
200 + Rudimentary read-only support for Visual FoxPro, DB III+, and DB IV memo
201 + fields/files has been added.
202
203 --- dbf2mysql-1.14a.orig/debian/dbf2mysql.1
204 +++ dbf2mysql-1.14a/debian/dbf2mysql.1
205 @@ -0,0 +1,181 @@
206 +.TH DBF2MYSQL 1 "2001-11-18" "Debian Project"
207 +
208 +.SH NAME
209 +dbf2mysql, mysql2dbf \- convert between xBase and MySQL databases
210 +
211 +.SH SYNOPSIS
212 +.B dbf2mysql
213 +.RB [ -v [ v ]]
214 +.RB [ -f ]
215 +.RB [ -u | -l ]
216 +.RB [ -n ]
217 +.RB [ -o
218 +.IR field [, field ]]
219 +.RB [ -e
220 +.IR conversion-file ]
221 +.RB [ -s
222 +.IR old-name = new-name [,\c
223 +.IR old-name = new-name ]]
224 +.RB [ -i
225 +.IR field [, field ]]
226 +.RB [ -d
227 +.IR database ]
228 +.RB [ -t
229 +.IR table ]
230 +.RB [ -c [ c ]]
231 +.RB [ -p
232 +.IR primary ]
233 +.RB [ -h
234 +.IR host ]
235 +.RB [ -F ]
236 +.RB [ -q ]
237 +.RB [ -r ]
238 +.RB [ -x ]
239 +.RB [ -P
240 +.IR password ]
241 +.RB [ -U
242 +.IR user ]
243 +.I dbf-file
244 +.PP
245 +.B mysql2dbf
246 +.RB [ -v [ v ]]
247 +.RB [ -u | -l ]
248 +.B -d
249 +.I database
250 +.B -t
251 +.I table
252 +.RB [ -h
253 +.IR host ]
254 +.RB [ -q
255 +.IR query ]
256 +.RB [ -P
257 +.IR password ]
258 +.RB [ -U
259 +.IR user ]
260 +.I dbf-file
261 +
262 +.SH DESCRIPTION
263 +.B dbf2mysql
264 +takes an xBase file and sends queries to an MySQL server to insert it
265 +into an MySQL table.
266 +.PP
267 +.B mysql2dbf
268 +dumps a MySQL table to a dbf file.
269 +
270 +.SH OPTIONS
271 +.TP
272 +.B -v
273 +Produce some status output.
274 +.TP
275 +.B -vv
276 +More verbose.
277 +.TP
278 +.B -vvv
279 +Even more verbose: produce a progress report.
280 +.TP
281 +.B -f
282 +Translate all field names in the xBase file to lowercase.
283 +.TP
284 +.B -u
285 +Translate all text in the xBase file to uppercase.
286 +.TP
287 +.B -l
288 +Translate all text in the xBase file to lowercase.
289 +.TP
290 +.B -n
291 +Allow NULL fields: 'NOT NULL' will be not added in table creation
292 +statement.
293 +.TP
294 +.BI -o " field\fR[,\fPfield\fR[,...]]"
295 +List fields to insert into MySQL database.  Primary use is to ease
296 +import of complex dbf files where we want only few fields.  NOTE:
297 +.B -o
298 +is processed before substitution
299 +.RB ( -s ),
300 +so you have to use dbf field names here.
301 +.TP
302 +.BI -e " conversion-file"
303 +Specify file for CHAR fields conversion.  File format is:
304 +1st line: number of characters to convert (number of lines).
305 +Further lines: <char_to_convert> <char_after_conversion>.
306 +.TP
307 +.BI -s " old-name\fR=\fPnew-name\fR[,\fPold-name\fR=\fPnew-name\fR[,...]]"
308 +Takes a list of field name/new field name pairs.  Primary use is to
309 +avoid conflicts between field names and MySQL reserved keywords.  When
310 +the new field name is empty, the field is skipped in both the CREATE
311 +clause and the INSERT clauses, i.e. it will not be present in the MySQL
312 +table.  For example:
313 +.IP
314 +.nf
315 +-s ORDER=HORDER,REMARKS=,STAT1=STATUS1
316 +.fi
317 +.TP
318 +.BI -i " field\fR[,\fPfield\fR[,...]]"
319 +List fields to be indexed.  MySQL field names should be used here.
320 +.TP
321 +.BI -d " database"
322 +Select the database to insert into.  Default is 'test'.
323 +.TP
324 +.BI -t " table"
325 +Select the table to insert into.  Default is 'test'.
326 +.TP
327 +.BR -c [ c ]
328 +Create table if one doesn't exist already.  If the table already exists,
329 +drop it and build a new one.  The default is to insert all data into the
330 +named table.  If
331 +.B -cc
332 +is specified, no records will be inserted.
333 +.TP
334 +.B -p " primary"
335 +Select the primary key.  You have to give the exact field name.
336 +.TP
337 +.BI -h " host"
338 +Select the host to insert into.  Untested.
339 +.TP
340 +.B -F
341 +Fixed length records.  (By default CHAR is saved as VARCHAR.)
342 +.TP
343 +.B -q
344 +.BR dbf2mysql :
345 +"Quick" mode.  Inserts data via temporary file using 'LOAD DATA INFILE'
346 +MySQL statement.  This increased insertion speed on my PC 2-2.5 times.
347 +Also note that during whole 'LOAD DATA' affected table is locked.
348 +.IP
349 +.BR mysql2dbf :
350 +Specify custom query to use.
351 +.TP
352 +.B -r
353 +Trim trailing and leading whitespace from CHAR type fields data.
354 +.TP
355 +.B -x
356 +Start each table with _rec and _timestamp fields.
357 +.TP
358 +.BI -P " password"
359 +Specify password on the MySQL server.
360 +.TP
361 +.BI -U " user"
362 +Specify user on the MySQL server.
363 +.SH BUGS
364 +.B mysql2dbf
365 +can't write MEMO files at this time.
366 +.PP
367 +Possibly incorrect field lengths for REAL numbers.
368 +
369 +.SH AUTHORS
370 +Originally written by Maarten Boekhold <boekhold@cindy.et.tudelft.nl>,
371 +Oct 1995.
372 +.PP
373 +Patched for MySQL by Michael Widenius <monty@analytikerna.se>,
374 +3 Nov 1996.
375 +.PP
376 +Manual page written for Debian GNU/Linux from README by
377 +Heiko Schlittermann <heiko@lotte.sax.de>, Aug 1997; updated by
378 +Matej Vela <vela@debian.org>, Nov 2001.
379 +
380 +.SH COPYRIGHT
381 +Use this piece of software as you want, modify it to suit your needs,
382 +but please leave my name in place ok? :)
383 +
384 +.SH DISCLAIMER
385 +The authors do not accept any responsibility for possible damage you get
386 +as result of using this program.
387 --- dbf2mysql-1.14a.orig/debian/mysql.diff
388 +++ dbf2mysql-1.14a/debian/mysql.diff
389 @@ -0,0 +1,174 @@
390 +--- ../../dbf2mysql-1.14/dbf2mysql.c   2002-12-19 10:34:13.000000000 +0100
391 ++++ /tmp/dbf2mysql.c   2003-02-24 18:23:44.000000000 +0100
392 +@@ -9,10 +9,13 @@
393 +    Fixxed Quick mode insert for blank Numeric fields
394 +    Modified to use -x flag to add _rec and _timestamp fields to start of record.
395 +       ( only those lines immediately affect by if(express) (and getopt) )
396 ++
397 ++   Bart Friederichs <bart@friesoft.nl> feb 2003
398 ++   Added MYSQL_OPT_LOCAL_INFILE to options for compatibility with 
399 ++      MySQL >3.23.49 and >4.0.2, new option -L enables it
400 ++   Replaced mysql_connect with mysql_real_connect, SQLsock isn't used anymore
401 + */
402 + #include <stdio.h>
403 +-#include <sys/types.h>
404 +-#include <sys/stat.h>
405 + #include <fcntl.h>
406 + #include <stdlib.h>
407 + #include <unistd.h>
408 +@@ -22,7 +25,7 @@
409 + #include "dbf.h"
410
411 + int   verbose=0, upper=0, lower=0, create=0, fieldlow=0, var_chars=1;
412 +-int   express=0;
413 ++int   express=0, enable_local=0;
414 + int   null_fields=0, trim=0, quick=0;
415 + char  primary[11];
416 + char  *host = NULL;
417 +@@ -81,7 +84,7 @@
418 +               printf("dbf2mysql %s\n", VERSION);
419 +               printf("usage: dbf2mysql [-h hostname] [-d dbase] [-t table] [-p primary key]\n");
420 +               printf("                 [-o field[,field]] [-s oldname=newname[,oldname=newname]]\n");
421 +-              printf("                 [-i field[,field]] [-c] [-f] [-F] [-n] [-r] [-u|-l] \n"); 
422 ++              printf("                 [-i field[,field]] [-c] [-f] [-F] [-n] [-r] [-u|-l] [-L]\n"); 
423 +               printf("                 [-v[v]] [-x] [-q]  [-P password] [-U user] dbf-file\n");
424 + }
425
426 +@@ -398,8 +401,7 @@
427 +       else  /* if specified -q create file for 'LOAD DATA' */
428 +       {
429 +           datafile = tempnam ("/tmp", "d2my");
430 +-          tempfile = fdopen (open (datafile, O_WRONLY | O_CREAT | O_EXCL,
431 +-                                   0600), "wt");
432 ++          tempfile = fopen (datafile, "wt");
433 +           if (tempfile == NULL || datafile == NULL)
434 +           {
435 +               fprintf (stderr, "Cannot open file '%s' for writing\n", datafile);
436 +@@ -578,7 +580,7 @@
437 +       }
438 +       if (mysql_query(SQLsock, query) == -1) {
439 +           fprintf(stderr,
440 +-                  "Error sending LOAD DATA INFILE from file '%s'\n", datafile);
441 ++                  "Error sending LOAD DATA LOCAL INFILE from file '%s'\n", datafile);
442 +           fprintf(stderr,
443 +                   "Detailed report: %s\n",
444 +                   mysql_error(SQLsock));
445 +@@ -594,7 +596,7 @@
446 + int main(int argc, char **argv)
447 + {
448 +       int             i;
449 +-      MYSQL           *SQLsock,mysql;
450 ++      MYSQL           mysql;
451 +       extern int      optind;
452 +       extern char     *optarg;
453 +       char            *query;
454 +@@ -602,7 +604,7 @@
455
456 +       primary[0] = '\0';
457
458 +-      while ((i = getopt(argc, argv, "xqfFrne:lucvi:h:p:d:t:s:o:U:P:")) != EOF) {
459 ++      while ((i = getopt(argc, argv, "xqLfFrne:lucvi:h:p:d:t:s:o:U:P:")) != EOF) {
460 +               switch (i) {
461 +                       case 'P':
462 +                               pass = (char *)strdup(optarg);
463 +@@ -669,6 +671,9 @@
464 +                       case 'o':
465 +                               flist = (char *)strdup(optarg);
466 +                               break;
467 ++                      case 'L':
468 ++                              enable_local = 1;
469 ++                              break;
470 +                       case ':':
471 +                               usage();
472 +                               printf("missing argument!\n");
473 +@@ -707,6 +712,7 @@
474 +                      table);
475 +               printf("Number of records: %ld\n", dbh->db_records);
476 +       }
477 ++
478 +       if (verbose > 1) {
479 +               printf("Name\t\t Length\tDisplay\t Type\n");
480 +               printf("-------------------------------------\n");
481 +@@ -723,7 +729,20 @@
482 +               printf("Making connection to MySQL-server\n");
483 +       }
484
485 +-      if (!(SQLsock = mysql_connect(&mysql,host,user,pass))) {
486 ++      mysql_init(&mysql);
487 ++
488 ++      if (enable_local == 1) {
489 ++              if (verbose) {
490 ++                      printf("Setting MySQL option MYSQL_OPT_LOCAL_INFILE\n");
491 ++              }
492 ++
493 ++              if (mysql_options(&mysql, MYSQL_OPT_LOCAL_INFILE, 0)) {
494 ++                  printf("Setting option not succeeded.");
495 ++                  exit(1);
496 ++              }
497 ++      }
498 ++
499 ++      if (!mysql_real_connect(&mysql,host,user,pass, dbase, 0, NULL,0)) {
500 +               fprintf(stderr, "Couldn't get a connection with the ");
501 +               fprintf(stderr, "designated host!\n");
502 +               fprintf(stderr, "Detailed report: %s\n", mysql_error(&mysql));
503 +@@ -731,23 +750,12 @@
504 +               exit(1);
505 +       }
506
507 +-      if (verbose > 2) {
508 +-              printf("Selecting database '%s'\n", dbase);
509 +-      }
510 +-
511 +-      if ((mysql_select_db(SQLsock, dbase)) == -1) {
512 +-              fprintf(stderr, "Couldn't select database %s.\n", dbase);
513 +-              fprintf(stderr, "Detailed report: %s\n", mysql_error(SQLsock));
514 +-              mysql_close(SQLsock);
515 +-              dbf_close(&dbh);
516 +-              exit(1);
517 +-      }
518 + /* Substitute field names */
519 +       do_onlyfields(flist, dbh);
520 +       do_substitute(subarg, dbh);
521
522 +       if (!create) {
523 +-              if (!check_table(SQLsock, table)) {
524 ++              if (!check_table(&mysql, table)) {
525 +                       printf("Table does not exist!\n");
526 +                       exit(1);
527 +               }
528 +@@ -758,30 +766,30 @@
529
530 +               if (!(query = (char *)malloc(12 + strlen(table)))) {
531 +                       printf("Memory-allocation error in main (drop)!\n");
532 +-                      mysql_close(SQLsock);
533 ++                      mysql_close(&mysql);
534 +                       dbf_close(&dbh);
535 +                       exit(1);
536 +               }
537
538 +               sprintf(query, "DROP TABLE %s", table);
539 +-              mysql_query(SQLsock, query);
540 ++              mysql_query(&mysql, query);
541 +               free(query);
542
543 + /* Build a CREATE-clause
544 + */
545 +-              do_create(SQLsock, table, dbh);
546 ++              do_create(&mysql, table, dbh);
547 +       }
548
549 + /* Build an INSERT-clause
550 + */
551 +       if (create < 2)
552 +-        do_inserts(SQLsock, table, dbh);
553 ++        do_inserts(&mysql, table, dbh);
554
555 +       if (verbose > 2) {
556 +               printf("Closing up....\n");
557 +       }
558
559 +-    mysql_close(SQLsock);
560 ++    mysql_close(&mysql);
561 +     dbf_close(&dbh);
562 +     exit(0);
563 + }
564 --- dbf2mysql-1.14a.orig/debian/rules
565 +++ dbf2mysql-1.14a/debian/rules
566 @@ -0,0 +1,97 @@
567 +#!/usr/bin/make -f
568 +# Sample debian/rules that uses debhelper.
569 +# This file is public domain software, originally written by Joey Hess. 
570 +
571 +# Uncomment this to turn on verbose mode.
572 +#export DH_VERBOSE=1
573 +
574 +# This is the debhelper compatibility version to use.
575 +export DH_COMPAT=3
576 +
577 +CFLAGS=-O2 -Wall
578 +ifneq ($(findstring debug,$(DEB_BUILD_OPTIONS)),)
579 +CFLAGS+=-g
580 +endif
581 +
582 +include /usr/share/dpatch/dpatch.make
583 +
584 +build: build-stamp
585 +build-stamp: patch-stamp
586 +       dh_testdir
587 +
588 +       # Patching
589 +       
590 +#      patch <debian/foxpro.diff
591 +#      patch <debian/mysql.diff
592 +#      patch <debian/README.diff
593 +#      patch <debian/u_char.diff
594 +       
595 +       # Add here commands to compile the package.
596 +       $(MAKE) CFLAGS="$(CFLAGS)" MYSQLLIB= STRIP=
597 +
598 +       touch build-stamp
599 +
600 +clean: myclean unpatch
601 +myclean:
602 +       dh_testdir
603 +       dh_testroot
604 +       rm -f build-stamp
605 +
606 +       # Add here commands to clean up after the build process.
607 +       -$(MAKE) clean
608 +
609 +
610 +       # Reversing patches
611 +        
612 +#      -patch --reverse <debian/README.diff
613 +#      -patch --reverse <debian/mysql.diff
614 +#      -patch --reverse <debian/foxpro.diff
615 +#      -patch --reverse <debian/u_char.diff
616 +
617 +       dh_clean
618 +
619 +install: build
620 +       dh_testdir
621 +       dh_testroot
622 +       dh_clean -k
623 +       dh_installdirs usr/bin
624 +
625 +       # Add here commands to install the package into debian/<packagename>
626 +       install dbf2mysql mysql2dbf debian/dbf2mysql/usr/bin
627 +
628 +# Build architecture-independent files here.
629 +binary-indep: build install
630 +# We have nothing to do by default.
631 +
632 +# Build architecture-dependent files here.
633 +binary-arch: build install
634 +       dh_testdir
635 +       dh_testroot
636 +#      dh_installdebconf       
637 +       dh_installdocs README
638 +       dh_installexamples
639 +       dh_installmenu
640 +#      dh_installlogrotate
641 +#      dh_installemacsen
642 +#      dh_installpam
643 +#      dh_installmime
644 +#      dh_installinit
645 +       dh_installcron
646 +       dh_installman debian/dbf2mysql.1
647 +       dh_installinfo
648 +#      dh_undocumented
649 +       dh_installchangelogs
650 +       dh_link usr/share/man/man1/dbf2mysql.1 usr/share/man/man1/mysql2dbf.1
651 +       dh_strip
652 +       dh_compress
653 +       dh_fixperms
654 +#      dh_makeshlibs
655 +       dh_installdeb
656 +#      dh_perl
657 +       dh_shlibdeps
658 +       dh_gencontrol
659 +       dh_md5sums
660 +       dh_builddeb
661 +
662 +binary: binary-indep binary-arch
663 +.PHONY: build clean binary-indep binary-arch binary install patch unpatch myclean
664 --- dbf2mysql-1.14a.orig/debian/README.Debian
665 +++ dbf2mysql-1.14a/debian/README.Debian
666 @@ -0,0 +1,19 @@
667 +
668 +This release of dbf2mysql adds a couple of unofficial patches.
669 +They are due to Christian Eyrich and Bart Friederichs.
670 +Apparently upstream is no more active, so I forked sources.
671 +
672 +I tagged debian release as 1.14a for this reason.
673 +
674 +According to Erik Bachmanns XBase File Format Description all M Field
675 +Types (including DBF_MTYPE_FPT) contain the block number as 10 digita
676 +ASCII text. So handling it in DBF_MTYPE_FPT files as long value as the
677 +current versions of dbf2mysql do is wrong. What Chris experienced with the
678 +FoxPro files here confirm this.
679 +
680 +Bart changed the dbf2mysql program to being able to enable the
681 +local-infile option, that is needed for MySQL > 3.23.49 and >4.0.2. Bart
682 +also added an -L option to the command that enables it. 
683 +It is tested and it works.
684 +
685 +-- Francesco P. Lovergine <frankie@debian.org>
686 --- dbf2mysql-1.14a.orig/debian/patches/00list
687 +++ dbf2mysql-1.14a/debian/patches/00list
688 @@ -0,0 +1,5 @@
689 +foxpro
690 +mysql
691 +README
692 +u_char
693 +05_mysql_real_connect
694 --- dbf2mysql-1.14a.orig/debian/patches/foxpro.dpatch
695 +++ dbf2mysql-1.14a/debian/patches/foxpro.dpatch
696 @@ -0,0 +1,37 @@
697 +#!/bin/sh -e
698 +## foxpro.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
699 +##
700 +## All lines beginning with `## DP:' are a description of the patch.
701 +## DP: No description.
702 +
703 +if [ $# -ne 1 ]; then
704 +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
705 +    exit 1
706 +fi
707 +
708 +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
709 +patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
710 +
711 +case "$1" in
712 +       -patch) patch $patch_opts -p1 < $0;;
713 +       -unpatch) patch $patch_opts -p1 -R < $0;;
714 +        *)
715 +                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
716 +                exit 1;;
717 +esac
718 +
719 +exit 0
720 +
721 +@DPATCH@
722 +diff -urNad /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/dbf.c dbf2mysql-1.14a/dbf.c
723 +--- /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/dbf.c        2003-10-07 20:40:57.000000000 +0200
724 ++++ dbf2mysql-1.14a/dbf.c      2003-10-07 20:41:29.000000000 +0200
725 +@@ -570,8 +570,6 @@
726 +           switch(dbh->db_memo)
727 +           {
728 +             case DBF_MTYPE_FPT:
729 +-              blknum = get_long(dbffield);
730 +-              break;
731 +             case DBF_MTYPE_DBT3:
732 +             case DBF_MTYPE_DBT4:
733 +               strncpy(fields[t].db_contents, (char *)dbffield, fields[t].db_flen);
734 --- dbf2mysql-1.14a.orig/debian/patches/mysql.dpatch
735 +++ dbf2mysql-1.14a/debian/patches/mysql.dpatch
736 @@ -0,0 +1,200 @@
737 +#!/bin/sh -e
738 +## mysql.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
739 +##
740 +## All lines beginning with `## DP:' are a description of the patch.
741 +## DP: No description.
742 +
743 +if [ $# -ne 1 ]; then
744 +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
745 +    exit 1
746 +fi
747 +
748 +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
749 +patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
750 +
751 +case "$1" in
752 +       -patch) patch $patch_opts -p1 < $0;;
753 +       -unpatch) patch $patch_opts -p1 -R < $0;;
754 +        *)
755 +                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
756 +                exit 1;;
757 +esac
758 +
759 +exit 0
760 +
761 +@DPATCH@
762 +diff -urNad /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/dbf2mysql.c dbf2mysql-1.14a/dbf2mysql.c
763 +--- /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/dbf2mysql.c  2003-10-07 20:46:27.000000000 +0200
764 ++++ dbf2mysql-1.14a/dbf2mysql.c        2003-10-07 20:46:55.000000000 +0200
765 +@@ -9,10 +9,13 @@
766 +    Fixxed Quick mode insert for blank Numeric fields
767 +    Modified to use -x flag to add _rec and _timestamp fields to start of record.
768 +       ( only those lines immediately affect by if(express) (and getopt) )
769 ++
770 ++   Bart Friederichs <bart@friesoft.nl> feb 2003
771 ++   Added MYSQL_OPT_LOCAL_INFILE to options for compatibility with 
772 ++      MySQL >3.23.49 and >4.0.2, new option -L enables it
773 ++   Replaced mysql_connect with mysql_real_connect, SQLsock isn't used anymore
774 + */
775 + #include <stdio.h>
776 +-#include <sys/types.h>
777 +-#include <sys/stat.h>
778 + #include <fcntl.h>
779 + #include <stdlib.h>
780 + #include <unistd.h>
781 +@@ -22,7 +25,7 @@
782 + #include "dbf.h"
783
784 + int   verbose=0, upper=0, lower=0, create=0, fieldlow=0, var_chars=1;
785 +-int   express=0;
786 ++int   express=0, enable_local=0;
787 + int   null_fields=0, trim=0, quick=0;
788 + char  primary[11];
789 + char  *host = NULL;
790 +@@ -81,7 +84,7 @@
791 +               printf("dbf2mysql %s\n", VERSION);
792 +               printf("usage: dbf2mysql [-h hostname] [-d dbase] [-t table] [-p primary key]\n");
793 +               printf("                 [-o field[,field]] [-s oldname=newname[,oldname=newname]]\n");
794 +-              printf("                 [-i field[,field]] [-c] [-f] [-F] [-n] [-r] [-u|-l] \n"); 
795 ++              printf("                 [-i field[,field]] [-c] [-f] [-F] [-n] [-r] [-u|-l] [-L]\n"); 
796 +               printf("                 [-v[v]] [-x] [-q]  [-P password] [-U user] dbf-file\n");
797 + }
798
799 +@@ -398,8 +401,7 @@
800 +       else  /* if specified -q create file for 'LOAD DATA' */
801 +       {
802 +           datafile = tempnam ("/tmp", "d2my");
803 +-          tempfile = fdopen (open (datafile, O_WRONLY | O_CREAT | O_EXCL,
804 +-                                   0600), "wt");
805 ++          tempfile = fopen (datafile, "wt");
806 +           if (tempfile == NULL || datafile == NULL)
807 +           {
808 +               fprintf (stderr, "Cannot open file '%s' for writing\n", datafile);
809 +@@ -578,7 +580,7 @@
810 +       }
811 +       if (mysql_query(SQLsock, query) == -1) {
812 +           fprintf(stderr,
813 +-                  "Error sending LOAD DATA INFILE from file '%s'\n", datafile);
814 ++                  "Error sending LOAD DATA LOCAL INFILE from file '%s'\n", datafile);
815 +           fprintf(stderr,
816 +                   "Detailed report: %s\n",
817 +                   mysql_error(SQLsock));
818 +@@ -594,7 +596,7 @@
819 + int main(int argc, char **argv)
820 + {
821 +       int             i;
822 +-      MYSQL           *SQLsock,mysql;
823 ++      MYSQL           mysql;
824 +       extern int      optind;
825 +       extern char     *optarg;
826 +       char            *query;
827 +@@ -602,7 +604,7 @@
828
829 +       primary[0] = '\0';
830
831 +-      while ((i = getopt(argc, argv, "xqfFrne:lucvi:h:p:d:t:s:o:U:P:")) != EOF) {
832 ++      while ((i = getopt(argc, argv, "xqLfFrne:lucvi:h:p:d:t:s:o:U:P:")) != EOF) {
833 +               switch (i) {
834 +                       case 'P':
835 +                               pass = (char *)strdup(optarg);
836 +@@ -669,6 +671,9 @@
837 +                       case 'o':
838 +                               flist = (char *)strdup(optarg);
839 +                               break;
840 ++                      case 'L':
841 ++                              enable_local = 1;
842 ++                              break;
843 +                       case ':':
844 +                               usage();
845 +                               printf("missing argument!\n");
846 +@@ -707,6 +712,7 @@
847 +                      table);
848 +               printf("Number of records: %ld\n", dbh->db_records);
849 +       }
850 ++
851 +       if (verbose > 1) {
852 +               printf("Name\t\t Length\tDisplay\t Type\n");
853 +               printf("-------------------------------------\n");
854 +@@ -723,7 +729,20 @@
855 +               printf("Making connection to MySQL-server\n");
856 +       }
857
858 +-      if (!(SQLsock = mysql_connect(&mysql,host,user,pass))) {
859 ++      mysql_init(&mysql);
860 ++
861 ++      if (enable_local == 1) {
862 ++              if (verbose) {
863 ++                      printf("Setting MySQL option MYSQL_OPT_LOCAL_INFILE\n");
864 ++              }
865 ++
866 ++              if (mysql_options(&mysql, MYSQL_OPT_LOCAL_INFILE, 0)) {
867 ++                  printf("Setting option not succeeded.");
868 ++                  exit(1);
869 ++              }
870 ++      }
871 ++
872 ++      if (!mysql_real_connect(&mysql,host,user,pass, dbase, 0, NULL,0)) {
873 +               fprintf(stderr, "Couldn't get a connection with the ");
874 +               fprintf(stderr, "designated host!\n");
875 +               fprintf(stderr, "Detailed report: %s\n", mysql_error(&mysql));
876 +@@ -731,23 +750,12 @@
877 +               exit(1);
878 +       }
879
880 +-      if (verbose > 2) {
881 +-              printf("Selecting database '%s'\n", dbase);
882 +-      }
883 +-
884 +-      if ((mysql_select_db(SQLsock, dbase)) == -1) {
885 +-              fprintf(stderr, "Couldn't select database %s.\n", dbase);
886 +-              fprintf(stderr, "Detailed report: %s\n", mysql_error(SQLsock));
887 +-              mysql_close(SQLsock);
888 +-              dbf_close(&dbh);
889 +-              exit(1);
890 +-      }
891 + /* Substitute field names */
892 +       do_onlyfields(flist, dbh);
893 +       do_substitute(subarg, dbh);
894
895 +       if (!create) {
896 +-              if (!check_table(SQLsock, table)) {
897 ++              if (!check_table(&mysql, table)) {
898 +                       printf("Table does not exist!\n");
899 +                       exit(1);
900 +               }
901 +@@ -758,30 +766,30 @@
902
903 +               if (!(query = (char *)malloc(12 + strlen(table)))) {
904 +                       printf("Memory-allocation error in main (drop)!\n");
905 +-                      mysql_close(SQLsock);
906 ++                      mysql_close(&mysql);
907 +                       dbf_close(&dbh);
908 +                       exit(1);
909 +               }
910
911 +               sprintf(query, "DROP TABLE %s", table);
912 +-              mysql_query(SQLsock, query);
913 ++              mysql_query(&mysql, query);
914 +               free(query);
915
916 + /* Build a CREATE-clause
917 + */
918 +-              do_create(SQLsock, table, dbh);
919 ++              do_create(&mysql, table, dbh);
920 +       }
921
922 + /* Build an INSERT-clause
923 + */
924 +       if (create < 2)
925 +-        do_inserts(SQLsock, table, dbh);
926 ++        do_inserts(&mysql, table, dbh);
927
928 +       if (verbose > 2) {
929 +               printf("Closing up....\n");
930 +       }
931
932 +-    mysql_close(SQLsock);
933 ++    mysql_close(&mysql);
934 +     dbf_close(&dbh);
935 +     exit(0);
936 + }
937 --- dbf2mysql-1.14a.orig/debian/patches/README.dpatch
938 +++ dbf2mysql-1.14a/debian/patches/README.dpatch
939 @@ -0,0 +1,38 @@
940 +#!/bin/sh -e
941 +## README.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
942 +##
943 +## All lines beginning with `## DP:' are a description of the patch.
944 +## DP: No description.
945 +
946 +if [ $# -ne 1 ]; then
947 +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
948 +    exit 1
949 +fi
950 +
951 +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
952 +patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
953 +
954 +case "$1" in
955 +       -patch) patch $patch_opts -p1 < $0;;
956 +       -unpatch) patch $patch_opts -p1 -R < $0;;
957 +        *)
958 +                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
959 +                exit 1;;
960 +esac
961 +
962 +exit 0
963 +
964 +@DPATCH@
965 +diff -urNad /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/README dbf2mysql-1.14a/README
966 +--- /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/README       2003-10-07 20:48:13.000000000 +0200
967 ++++ dbf2mysql-1.14a/README     2003-10-07 20:48:43.000000000 +0200
968 +@@ -84,6 +84,9 @@
969
970 + -r  Trim trailing and leading whitspaces from CHAR type fields data
971
972 ++-L  Enable LOAD DATA LOCAL INFILE, should be used with MySQL > 3.23.49 and
973 ++    > 4.0.2
974 ++
975 + Rudimentary read-only support for Visual FoxPro, DB III+, and DB IV memo
976 + fields/files has been added.
977
978 --- dbf2mysql-1.14a.orig/debian/patches/u_char.dpatch
979 +++ dbf2mysql-1.14a/debian/patches/u_char.dpatch
980 @@ -0,0 +1,55 @@
981 +#!/bin/sh -e
982 +## u_char.dpatch by Francesco Paolo Lovergine <frankie@debian.org>
983 +##
984 +## All lines beginning with `## DP:' are a description of the patch.
985 +## DP: No description.
986 +
987 +if [ $# -ne 1 ]; then
988 +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
989 +    exit 1
990 +fi
991 +
992 +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
993 +patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
994 +
995 +case "$1" in
996 +       -patch) patch $patch_opts -p1 < $0;;
997 +       -unpatch) patch $patch_opts -p1 -R < $0;;
998 +        *)
999 +                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
1000 +                exit 1;;
1001 +esac
1002 +
1003 +exit 0
1004 +
1005 +@DPATCH@
1006 +diff -urNad /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/dbf.c dbf2mysql-1.14a/dbf.c
1007 +--- /home/frankie/debian/mypkgs/dbf2mysql/dbf2mysql-1.14a/dbf.c        2003-10-07 20:40:57.000000000 +0200
1008 ++++ dbf2mysql-1.14a/dbf.c      2003-10-07 20:48:59.000000000 +0200
1009 +@@ -513,7 +513,7 @@
1010 + {
1011 +     int       t, i;
1012 +     u_char    *dbffield;
1013 +-    char      *end, *sp;
1014 ++    u_char    *end, *sp;
1015 +     double    dblval;
1016 +     long long int8val;
1017 +     long      int4val;
1018 +@@ -549,7 +549,7 @@
1019 +     {
1020 +       switch(fields[t].db_type) {
1021 +         case 'C':             /* Character data */
1022 +-          end = (char *)&dbffield[fields[t].db_flen - 1];
1023 ++          end = &dbffield[fields[t].db_flen - 1];
1024 +           i = fields[t].db_flen;
1025 +           while (( i > 0) && ((*end < 0x21)/* || (*end > 0x7E)*/)) {
1026 +               end--;
1027 +@@ -659,7 +659,7 @@
1028 +           break;
1029
1030 +         default:
1031 +-          end = (char *)dbffield;
1032 ++          end = dbffield;
1033 +           i = fields[t].db_flen;
1034 +           while (( i > 0) && ((*end < 0x21)/* || (*end > 0x7E)*/)) {
1035 +               end++;
1036 --- dbf2mysql-1.14a.orig/debian/patches/05_mysql_real_connect.dpatch
1037 +++ dbf2mysql-1.14a/debian/patches/05_mysql_real_connect.dpatch
1038 @@ -0,0 +1,39 @@
1039 +#! /bin/sh /usr/share/dpatch/dpatch-run
1040 +## 05_mysql_real_connect.dpatch by Steve Langasek <vorlon@debian.org>
1041 +##
1042 +## All lines beginning with `## DP:' are a description of the patch.
1043 +## DP: switch from using mysql_connect to mysql_real_connect, for MySQL 5.0
1044 +## DP: compatibility
1045 +
1046 +@DPATCH@
1047 +
1048 +--- dbf2mysql-1.14a.orig/mysql2dbf.c
1049 ++++ dbf2mysql-1.14a/mysql2dbf.c
1050 +@@ -47,7 +47,7 @@
1051
1052 + int main(int argc, char **argv) {
1053 +       int             i;
1054 +-      MYSQL           *SQLsock,mysql;
1055 ++      MYSQL           *SQLsock;
1056 +       extern int      optind;
1057 +       extern char     *optarg;
1058 +       char            *query = NULL;
1059 +@@ -148,10 +148,16 @@
1060 +               printf("Making connection with mySQL-server\n");
1061 +       }
1062
1063 +-    if (!(SQLsock = mysql_connect(&mysql,host,user,pass))) {
1064 ++    if (!(SQLsock = mysql_init(NULL))) {
1065 ++      fprintf(stderr, "Couldn't initialize MySQL handle.\n");
1066 ++        close(dbh->db_fd);
1067 ++        free(dbh);
1068 ++        exit(1);
1069 ++    }
1070 ++    if (!mysql_real_connect(SQLsock,host,user,pass,NULL,0,NULL,0)) {
1071 +         fprintf(stderr, "Couldn't get a connection with the ");
1072 +         fprintf(stderr, "designated host!\n");
1073 +-        fprintf(stderr, "Detailed report: %s\n", mysql_error(&mysql));
1074 ++        fprintf(stderr, "Detailed report: %s\n", mysql_error(SQLsock));
1075 +         close(dbh->db_fd);
1076 +         free(dbh);
1077 +         exit(1);
1078 --- dbf2mysql-1.14a.orig/debian/u_char.diff
1079 +++ dbf2mysql-1.14a/debian/u_char.diff
1080 @@ -0,0 +1,29 @@
1081 +--- dbf.c~     Sat Jul  8 02:19:51 2000
1082 ++++ dbf.c      Thu Sep 19 12:41:49 2002
1083 +@@ -513,7 +513,7 @@
1084 + {
1085 +     int       t, i;
1086 +     u_char    *dbffield;
1087 +-    char      *end, *sp;
1088 ++    u_char    *end, *sp;
1089 +     double    dblval;
1090 +     long long int8val;
1091 +     long      int4val;
1092 +@@ -549,7 +549,7 @@
1093 +     {
1094 +       switch(fields[t].db_type) {
1095 +         case 'C':             /* Character data */
1096 +-          end = (char *)&dbffield[fields[t].db_flen - 1];
1097 ++          end = &dbffield[fields[t].db_flen - 1];
1098 +           i = fields[t].db_flen;
1099 +           while (( i > 0) && ((*end < 0x21)/* || (*end > 0x7E)*/)) {
1100 +               end--;
1101 +@@ -659,7 +670,7 @@
1102 +           break;
1103
1104 +         default:
1105 +-          end = (char *)dbffield;
1106 ++          end = dbffield;
1107 +           i = fields[t].db_flen;
1108 +           while (( i > 0) && ((*end < 0x21)/* || (*end > 0x7E)*/)) {
1109 +               end++;
This page took 0.145242 seconds and 3 git commands to generate.