[patch] versioning & ABI

Nirgal <[email protected]> Sun, 7 Aug 2011 20:24:56 +0000
Newsgroups gmane.comp.db.mdb-tools.devel
Message-ID <[email protected]>
Hi everyone

I started checking how to release, and I have a 2 main questions:

1. The code is still using a few svn $Id $Revision $Date magic tags here and there.
Attached is a patch version.patch to remove them.
This patch boldly removes unused versioning vars in libraries such as:
include/mdbodbc.h : rcsid_sql_h = "$Id: mdbodbc.h,v 1.5 2005/01/15 05:02:13 calvinrsmith Exp $"
src/odbc/odbc.c: software_version = "$Id: odbc.c,v 1.31 2007/03/18 14:11:43 brianb Exp $"
src/odbc/unittest.c: software_version = "$Id: unittest.c,v 1.8 2005/04/29 03:08:22 whydoubt Exp $"
I could not see these symbols exported in the public API, so I guess this is ok.
What do you think?
We could also keep them, and use include/mdbver.h to generate these strings.

Weird version numbers are left in doc/install.sgml


2. Regarding ABI:
Version 0.6pre1 ships with these version of librairies:
 libmdbodbc.so.0.0.0
 libmdb.so.1.0.0
 libmdbsql.so.1.0.0
All libraries have lost symbols, so we'll have to use:
 libmdbodbc.so.1.0.0
 libmdb.so.2.0.0
 libmdbsql.so.2.0.0

Actually, we are still exporting some "internal" symbols, like:
 yy_create_buffer
 _mdb_put_int16
 MdbJet3Constants
 ...
I guess it would make sense to hide these internal references, so that we minimise future bumps in so names.
I started to write a map file. My first though is that we should export mdb_*
But there are a 5 additonal symbols used here and there:
    sanitize_name
    kkd_to_props
    _mdb_put_int16
    _mdb_put_int32
    buffer_dump
I suggest we rename this functions in mdb_something, or find a way to stop using them outside of libmdb.

Starting with sanitize_name, that is no longer needed IMHO, since all backends now quote properly the names. I would vote for droping its support. Code is complex in mdb-export and backend because of it: in backend.c this is almost like we have a special backend. But people might use it... (mdb-export, mdb-schema)
Alternative is to rename it into mdb_sanitize_name.
Your thoughts?


In libmdbsql, we have to export these symbols needed by gmdb2:
    mdb_sql_*
    g_input_ptr
    _mdb_sql
    yyparse
I guess everybody agrees this should be changed... Help welcomed.

Regarding libodbc, it is linked static with libmdb and libmdbsql ??
So the number of exported symbol was huge.
The map file I created only export SQL*
This has to be tested.
Is there a good reason to duplicate the code in that library?


Test version for debian here:
http://www.nirgal.com/mdbtools/debian.squeeze/

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1

