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

X Strike Force XFree86 SVN commit: rev 701 - trunk/debian



Author: branden
Date: 2003-10-22 23:44:36 -0500 (Wed, 22 Oct 2003)
New Revision: 701

Modified:
   trunk/debian/changelog
   trunk/debian/xserver-xfree86.config.in
Log:
Fix "priority ceiling" logic introduced in xserver-xfree86's config script
in 4.2.1-10.  We can't just use shell parameter expansion tricks to
accomplish this.  Implemented new function priority_ceil() which compares
its argument, a debconf priority string, to the shell variable
PRIORITY_CEILING, another debconf priority string, and returns the lesser
of the two.  Thanks to Goswin Brederlow for identifying the precise cause
of debconf question priority inflation of late.
(partially addresses #207537)

- debian/xserver-xfree86.config.in


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2003-10-23 04:04:38 UTC (rev 700)
+++ trunk/debian/changelog	2003-10-23 04:44:36 UTC (rev 701)
@@ -168,8 +168,18 @@
     - debian/xserver-common.preinst.in
     - debian/xserver-xfree86.preinst.in
 
- -- Branden Robinson <branden@debian.org>  Wed, 22 Oct 2003 22:55:43 -0500
+  * Fix "priority ceiling" logic introduced in xserver-xfree86's config script
+    in 4.2.1-10.  We can't just use shell parameter expansion tricks to
+    accomplish this.  Implemented new function priority_ceil() which compares
+    its argument, a debconf priority string, to the shell variable
+    PRIORITY_CEILING, another debconf priority string, and returns the lesser
+    of the two.  Thanks to Goswin Brederlow for identifying the precise cause
+    of debconf question priority inflation of late.
+    (partially addresses #207537)
+    - debian/xserver-xfree86.config.in
 
+ -- Branden Robinson <branden@debian.org>  Wed, 22 Oct 2003 23:39:27 -0500
+
 xfree86 (4.2.1-12.1) unstable; urgency=low
 
   * Fix typo in xlibs preinst.  Closes: #213774, #213776

Modified: trunk/debian/xserver-xfree86.config.in
===================================================================
--- trunk/debian/xserver-xfree86.config.in	2003-10-23 04:04:38 UTC (rev 700)
+++ trunk/debian/xserver-xfree86.config.in	2003-10-23 04:44:36 UTC (rev 701)
@@ -272,6 +272,75 @@
   debug_echo "auto_answer: $TEMPLATE is \"$RET\""
 }
 
+priority_ceil() {
+  # syntax: priority_ceil requested_priority
+  #
+  # Given a variable PRIORITY_CEILING and a "requested_priority" argument, echo
+  # a debconf priority string corresponding to the lesser of the two.
+
+  # Implementation note: a clever version of this could be done using "eval",
+  # or embedding a Perl script, but those would be more difficult to maintain.
+  # Better just to go the simple and stupid route.  Yes, I know this is not
+  # very efficient.
+
+  local requested_priority
+
+  # Validate arguments.
+  if [ $# -ne 1 ]; then
+    debug_echo "priority_ceil() called with empty or bogus arguments \"$*\";" \
+               "assuming argument of \"low\""
+    requested_priority=low
+  else
+    requested_priority="$1"
+  fi
+
+  # Ensure the value of PRIORITY_CEILING is reasonable.
+  if [ "$PRIORITY_CEILING" != "critical" \
+       -a "$PRIORITY_CEILING" != "high" \
+       -a "$PRIORITY_CEILING" != "medium" \
+       -a "$PRIORITY_CEILING" != "low" ]; then
+    debug_echo "priority_ceil() called with empty or bogus value of" \
+               "\$PRIORITY_CEILING \"$PRIORITY_CEILING\"; setting to \"low\""
+    PRIORITY_CEILING=low
+  fi
+
+  case "$requested_priority" in
+    critical)
+      # This is the highest priority, so there is nowhere to go but down.
+      echo "$PRIORITY_CEILING"
+      ;;
+    high)
+      case "$PRIORITY_CEILING" in
+        critical)
+          echo "$requested_priority"
+          ;;
+        high|medium|low)
+          echo "$PRIORITY_CEILING"
+          ;;
+      esac
+      ;;
+    medium)
+      case "$PRIORITY_CEILING" in
+        critical|high)
+          echo "$requested_priority"
+          ;;
+        medium|low)
+          echo "$PRIORITY_CEILING"
+          ;;
+      esac
+      ;;
+    low)
+      # This is the lowest priority, so we can't go any lower.
+      echo "$requested_priority"
+      ;;
+    *)
+      debug_echo "priority_ceil() called with bogus argument" \
+                 "\"$requested_priority\"; returning \"low\""
+      echo low
+      ;;
+  esac
+}
+
 # analyze arguments; used by auto_answer()
 if [ "$1" = "reconfigure" -o -n "$2" ]; then
   # if we are reconfiguring, or already have installed the package at least
