mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 15:41:09 +00:00
94 lines
2.5 KiB
Bash
Executable File
94 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (C) 2006-2007 Daniel Holbach <daniel.holbach@ubuntu.com>
|
|
# Modified by Siegfried-A. Gevatter <rainct@ubuntu.com>
|
|
#
|
|
# ##################################################################
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; version 2.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# See file /usr/share/common-licenses/GPL-2 for more details.
|
|
#
|
|
# ##################################################################
|
|
#
|
|
# This script is used to get a diff of the exported symbols of all .so files in
|
|
# every binary package of package $1.
|
|
|
|
DISTRO=$(lsb_release -c -s)
|
|
VERSION=$(apt-cache madison "$1" | grep -- "$DISTRO"'/.*Sources$' | awk '{print $3}')
|
|
PACKAGES=$(apt-cache showsrc "$1" | grep-dctrl -s Binary -F Version "$VERSION" | sed 's/Binary\:\ //g;s/\,//g' | sort -u)
|
|
DEBLINE=""
|
|
DEBUG=False
|
|
|
|
if [[ -z $1 ]]; then
|
|
echo "Missing argument: source package name."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z $2 ]]; then
|
|
DEBDIR="/var/cache/pbuilder/result"
|
|
else
|
|
DEBDIR="$2"
|
|
fi
|
|
|
|
if [ `id -u` != "0" ]
|
|
then
|
|
echo
|
|
echo -n "You might now be asked for your password, as this script requires"
|
|
echo " sudo privilegies in order to install the packages you want to check."
|
|
echo
|
|
fi
|
|
|
|
sudo apt-get install $PACKAGES
|
|
echo
|
|
|
|
for pack in $PACKAGES;
|
|
do
|
|
for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`
|
|
do
|
|
LIBNAME=$(basename $lib)
|
|
nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.old
|
|
done;
|
|
DEBLINE="$DEBLINE $DEBDIR/$pack*.deb "
|
|
done
|
|
|
|
if [[ -z $DEBLINE ]]; then
|
|
echo "Package doesn't exist: $1."
|
|
exit 1
|
|
fi
|
|
|
|
NOFILE=True
|
|
for filename in $DEBLINE; do
|
|
if [[ ${filename: -5} != "*.deb" ]]; then
|
|
NOFILE=False
|
|
[[ $DEBUG != True ]] || echo "Found binary file: $filename"
|
|
fi
|
|
done
|
|
|
|
if [[ $NOFILE == True ]]; then
|
|
echo "No matching binary files found in «$DEBDIR»."
|
|
exit 1
|
|
fi
|
|
|
|
sudo dpkg -i $DEBLINE;
|
|
echo
|
|
|
|
for pack in $PACKAGES;
|
|
do
|
|
for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`
|
|
do
|
|
LIBNAME=$(basename $lib)
|
|
nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.new
|
|
echo "Checking: $lib"
|
|
diff -u /tmp/$LIBNAME.{old,new}
|
|
rm /tmp/$LIBNAME.{old,new}
|
|
done;
|
|
done
|