1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
# -*- mode: sh -*-
# Common functions for autodep8
#
parse_control(){
# Function to extract items in a field of debian/control return comma
# separated
# tested with Build-Depends
# Don't use with Recommends as some packages add substvars (like cdbs)
#
# input1: control field
# input2: items to filter out (optional)
control_field=$1
filter="$2"
if [ -f debian/control ]; then
out=$(
grep-dctrl -n -s $control_field -F $control_field -r . debian/control \
| grep -v '^\s*#' \
| sed -e 's/,\s*/\n/g; s/^\s*//' \
| sed -e 's/\s*<[^)]*>\s*$//' \
| tr '\n' ', ' \
| sed 's/,,/,/g')
else
out=''
fi
for pkg in $filter ; do
out=$(echo ,$out | sed -e "s/,$pkg,/,/" -e "s/,$pkg ([^,]*),/,/" -e 's/,,/,/')
out=${out#,}
done
echo $out
}
|