[Pkg-kde-commits] rev 1153 - scripts

Pierre Habouzit madcoder-guest@costa.debian.org
Mon, 30 May 2005 07:39:14 +0000


Author: madcoder-guest
Date: 2005-05-30 07:39:13 +0000 (Mon, 30 May 2005)
New Revision: 1153

Added:
   scripts/check-shlibs2
Log:
another proposal to track down shlibs changes

Added: scripts/check-shlibs2
===================================================================
--- scripts/check-shlibs2	2005-05-30 02:56:53 UTC (rev 1152)
+++ scripts/check-shlibs2	2005-05-30 07:39:13 UTC (rev 1153)
@@ -0,0 +1,112 @@
+#! /bin/sh
+# $Id: create-icons 833 2005-03-18 14:54:46Z dato-guest $
+# (C) 2005, Pierre Habouzit <madcoder@debian.org>
+# GPL'ed code follows.
+
+#####################################################################
+#
+# TODO :
+#  That part may certainly be automatized instead of the user giving
+#  the version as an argument
+#
+[ -n "$1" ] || {
+    echo "usage: check-shlibs2 version"
+    echo
+    echo "  version   the version (with revision) that has been uploaded last"
+    echo "            this version is used to perform the symbols analysis"
+    exit 1
+}
+LAST_VERSION=$1
+#
+#####################################################################
+
+dh_testdir || exit 1
+eval `dpkg-architecture`
+
+NM='nm --dynamic --defined-only --no-sort'
+SOURCE=`awk '/^Source:/ {print $2}' debian/control`
+VERSION=`dpkg-parsechangelog | grep -E '^Version:' | cut -f 2 -d ' '`
+SHLIBS_SVN='svn://svn.debian.org/pkg-kde/branches/kde-3.4.0/shlibs'
+WHERE=debian/shlibs-check
+
+perror() {
+    echo >&2 "$1"
+}
+
+#####################################################################
+#
+# make_symbols_tree foo bar
+#
+#   make a symbol tree snapshot from the libs in dir $foo
+#   and put it in dir $bar
+#
+make_symbols_tree () {
+    SRC=$1
+    DST=$2
+
+    find "$SRC" -name '*.so.[0-9]' | while read lib; do
+        P=`dirname $lib`
+        L=$DST/${P##$SRC/}
+        test -d $L || mkdir -p $L 2>/dev/null
+
+        $NM $lib | awk '{print $3}' | env LC_COLLATE=C sort >$L/`basename $lib`
+    done
+}
+
+
+#####################################################################
+#
+# make_old_symbols pkg
+#
+#   try to get the package pkg_$version_$arch.deb , if it fails,
+#   then we assume it was an arch-indep package, else we extract it
+#   and (try to) build a symbol tree from it.  then we clean all up
+#
+make_old_symbols () {
+    BASE=$1
+   
+    LETTER=`echo $SOURCE | cut -b1`
+    PKG=${BASE}_${LAST_VERSION}_${DEB_BUILD_ARCH}.deb
+    URL=http://ftp.debian.org/debian/pool/main/$LETTER/$SOURCE/$PKG
+
+    TMP=debian/old/$BASE
+    
+    if wget -q $URL; then
+        test -d $TMP || mkdir -p $TMP 2>/dev/null
+        dpkg -x $PKG $TMP
+        make_symbols_tree $TMP $WHERE/$SOURCE.old/$BASE
+        rm -rf $PKG debian/old
+    else
+        perror "W: Couldn't get the package $PKG.  assuming it's an arch indep package..."
+    fi
+}
+
+
+#####################################################################
+#
+# check_symbols_equal pkg
+#
+#   test with diff if the symbols trees for the current build
+#   and the last uploaded package are the same
+#
+check_symbols_equal () {
+    test -d $WHERE/$SOURCE/$p || return
+
+    if diff -NrU0 $WHERE/$SOURCE.old/$p $WHERE/$SOURCE/$p; then
+        perror "-- $p has no differences"
+    else
+        perror "!! $p has differences"
+    fi
+}
+
+#####################################################################
+#####################################################################
+
+rm -rf $WHERE
+
+for p in `/usr/lib/cdbs/list-packages`; do
+    make_old_symbols $p
+    make_symbols_tree debian/$p $WHERE/$SOURCE/$p
+    check_symbols_equal $p
+done
+


Property changes on: scripts/check-shlibs2
___________________________________________________________________
Name: svn:executable
   + *