[SCM] debian-live/live-helper branch, master, updated. 1.0_a44-1-16-gef8df9b
Chris Lamb
chris at chris-lamb.co.uk
Sat Apr 19 15:35:57 UTC 2008
The following commit has been merged in the master branch:
commit d49857d8ff9da9cdc26dd680da219d647497a6fb
Author: Chris Lamb <chris at chris-lamb.co.uk>
Date: Thu Apr 17 21:08:58 2008 +0100
Rewrite Expand_packagelist to not be recursive
Signed-off-by: Chris Lamb <chris at chris-lamb.co.uk>
diff --git a/functions/packageslists.sh b/functions/packageslists.sh
index f29f134..443caad 100755
--- a/functions/packageslists.sh
+++ b/functions/packageslists.sh
@@ -11,32 +11,41 @@ set -e
Expand_packagelist ()
{
- # ${1} List name
- # ${2} Default path to search
- # ${3} Fallback path to search (optional)
-
- # Does list exist in default path?
- if [ -e "${2}/${1}" ];
- then
- Expand_packagelist_file "${2}/${1}" "${@}"
- else
- # If list exists in fallback, include it.
- if [ -n "${3}" ] && [ -e "${3}/${1}" ]
- then
- Expand_packagelist_file "${3}/${1}" "${@}"
- fi
- fi
-}
+ _LH_EXPAND_QUEUE="$(basename "${1}")"
-Expand_packagelist_file ()
-{
- local FILE="${1}"
- shift
shift
- for INCLUDE in $(sed -ne 's|^#<include> \(.*\)|\1|gp' -e 's|^#include <\(.*\)>|\1|gp' "${FILE}")
+ while [ -n "${_LH_EXPAND_QUEUE}" ]
do
- Expand_packagelist "${INCLUDE}" "${@}"
+ _LH_LIST_NAME="$(echo ${_LH_EXPAND_QUEUE} | cut -d" " -f1)"
+ _LH_EXPAND_QUEUE="$(echo ${_LH_EXPAND_QUEUE} | cut -s -d" " -f2-)"
+ _LH_LIST_LOCATION=""
+
+ for _LH_SEARCH_PATH in ${@} "${LH_BASE:-/usr/share/live-helper}/lists"
+ do
+ if [ -e "${_LH_SEARCH_PATH}/${_LH_LIST_NAME}" ]
+ then
+ _LH_LIST_LOCATION="${_LH_SEARCH_PATH}/${_LH_LIST_NAME}"
+ fi
+ done
+
+ if [ -z "${_LH_LIST_LOCATION}" ]
+ then
+ echo "W: Unknown package list '${_LH_LIST_NAME}'" >&2
+ continue
+ fi
+
+ # Output packages
+ grep -v "^#" ${_LH_LIST_LOCATION} | grep .
+
+ # Find includes
+ _LH_INCLUDES="$(sed -n \
+ -e 's|^#<include> \([^ ]*\)|\1|gp' \
+ -e 's|^#include <\([^ ]*\)>|\1|gp' \
+ "${_LH_LIST_LOCATION}")"
+
+ # Add to queue
+ _LH_EXPAND_QUEUE="$(echo ${_LH_EXPAND_QUEUE} ${_LH_INCLUDES} | \
+ sed -e 's|[ ]*$||' -e 's|^[ ]*||')"
done
- sed -ne 's|^\([^#].*\)|\1\n|gp' "${FILE}"
}
--
debian-live/live-helper
More information about the debian-live-changes
mailing list