From owner-freebsd-ports@FreeBSD.ORG Sun Nov 28 23:14:24 2010 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 131FC106566C for ; Sun, 28 Nov 2010 23:14:24 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) by mx1.freebsd.org (Postfix) with ESMTP id 917938FC0C for ; Sun, 28 Nov 2010 23:14:23 +0000 (UTC) Received: from elsa.codelab.cz (localhost.codelab.cz [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id ECC5C19E02F; Mon, 29 Nov 2010 00:14:21 +0100 (CET) Received: from [192.168.1.2] (ip-86-49-61-235.net.upcbroadband.cz [86.49.61.235]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 3AE3419E031; Mon, 29 Nov 2010 00:14:19 +0100 (CET) Message-ID: <4CF2E24B.7030903@quip.cz> Date: Mon, 29 Nov 2010 00:14:19 +0100 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1.15) Gecko/20101027 SeaMonkey/2.0.10 MIME-Version: 1.0 To: Matthew Seaman References: <4CF2A724.9050406@quip.cz> <4CF2B696.3010408@infracaninophile.co.uk> In-Reply-To: <4CF2B696.3010408@infracaninophile.co.uk> Content-Type: multipart/mixed; boundary="------------040005090600090805060707" Cc: freebsd-ports@freebsd.org Subject: Re: dbf2mysql and hardcoded mysql-client version dependency X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Nov 2010 23:14:24 -0000 This is a multi-part message in MIME format. --------------040005090600090805060707 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Matthew Seaman wrote: > On 28/11/2010 19:01, Miroslav Lachman wrote: >> Can somebody explain me, why databases/dbf2mysql has hardcoded >> dependency to mysql323-client? >> >> The Makefile contains: >> >> LIB_DEPENDS= mysqlclient.10:${PORTSDIR}/databases/mysql323-client >> >> But it is unbuildable > > The sources to dbf2mysql were last modified around 2000, when mysql-3.2x > was current. Since then, it seems to have been pretty much abandoned. > > A good candidate for deletion from the ports on grounds of obsolescence. I attached two patches. Makefile.patch is for port's Makefile and patch-mysql2dbf should be placed into files port directory. Then it works with MySQL 5.0.x (tested with mysql-client-5.0.90) I tested just a dbf2mysql command, patch for mysql2dbf is needed to compile, but I did not tested it as I do not have any apps to test produced dbf file. Should I send a PR for this fix? Miroslav Lachman --------------040005090600090805060707 Content-Type: text/plain; name="Makefile.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Makefile.patch" --- Makefile.orig 2010-11-28 18:34:26.000000000 +0100 +++ Makefile 2010-11-28 19:11:05.000000000 +0100 @@ -18,7 +18,7 @@ MAINTAINER= ports@FreeBSD.org COMMENT= Programs to convert .dbf files to MySQL tables and vice versa -LIB_DEPENDS= mysqlclient.10:${PORTSDIR}/databases/mysql323-client +USE_MYSQL= yes PORTDOCS= README --------------040005090600090805060707 Content-Type: text/plain; name="patch-mysql2dbf.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-mysql2dbf.patch" --- mysql2dbf.c.orig 2010-11-28 19:46:34.000000000 +0100 +++ mysql2dbf.c 2010-11-28 21:23:22.000000000 +0100 @@ -1,6 +1,11 @@ /* utility to read out an mySQL-table, and store it into a DBF-file M. Boekhold (boekhold@cindy.et.tudelft.nl) April 1996 + + M. Lachman Nov 2010 + Replaced mysql_connect with mysql_real_connect, SQLsock isn't used anymore + Can be compiled with MySQL client 5.0.x + */ #include @@ -47,7 +52,7 @@ int main(int argc, char **argv) { int i; - MYSQL *SQLsock,mysql; + MYSQL mysql; extern int optind; extern char *optarg; char *query = NULL; @@ -148,7 +153,9 @@ printf("Making connection with mySQL-server\n"); } - if (!(SQLsock = mysql_connect(&mysql,host,user,pass))) { + mysql_init(&mysql); + + if (!mysql_real_connect(&mysql,host,user,pass, dbase, 0, NULL,0)) { fprintf(stderr, "Couldn't get a connection with the "); fprintf(stderr, "designated host!\n"); fprintf(stderr, "Detailed report: %s\n", mysql_error(&mysql)); @@ -157,37 +164,24 @@ exit(1); } - if (verbose > 1) { - printf("Selecting database\n"); - } - - if ((mysql_select_db(SQLsock, dbase)) == -1) { - fprintf(stderr, "Couldn't select database %s.\n", dbase); - fprintf(stderr, "Detailed report: %s\n", mysql_error(SQLsock)); - close(dbh->db_fd); - free(dbh); - mysql_close(SQLsock); - exit(1); - } - if (verbose > 1) { printf("Sending query\n"); } - if (mysql_query(SQLsock, query) == -1) { + if (mysql_query(&mysql, query) == -1) { fprintf(stderr, "Error sending query.\nDetailed report: %s\n", - mysql_error(SQLsock)); + mysql_error(&mysql)); if (verbose > 1) { fprintf(stderr, "%s\n", query); } - mysql_close(SQLsock); + mysql_close(&mysql); close(dbh->db_fd); free(dbh); exit(1); } - qres = mysql_store_result(SQLsock); + qres = mysql_store_result(&mysql); numfields = mysql_num_fields(qres); numrows = mysql_num_rows(qres); @@ -303,7 +297,7 @@ } mysql_free_result(qres); - mysql_close(SQLsock); + mysql_close(&mysql); close(dbh->db_fd); free(dbh); exit(0); --------------040005090600090805060707--