@@ -376,14 +445,14 @@
 # if configuring for the first time, ask if user wants to autodetect
 if [ -z "$RECONFIGURE" ]; then
   if which discover > /dev/null 2>&1; then
-    auto_answer db_input "${PRIORITY_CEILING:-medium}" xserver-xfree86/autodetect_video_card "false"
+    auto_answer db_input "$(priority_ceil medium)" xserver-xfree86/autodetect_video_card "false"
     db_get xserver-xfree86/autodetect_video_card
     AUTODETECT_VIDEO_CARD="$RET"
     if [ "$AUTODETECT_VIDEO_CARD" = "true" ]; then
       if [ $NSERVERS -eq 0 ]; then
         debug_echo "could not autodetect X server: no video card detected," \
                    "or no server known for it"
-        db_input "${PRIORITY_CEILING:-high}" shared/no_known_x-server || debug_report_status "db_input ${PRIORITY_CEILING:-high} shared/no_known_x-server" "$?"
+        db_input "$(priority_ceil high)" shared/no_known_x-server || debug_report_status "db_input $(priority_ceil high) shared/no_known_x-server" "$?"
         db_go
       elif [ $NSERVERS -eq 1 ]; then
         debug_echo "autodetected X server: $SERVERS"
@@ -400,7 +469,7 @@
         # can't do this until there is a way to embed newlines into debconf command streams :(
         #db_subst shared/multiple_possible_x-servers detected_cards "$VIDEOCARD_SERVER_REPORT"
         debug_echo "$VIDEOCARD_SERVER_REPORT"
-        db_input "${PRIORITY_CEILING:-high}" shared/multiple_possible_x-servers || debug_report_status "db_input ${PRIORITY_CEILING:-high} shared/multiple_possible_x-servers" "$?"
+        db_input "$(priority_ceil high)" shared/multiple_possible_x-servers || debug_report_status "db_input $(priority_ceil high) shared/multiple_possible_x-servers" "$?"
         db_go
       fi
     else
@@ -461,7 +530,7 @@
       # can't do this until there is a way to embed newlines into debconf command streams :(
       #db_subst shared/multiple_possible_x-drivers detected_cards "$VIDEOCARD_DRIVER_REPORT"
       debug_echo "$VIDEOCARD_DRIVER_REPORT"
-      db_input "${PRIORITY_CEILING:-high}" xserver-xfree86/multiple_possible_x-drivers || debug_report_status "db_input ${PRIORITY_CEILING:-high} xserver-xfree86/multiple_possible_x-drivers" "$?"
+      db_input "$(priority_ceil high)" xserver-xfree86/multiple_possible_x-drivers || debug_report_status "db_input $(priority_ceil high) xserver-xfree86/multiple_possible_x-drivers" "$?"
       db_go
     fi
   else
@@ -540,7 +609,7 @@
   esac
 fi
 # this question requires input validation
-MAY_BE_NULL= auto_answer validate_string_db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/device/identifier "$DEFAULT"
+MAY_BE_NULL= auto_answer validate_string_db_input "$(priority_ceil low)" xserver-xfree86/config/device/identifier "$DEFAULT"
 
 # BusID
 PRIORITY=low
@@ -579,9 +648,9 @@
 fi
 # this question requires input validation
 if [ -n "$DEFAULT" ]; then
-  auto_answer validate_numeric_db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/device/video_ram "$DEFAULT"
+  auto_answer validate_numeric_db_input "$(priority_ceil low)" xserver-xfree86/config/device/video_ram "$DEFAULT"
 else
-  validate_numeric_db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/device/video_ram || debug_report_status "validate_numeric_db_input ${PRIORITY_CEILING:-low} xserver-xfree86/config/device/video_ram" "$?"
+  validate_numeric_db_input "$(priority_ceil low)" xserver-xfree86/config/device/video_ram || debug_report_status "validate_numeric_db_input $(priority_ceil low) xserver-xfree86/config/device/video_ram" "$?"
 fi
 
 # use fbcon kernel functions?
@@ -603,7 +672,7 @@
 fi
 
 if [ -n "$USE_FBDEV" ]; then
-    auto_answer db_input "${PRIORITY_CEILING:-high}" xserver-xfree86/config/device/use_fbdev "true"
+    auto_answer db_input "$(priority_ceil high)" xserver-xfree86/config/device/use_fbdev "true"
 else
   db_get xserver-xfree86/config/device/use_fbdev || debug_report_status "db_get xserver-xfree86/config/device/use_fbdev" "$?"
   if [ "$RET" = "true" ]; then
@@ -759,8 +828,8 @@
   auto_answer db_input "${PRIORITY_CEILING:-$PRIORITY}" xserver-xfree86/config/inputdevice/mouse/protocol "${AUTODETECTED_PROTOCOL:-$DEFAULT_PROTOCOL}"
 fi
 
-db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/inputdevice/mouse/emulate3buttons || debug_report_status "db_input ${PRIORITY_CEILING:-low} xserver-xfree86/config/inputdevice/mouse/emulate3buttons" "$?"
-db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/inputdevice/mouse/zaxismapping || debug_report_status "db_input ${PRIORITY_CEILING:-low} xserver-xfree86/config/inputdevice/mouse/zaxismapping" "$?"
+db_input "$(priority_ceil low)" xserver-xfree86/config/inputdevice/mouse/emulate3buttons || debug_report_status "db_input $(priority_ceil low) xserver-xfree86/config/inputdevice/mouse/emulate3buttons" "$?"
+db_input "$(priority_ceil low)" xserver-xfree86/config/inputdevice/mouse/zaxismapping || debug_report_status "db_input $(priority_ceil low) xserver-xfree86/config/inputdevice/mouse/zaxismapping" "$?"
 db_go
 
 # monitor setup
@@ -1024,10 +1093,10 @@
 esac
 
 # list of desired display modes
-auto_answer db_input "${PRIORITY_CEILING:-medium}" xserver-xfree86/config/display/modes "$DEFAULT_MODES"
+auto_answer db_input "$(priority_ceil medium)" xserver-xfree86/config/display/modes "$DEFAULT_MODES"
 
 # default display depth
-auto_answer db_input "${PRIORITY_CEILING:-medium}" xserver-xfree86/config/display/default_depth "$DEFAULT_DEPTH"
+auto_answer db_input "$(priority_ceil medium)" xserver-xfree86/config/display/default_depth "$DEFAULT_DEPTH"
 
 # server modules to load
 # XXX: damnit, explicitly loading the dri module is broken for sunffb users :-P
@@ -1037,14 +1106,14 @@
 else
   MODULE_LIST="GLcore, bitmap, dbe, ddc, dri, extmod, freetype, glx, int10, record, speedo, type1, vbe"
 fi
-auto_answer db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/modules "$MODULE_LIST"
+auto_answer db_input "$(priority_ceil low)" xserver-xfree86/config/modules "$MODULE_LIST"
 db_go
 
 # files and dri sections
-db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/write_files_section || debug_report_status "db_input ${PRIORITY_CEILING:-low} xserver-xfree86/config/write_files_section" "$?"
-db_input "${PRIORITY_CEILING:-low}" xserver-xfree86/config/write_dri_section || debug_report_status "db_input ${PRIORITY_CEILING:-low} xserver-xfree86/config/write_dri_section" "$?"
+db_input "$(priority_ceil low)" xserver-xfree86/config/write_files_section || debug_report_status "db_input $(priority_ceil low) xserver-xfree86/config/write_files_section" "$?"
+db_input "$(priority_ceil low)" xserver-xfree86/config/write_dri_section || debug_report_status "db_input $(priority_ceil low) xserver-xfree86/config/write_dri_section" "$?"
 db_go
 
 exit 0
 
-# vim:set ai et sts=2 sw=2 tw=0:
+# vim:set ai et sts=2 sw=2 tw=80:



Reply to: