commit cbe00c57b31bb7b387762bdc228940d61e8e1beb
Author: Frédéric Péters <fpeters@0d.be>
Date:   Sun Jul 11 20:40:23 2010 +0200

    [build] Use dpkg-checkbuilddeps to check for installed packages
    
    https://bugzilla.gnome.org/show_bug.cgi?id=624009

diff --git a/tools/build/gnome-shell-build-setup.sh b/tools/build/gnome-shell-build-setup.sh
index afd01a4..006754e 100755
--- a/tools/build/gnome-shell-build-setup.sh
+++ b/tools/build/gnome-shell-build-setup.sh
@@ -59,22 +59,13 @@ fi
 #
 # (*) only needed for --xephyr
 
-# Can this be simplified? Obvious ways don't handle handle packages
-# that have been installed then removed. ('purged' status, e.g.)
-dpkg_is_installed() {
-    status=`dpkg-query --show --showformat='${Status}' $1 2>/dev/null`
-    if [ $? = 0 ] ; then
-	set $status
-        if [ "$3" = installed ] ; then
-             return 0
-        fi
-    fi
-
-    return 1
-}
-
 if test x$system = xUbuntu -o x$system = xDebian -o x$system = xLinuxMint ; then
   reqd=""
+  if [ ! -x /usr/bin/dpkg-checkbuilddeps ]; then
+    echo "Please run 'sudo apt-get install dpkg-dev' and try again."
+    echo
+    exit 1
+  fi
   for pkg in \
     build-essential curl \
     automake bison flex git-core gnome-common gtk-doc-tools gvfs gvfs-backends \
@@ -84,7 +75,7 @@ if test x$system = xUbuntu -o x$system = xDebian -o x$system = xLinuxMint ; then
     python-dev python-gconf python-gobject xulrunner-dev xserver-xephyr gnome-terminal \
     libcroco3-dev libgstreamer0.10-dev gstreamer0.10-plugins-base gstreamer0.10-plugins-good \
     ; do
-      if ! dpkg_is_installed $pkg; then
+      if ! dpkg-checkbuilddeps -d $pkg /dev/null 2> /dev/null; then
         reqd="$pkg $reqd"
       fi
   done