_______________________________________________
mdbtools-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mdbtools-dev
versions.diff (text/x-patch, 2.2 KB)
Index: mdbtools-0.6pre1/include/mdbodbc.h
===================================================================
--- mdbtools-0.6pre1.orig/include/mdbodbc.h
+++ mdbtools-0.6pre1/include/mdbodbc.h
@@ -35,10 +35,6 @@
 extern "C" {
 #endif
 
-static char  rcsid_sql_h [ ] =
-         "$Id: mdbodbc.h,v 1.5 2005/01/15 05:02:13 calvinrsmith Exp $";
-static void *no_unused_sql_h_warn[]={rcsid_sql_h, no_unused_sql_h_warn};
-
 struct _henv {
 	MdbSQL *sql;	
 };
Index: mdbtools-0.6pre1/src/odbc/odbc.c
===================================================================
--- mdbtools-0.6pre1.orig/src/odbc/odbc.c
+++ mdbtools-0.6pre1/src/odbc/odbc.c
@@ -27,9 +27,6 @@
 
 #include "connectparams.h"
 
-static char  software_version[]   = "$Id: odbc.c,v 1.31 2007/03/18 14:11:43 brianb Exp $";
-static void *no_unused_var_warn[] = {software_version,
-                                     no_unused_var_warn};
 static iconv_t iconv_in,iconv_out;
 
 static SQLSMALLINT _odbc_get_client_type(int srv_type);
Index: mdbtools-0.6pre1/src/odbc/unittest.c
===================================================================
--- mdbtools-0.6pre1.orig/src/odbc/unittest.c
+++ mdbtools-0.6pre1/src/odbc/unittest.c
@@ -23,11 +23,6 @@
 
 #include <stdio.h>
 
-static char  software_version[]   = "$Id: unittest.c,v 1.8 2005/04/29 03:08:22 whydoubt Exp $";
-static void *no_unused_var_warn[] = {software_version,
-                                     no_unused_var_warn};
-
-
 
 #define SALES_PERSON_LEN 2
 #define STATUS_LEN 6
Index: mdbtools-0.6pre1/doc/Makefile.am
===================================================================
--- mdbtools-0.6pre1.orig/doc/Makefile.am
+++ mdbtools-0.6pre1/doc/Makefile.am
@@ -1,9 +1,7 @@
 # Converting DocBook to HTML (several small files)
 # http://www.freebsd.org/tutorials/docproj-primer/x3132.html#AEN3140
-# version: $Id: Makefile.am,v 1.5 2005/01/15 05:02:11 calvinrsmith Exp $
 SHELL = /bin/sh
 TXT2MAN = txt2man
-RELEASE = 0.6
 PRODUCT = MDBTools
 
 dist_man_MANS	= mdb-tables.1 mdb-ver.1 mdb-export.1 mdb-schema.1 mdb-sql.1 \
@@ -35,4 +33,4 @@
 man:	mdb-tables.1 mdb-ver.1 mdb-export.1 mdb-sql.1
 
 .txt.1:
-	- $(TXT2MAN) -P $(PRODUCT) -t $(PRODUCT) -r $(RELEASE) -s 1 $(srcdir)/$< > $@
+	- $(TXT2MAN) -P $(PRODUCT) -t $(PRODUCT) -r $(VERSION) -s 1 $(srcdir)/$< > $@
abi.diff (text/x-patch, 2.7 KB)
Index: mdbtools-0.6pre1/src/libmdb/Makefile.am
===================================================================
--- mdbtools-0.6pre1.orig/src/libmdb/Makefile.am
+++ mdbtools-0.6pre1/src/libmdb/Makefile.am
@@ -1,5 +1,5 @@
 lib_LTLIBRARIES	=	libmdb.la
 libmdb_la_SOURCES=	catalog.c mem.c file.c table.c data.c dump.c backend.c money.c sargs.c index.c like.c write.c stats.c map.c props.c worktable.c options.c iconv.c
-libmdb_la_LDFLAGS = -version-info  1:0:0
+libmdb_la_LDFLAGS = -version-info 1:0:0 -Wl,--version-script=$(srcdir)/libmdb.map
 AM_CPPFLAGS	=	-I$(top_srcdir)/include $(GLIB_CFLAGS)
 LIBS = $(GLIB_LIBS) @LIBS@
Index: mdbtools-0.6pre1/src/odbc/Makefile.am
===================================================================
--- mdbtools-0.6pre1.orig/src/odbc/Makefile.am
+++ mdbtools-0.6pre1/src/odbc/Makefile.am
@@ -16,6 +16,7 @@
 				$(patsubst %, $(MDBDIR)/%, \
 				$(patsubst %.c, %.lo, $(MDBSOURCES))) \
 				../libmdb/libmdb.la
+libmdbodbc_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libmdbodbc.map
 LIBS	=	@LEXLIB@ $(GLIB_LIBS) $(ODBC_LIBS)
 unittest_LDADD	=	libmdbodbc.la ../libmdb/libmdb.la ../sql/libmdbsql.la
 
Index: mdbtools-0.6pre1/src/libmdb/libmdb.map
===================================================================
--- /dev/null
+++ mdbtools-0.6pre1/src/libmdb/libmdb.map
@@ -0,0 +1,16 @@
+LIBMDB_1.0 {
+# global:
+# 	*;
+# }
+# LIBMDB_2.0 {
+global:
+	mdb_*;
+	sanitize_name;
+	kkd_to_props;
+	_mdb_put_int16;
+	_mdb_put_int32;
+	buffer_dump;
+
+local:
+	*;
+};
Index: mdbtools-0.6pre1/src/sql/Makefile.am
===================================================================
--- mdbtools-0.6pre1.orig/src/sql/Makefile.am
+++ mdbtools-0.6pre1/src/sql/Makefile.am
@@ -1,10 +1,10 @@
 lib_LTLIBRARIES	=	libmdbsql.la
 libmdbsql_la_SOURCES=	mdbsql.c parser.y lexer.l 
-libmdbsql_la_LDFLAGS = -version-info 1:0:0
+libmdbsql_la_LDFLAGS = -version-info 1:0:0 -Wl,--version-script=$(srcdir)/libmdbsql.map
 DISTCLEANFILES = parser.c parser.h lexer.c
 AM_CPPFLAGS	=	-I$(top_srcdir)/include $(GLIB_CFLAGS)
 LIBS	=	$(GLIB_LIBS)
-libmdbsql_la_LIBADD =	../libmdb/libmdb.la 
+libmdbsql_la_LIBADD =	../libmdb/libmdb.la
 YACC = @YACC@ -d
 
 dist-hook:
Index: mdbtools-0.6pre1/src/sql/libmdbsql.map
===================================================================
--- /dev/null
+++ mdbtools-0.6pre1/src/sql/libmdbsql.map
@@ -0,0 +1,14 @@
+LIBMDBSQL_1.0 {
+#global:
+#	*;
+#}
+#LIBMDBSQL_2.0 {
+global:
+	mdb_sql_*;
+	g_input_ptr;
+	_mdb_sql;
+	yyparse;
+
+local:
+	*;
+};
Index: mdbtools-0.6pre1/src/odbc/libmdbodbc.map
===================================================================
--- /dev/null
+++ mdbtools-0.6pre1/src/odbc/libmdbodbc.map
@@ -0,0 +1,11 @@
+LIBMDBODBC_0.0 {
+#global:
+#	*;
+#}
+#LIBMDBODBC_1.0 {
+global:
+	SQL*;
+
+local:
+	*;
+};