[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force XSF toolbox SVN commit: r9 - trunk/bin



Author: branden
Date: 2005-05-19 11:50:14 -0500 (Thu, 19 May 2005)
New Revision: 9

Added:
   trunk/bin/test-x11-packages
Log:
Add script to test package installs, purges, upgrades, and downgrades.


Added: trunk/bin/test-x11-packages
===================================================================
--- trunk/bin/test-x11-packages	2004-12-25 05:24:02 UTC (rev 8)
+++ trunk/bin/test-x11-packages	2005-05-19 16:50:14 UTC (rev 9)
@@ -0,0 +1,148 @@
+#!/bin/sh
+
+# $Id$
+
+# Copyright 2005 Branden Robinson <branden@debian.org>.
+#
+# This is free software; you may redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2,
+# or (at your option) any later version.
+#
+# This 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.
+#
+# You should have received a copy of the GNU General Public License with
+# the Debian operating system, in /usr/share/common-licenses/GPL;  if
+# not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
+set -e
+
+PROGNAME=${0##*/}
+EX_SUCCESS=0
+EX_FAIL=1
+EX_USAGE=2
+
+die () {
+    echo "$PROGNAME: fatal error: $*" >&2
+    exit $EX_FAIL
+}
+
+trace () {
+    echo "$PROGNAME: $*" >&2
+}
+
+usage () {
+    if [ -n "$*" ]; then
+        echo "$PROGNAME: usage error: $*"
+    fi
+    cat <<EOF
+Usage: $PROGNAME { ip | ud }
+Test xfree86 packages in the current working directory.
+
+Operands:
+    ip      test installation and purge
+    ud      test upgrades and downgrades
+EOF
+}
+
+check_system () {
+    if ! dpkg --audit; then
+        die "system not in clean state; dpkg --audit failed"
+    fi
+}
+
+report_system_state () {
+    COLUMNS=200 dpkg -l | tail -n +6 | awk '{print $2,$3,$1}' | column -t
+}
+
+if [ $# -ne 1 ]; then
+    usage "operand required" >&2
+    exit $EX_USAGE
+fi
+
+DEBIAN_PRIORITY=high
+DEBIAN_FRONTEND=noninteractive
+export DEBIAN_PRIORITY DEBIAN_FRONTEND
+dselect update
+
+LIBXAW6_DEV_DEB=libxaw6-dev_*.deb
+ALL_OTHER_DEBS=$(echo $(ls -1 *.deb | grep -v libxaw6-dev) )
+ALL_OTHER_NAMES=$(echo $(ls -1 *.deb | grep -v libxaw6-dev | cut -d_ -f1) )
+
+if [ -f x-window-system-dev_*.deb ]; then
+    XAWDEV_RDEPS_DEB=x-window-system-dev_*.deb
+    XAWDEV_RDEPS_NAME=x-window-system-dev
+elif [ -f xlib6g-dev_*.deb ]; then
+    XAWDEV_RDEPS_DEB=xlib6g-dev_*.deb
+    XAWDEV_RDEPS_NAME=xlib6g-dev
+else
+    XAWDEV_RDEPS_DEB=
+    XAWDEV_RDEPS_NAME=
+fi
+
+case "$1" in
+    ip)
+        report_system_state
+        check_system
+        trace "unpacking xfree86 packages (except for libxaw6-dev)"
+        dpkg --unpack $ALL_OTHER_DEBS
+        trace "installing unpacked and depended-upon packages"
+        apt-get -fuy install
+        trace "purging libxaw7-dev${XAWDEV_RDEPS_NAME:+ and $XAWDEV_RDEPS_NAME}"
+        dpkg --purge libxaw7-dev $XAWDEV_RDEPS_NAME
+        trace "installing libxaw6-dev"
+        dpkg --install $LIBXAW6_DEV_DEB
+        trace "purging libxaw6-dev"
+        dpkg --purge libxaw6-dev
+        trace "purging remaining xfree86 packages"
+        apt-get -uy --purge remove $ALL_OTHER_NAMES
+        trace "******************** install/purge test PASSED"
+        check_system
+        report_system_state
+        ;;
+    ud)
+        report_system_state
+        # Upgrade and downgrade all packages except libxaw6-dev first.
+        check_system
+        trace "installing available versions of xfree86 packages (except for" \
+              "libxaw6-dev)"
+        apt-get -uy install $ALL_OTHER_NAMES
+        AVAILABLE_VERSION=$(dpkg -s x-window-system | grep '^Version: ' \
+                            | awk '{print $2}')
+        trace "unpacking upgraded xfree86 packages (except for libxaw6-dev)"
+        dpkg --unpack $ALL_OTHER_DEBS
+        trace "installing upgraded unpacked and depended-upon packages"
+        apt-get -fuy install
+        trace "downgrading xfree86 packages to available versions"
+        apt-get -uy --force-yes install $(echo $(ls -1 *.deb \
+            | grep -v libxaw6-dev | cut -d_ -f1 \
+            | sed "s/\$/=$AVAILABLE_VERSION/") )
+        # Upgrade and downgrade libxaw6-dev.
+        trace "purging libxaw7-dev${XAWDEV_RDEPS_NAME:+ and $XAWDEV_RDEPS_NAME}"
+        dpkg --purge libxaw7-dev $XAWDEV_RDEPS_NAME
+        trace "installing available version of libxaw6-dev"
+        apt-get -uy --force-yes install libxaw6-dev=$AVAILABLE_VERSION
+        trace "upgrading libxaw6 and libxaw6-dev"
+        dpkg --install libxaw6_*.deb $LIBXAW6_DEV_DEB
+        trace "downgrading libxaw6 and libxaw6-dev to available versions"
+        apt-get -uy --force-yes install libxaw6=$AVAILABLE_VERSION \
+                                        libxaw6-dev=$AVAILABLE_VERSION
+        # Reinstall libxaw7-dev and x-window-system-dev (if it exists).
+        apt-get -uy install libxaw7-dev $XAWDEV_RDEPS_NAME
+        trace "******************** upgrade/downgrade test PASSED"
+        check_system
+        report_system_state
+        ;;
+    *)
+        usage "operand \"$1\" not recognized" >&2
+        exit $EX_USAGE
+        ;;
+esac
+
+exit $EX_SUCCESS
+
+# vim:set ai et sts=4 sw=4 tw=80:


Property changes on: trunk/bin/test-x11-packages
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id



Reply to: