changeset 1082:255488af0bbb

Convert unstable() to is_in_list() taking the list to check as the second argument.
author Rob Landley <rob@landley.net>
date Sat, 15 May 2010 12:41:14 -0500
parents e992bc65b048
children cb4dbdb7f2cd
files sources/functions.sh sources/sections/uClibc.build sources/utility_functions.sh
diffstat 3 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/sources/functions.sh	Sat May 15 12:12:39 2010 -0500
+++ b/sources/functions.sh	Sat May 15 12:41:14 2010 -0500
@@ -96,18 +96,11 @@
   fi
 }
 
-# Figure out if we're using the stable or unstable versions of a package.
-
-unstable()
-{
-  [ ! -z "$(echo ,"$USE_UNSTABLE", | grep ,"$1",)" ]
-}
-
 # Find appropriate miniconfig file
 
 getconfig()
 {
-  for i in $(unstable $1 && echo {$ARCH_NAME,$ARCH}/miniconfig-alt-$1) \
+  for i in $(is_in_list $1 $USE_UNSTABLE && echo {$ARCH_NAME,$ARCH}/miniconfig-alt-$1) \
     {$ARCH_NAME,$ARCH}/miniconfig-$1
   do
     if [ -f "$CONFIG_DIR/$i" ]
@@ -353,7 +346,7 @@
   # If unstable version selected, try from listed location, and fall back
   # to PREFERRED_MIRROR.  Do not try normal mirror locations for unstable.
 
-  if unstable "$(basename "$FILENAME")"
+  if is_in_list "$(basename "$FILENAME")" $USE_UNSTABLE
   then
     FILENAME="$ALTFILENAME"
     SHA1=
@@ -413,7 +406,7 @@
   # Figure out whether we're using an unstable package.
 
   PACKAGE="$1"
-  unstable "$PACKAGE" && PACKAGE=alt-"$PACKAGE"
+  is_in_list "$PACKAGE" $USE_UNSTABLE && PACKAGE=alt-"$PACKAGE"
 
   echo "=== Building $PACKAGE ($ARCH_NAME $STAGE_NAME)"
   set_titlebar "$ARCH_NAME $STAGE_NAME $PACKAGE Building"
@@ -430,7 +423,7 @@
   if [ ! -z "$3" ]
   then
     CURSRC="$3"
-    unstable "$CURSRC" && CURSRC=alt-"$CURSRC"
+    is_in_list "$CURSRC" $USE_UNSTABLE && CURSRC=alt-"$CURSRC"
   fi
   export CURSRC="${WORK}/${CURSRC}"
 
@@ -484,7 +477,7 @@
 
 identify_release()
 {
-  if unstable "$1"
+  if is_in_list "$1" $USE_UNSTABLE
   then
     for i in "b" ""
     do
--- a/sources/sections/uClibc.build	Sat May 15 12:12:39 2010 -0500
+++ b/sources/sections/uClibc.build	Sat May 15 12:41:14 2010 -0500
@@ -9,7 +9,8 @@
 
 # Configure
 
-if unstable uClibc && [ -e "$CONFIG_DIR/$ARCH/miniconfig-alt-uClibc" ]
+if is_in_list uClibc $USE_UNSTABLE &&
+   [ -e "$CONFIG_DIR/$ARCH/miniconfig-alt-uClibc" ]
 then
   cp "$CONFIG_DIR/$ARCH/miniconfig-alt-uClibc" "$WORK/mini.conf" || dienow
   echo using miniconfig-alt-uClibc
--- a/sources/utility_functions.sh	Sat May 15 12:12:39 2010 -0500
+++ b/sources/utility_functions.sh	Sat May 15 12:41:14 2010 -0500
@@ -172,3 +172,10 @@
     fi
   done
 }
+
+# Check if $1 is in the comma separated list $2
+
+is_in_list()
+{
+  [ ! -z "$(echo ,"$2", | grep ,"$1",)" ]
+}