[Lsb-messages] /var/www/bzr/lsb/devel/libtodb2 r37: add a 'replace' option to add_symbol_versions.sh
Mats Wichmann
mats at linuxfoundation.org
Fri Mar 1 15:10:38 UTC 2013
------------------------------------------------------------
revno: 37
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: libtodb2
timestamp: Fri 2013-03-01 08:10:38 -0700
message:
add a 'replace' option to add_symbol_versions.sh
modified:
add_symbol_versions.sh
-------------- next part --------------
=== modified file 'add_symbol_versions.sh'
--- a/add_symbol_versions.sh 2012-09-19 06:26:54 +0000
+++ b/add_symbol_versions.sh 2013-03-01 15:10:38 +0000
@@ -1,12 +1,72 @@
#!/bin/sh
+#
+# This script generates sql instructions to add symbol versioning to a library.
+# This step is not part of the full import procedures, as only some
+# libraries have symbol versioning information in the first place.
+#
+# Each input file should be a list of "symbol;version" lines.
+# Such a list may be generated by dump_interfaces.pl
+# but note that the list should be pruned to only "exported" symbols,
+# and more precisely, to symbols accepted into LSB (in the case of
+# some libraries, such a libc, there may be a difference between the two).
+# dump_interfaces.pl does not attempt such pruning.
+#
+# There are really two use cases:
+# 1. a symbol-versioned library was added, and we need to add varsions
+# for it. In this case, we merely need to update the ArchInt entries.
+# 2. A library that has not been symbol-versioned now has symbol versions
+# upstream, and we want to pick up those versions. In this case,
+# we must replace existing ArchInt entries with new ones - because
+# the old un-versioned entries are still the right ones for older
+# LSB versions. To run this way, add the "-r" argument (for replace).
+#
+# There are some quirks - libpng12 was added in LSB 3.1, then symbol
+# versions in 4.1. libpng15 was added for 5.0, the initial import
+# being unversioned (since that's what the tools support). Using
+# this script causes the unversioned libpng12 ArchInt entries - interfaces
+# of the same name as the libpgn15 ones - to also be modified, which
+# is not correct. Here interface selection should include
+# AND Ilibrary='libpng15', but there's a law of diminishign returns
+# to further hacking this script.
+#
+# Also to simplfy, just assume for case 2, LSB version will be 5.0.
+# Update this as LSB evolves.
+
+if [ $# -lt 1 ]; then
+ echo "Usage: $0 [-r] files..."
+ exit 1
+fi
+
+style="new"
+
+if [ "$1" = "-r" ]; then
+ style="replace"
+ shift
+fi
for f in $@
do
cat "$f" | grep -v ';$' | sed 's/;/ /' | while read name vers
do
- echo "INSERT IGNORE INTO Version (Vid,Vname) VALUES(0,'$vers');"
- echo "SET @Vid=(SELECT Vid FROM Version WHERE Vname='$vers');"
- echo "UPDATE Interface JOIN ArchInt ON AIInt=Iid SET AIversion=@Vid WHERE Iname='$name' AND AIversion=0;"
+ case $style in
+ "new")
+ cat <<-END-OF-SQL
+INSERT IGNORE INTO Version (Vid,Vname) VALUES(0,'$vers');
+SET @Vid=(SELECT Vid FROM Version WHERE Vname='$vers');
+UPDATE Interface JOIN ArchInt ON AIInt=Iid SET AIversion=@Vid WHERE Iname='$name' AND AIversion=0;
+END-OF-SQL
+ ;;
+ "replace")
+ cat <<-END-OF-SQL
+INSERT IGNORE INTO Version (Vid,Vname) VALUES(0,'$vers');
+SET @Vid=(SELECT Vid FROM Version WHERE Vname='$vers');
+SELECT Iid,AIarch,AIreturn FROM Interface JOIN ArchInt on Iid=AIint WHERE Iname='$name' AND AIversion=0 INTO @Iid, at Aid, at Rid;
+UPDATE ArchInt SET AIwithdrawnin='5.0' WHERE AIint=@Iid AND AIversion=0;
+INSERT INTO ArchInt (AIarch,AIint,AIversion,AIappearedin,AIreturn) VALUES(@Aid, at Iid, at Vid,'5.0', at Rid);
+
+END-OF-SQL
+ ;;
+ esac
done
done
More information about the lsb-messages
mailing list