2006-12-29 05:05:30 -01:00
|
|
|
#!/bin/sh
|
2008-06-07 00:27:20 +00:00
|
|
|
set -e
|
2006-12-29 05:05:30 -01:00
|
|
|
|
|
|
|
if [ -z "$CODENAME" ]; then
|
2008-11-13 22:19:30 -01:00
|
|
|
echo "update_tasks: codename not specified" >&2
|
2008-06-07 00:31:58 +00:00
|
|
|
exit 1
|
2006-12-29 05:05:30 -01:00
|
|
|
fi
|
|
|
|
|
2008-10-12 23:08:57 +00:00
|
|
|
if [ "$MIRROR"x = ""x ] ; then
|
2008-11-13 22:19:30 -01:00
|
|
|
echo "update_tasks: mirror dir not specified" >&2
|
2008-06-07 00:02:36 +00:00
|
|
|
exit 1
|
2006-12-29 05:05:30 -01:00
|
|
|
fi
|
|
|
|
|
2008-10-12 23:08:57 +00:00
|
|
|
if [ "$BDIR"x = ""x ] ; then
|
2008-11-13 22:19:30 -01:00
|
|
|
echo "update_tasks: temp dir not specified" >&2
|
2008-10-12 23:54:01 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2008-11-13 22:19:30 -01:00
|
|
|
TDIR=$BDIR/update_tasks
|
2008-10-12 23:54:01 +00:00
|
|
|
mkdir -p $TDIR
|
|
|
|
|
2008-12-05 13:12:10 -01:00
|
|
|
# Sort primary and secondary tasks and add language tasks for both
|
|
|
|
# Secondary tasks are indicated by a "-" suffix in the task.list file
|
|
|
|
# When adding language tasks, 'desktop' is sorted before '*-desktop'
|
|
|
|
expand_task_list () {
|
2008-12-05 13:12:38 -01:00
|
|
|
outbase=$1
|
|
|
|
tasklist=$2
|
|
|
|
langlist=$3
|
2008-12-05 13:12:10 -01:00
|
|
|
|
|
|
|
# Filter out comments, empty lines and secondary tasks
|
2008-12-28 12:18:09 -01:00
|
|
|
task_primary="$(grep -Ev "^(#.*)?(.*-)?[[:space:]]*$" $tasklist)"
|
2008-12-05 13:12:10 -01:00
|
|
|
# Select only secondary tasks
|
2008-12-28 12:18:09 -01:00
|
|
|
task_secondary="$(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist | \
|
2008-12-05 21:30:18 -01:00
|
|
|
grep -E "(.*-)[[:space:]]*$" | sed "s/[[:space:]]\+-.*$//")"
|
2008-12-05 13:12:10 -01:00
|
|
|
|
2008-12-28 12:18:09 -01:00
|
|
|
echo "# Primary main tasks" >$outbase.primary
|
|
|
|
echo "$task_primary" >>$outbase.primary
|
2008-12-05 13:12:10 -01:00
|
|
|
|
2008-12-28 12:18:09 -01:00
|
|
|
echo >>$outbase.primary
|
|
|
|
echo "# Primary language tasks" >>$outbase.primary
|
|
|
|
for task in "" $(echo "$task_primary" | grep "^desktop" || true) \
|
|
|
|
$(echo "$task_primary" | grep -- "-desktop" || true); do
|
2008-12-05 13:12:10 -01:00
|
|
|
for language in $(cat $langlist); do
|
|
|
|
echo $language${task:+-$task}
|
|
|
|
done
|
2008-12-28 12:18:09 -01:00
|
|
|
done >>$outbase.primary
|
2008-12-05 13:12:10 -01:00
|
|
|
|
2008-12-28 12:18:09 -01:00
|
|
|
rm -f $outbase.secondary
|
|
|
|
if [ "$task_secondary" ]; then
|
|
|
|
echo "# Secondary main tasks" >$outbase.secondary
|
|
|
|
echo "$task_secondary" >>$outbase.secondary
|
2008-12-05 13:12:10 -01:00
|
|
|
|
2008-12-28 12:18:09 -01:00
|
|
|
echo >>$outbase.secondary
|
|
|
|
echo "# Secondary language tasks" >>$outbase.secondary
|
|
|
|
for task in $(echo "$task_secondary" | grep "^desktop" || true) \
|
|
|
|
$(echo "$task_secondary" | grep -- "-desktop" || true); do
|
2008-12-05 13:12:10 -01:00
|
|
|
for language in $(cat $langlist); do
|
2008-12-28 12:18:09 -01:00
|
|
|
echo $language-$task
|
2008-12-05 13:12:10 -01:00
|
|
|
done
|
2008-12-28 12:18:09 -01:00
|
|
|
done >>$outbase.secondary
|
2008-12-05 13:12:10 -01:00
|
|
|
fi
|
|
|
|
}
|
2008-10-12 23:08:57 +00:00
|
|
|
|
2006-12-29 05:05:30 -01:00
|
|
|
update_full_list () {
|
2008-06-07 00:31:58 +00:00
|
|
|
file=$1
|
|
|
|
tasklist=$2
|
2008-06-07 00:02:36 +00:00
|
|
|
pkgfile=$3
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2008-06-07 19:03:45 +00:00
|
|
|
(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ; echo DONE ; cat $pkgfile) | mawk '
|
2008-06-07 00:02:36 +00:00
|
|
|
/DONE/ {
|
|
|
|
in_packages = 1
|
|
|
|
next
|
|
|
|
}
|
|
|
|
/.*/ {
|
|
|
|
if (!in_packages) {
|
2008-06-07 19:03:45 +00:00
|
|
|
tasklist[$1] = num_tasks
|
2008-06-07 00:02:36 +00:00
|
|
|
num_tasks++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Package: / {
|
|
|
|
if (in_packages) {
|
|
|
|
pkgname = $2
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Task: / {
|
|
|
|
if (in_packages) {
|
2008-06-07 19:31:29 +00:00
|
|
|
# Parse the Tasks: line, splitting into array "these"
|
2008-06-07 19:03:45 +00:00
|
|
|
gsub("Task: ", "", $0)
|
|
|
|
gsub(",", "", $0)
|
|
|
|
split($0, these)
|
2008-06-07 19:31:29 +00:00
|
|
|
|
|
|
|
# And see if we have any matches
|
|
|
|
for (task in these) {
|
|
|
|
for (taskname in tasklist) {
|
2008-06-07 19:03:45 +00:00
|
|
|
if (these[task] == taskname) {
|
|
|
|
printf("%d:%s\n", tasklist[taskname], pkgname)
|
|
|
|
next
|
|
|
|
}
|
2008-06-07 00:02:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
next
|
2008-12-28 12:18:09 -01:00
|
|
|
}' | sort -n | cut -d: -f2 >> $file
|
2006-12-29 05:05:30 -01:00
|
|
|
}
|
|
|
|
|
|
|
|
update_essential_list () {
|
2008-06-07 00:31:58 +00:00
|
|
|
file=$1
|
|
|
|
tasklist=$2
|
2008-12-05 13:12:10 -01:00
|
|
|
tasksel=$3
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2008-06-07 17:03:44 +00:00
|
|
|
(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ;
|
|
|
|
echo DONE ;
|
2008-12-05 13:12:10 -01:00
|
|
|
cat $tasksel/usr/share/tasksel/debian-tasks.desc) | mawk '
|
2008-06-07 17:03:44 +00:00
|
|
|
|
|
|
|
/DONE/ {
|
|
|
|
in_tasks = 1
|
|
|
|
next
|
|
|
|
}
|
|
|
|
/^ / {
|
|
|
|
if (in_key) {
|
|
|
|
printf("%d:%s\n", tasklist[cur_task], $1)
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/.*/ {
|
|
|
|
if (!in_tasks) {
|
|
|
|
tasklist[$1] = num_tasks
|
|
|
|
num_tasks++
|
|
|
|
}
|
|
|
|
if (in_key) {
|
|
|
|
in_key = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Task: / {
|
|
|
|
if (in_tasks) {
|
|
|
|
cur_task = $2
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Key: / {
|
|
|
|
if (in_tasks) {
|
|
|
|
for (taskname in tasklist) {
|
|
|
|
if (taskname == cur_task) {
|
2008-12-05 13:12:10 -01:00
|
|
|
in_key = 1
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
next
|
2008-12-28 12:18:09 -01:00
|
|
|
}' | sort -s -n -k1 | cut -d: -f2 >> $file
|
2006-12-29 05:05:30 -01:00
|
|
|
}
|
|
|
|
|
2009-02-11 23:22:17 -01:00
|
|
|
# Look for the coreutils package (which should exist in all archs, and is
|
|
|
|
# a non -all package) to determine a valid arch for the rest of this
|
|
|
|
# script
|
|
|
|
arch=$(which_deb $MIRROR $CODENAME coreutils binary | sed -e "s/\.deb//" -e "s/.*_//")
|
|
|
|
# We need to gunzip a copy of the appropriate Packages.gz file(s)
|
2008-10-12 23:54:01 +00:00
|
|
|
TMP_PKG=$TDIR/Packages
|
2009-02-11 23:22:17 -01:00
|
|
|
zcat $MIRROR/dists/$CODENAME/main/binary-$arch/Packages.gz > $TMP_PKG
|
2009-02-12 13:16:45 -01:00
|
|
|
if [ -n "$LOCAL" ] ; then
|
|
|
|
if [ -n "$LOCALDEBS" ] ; then
|
|
|
|
zcat $LOCALDEBS/dists/$CODENAME/local/binary-$arch/Packages.gz >> $TMP_PKG
|
|
|
|
else
|
|
|
|
zcat $MIRROR/dists/$CODENAME/local/binary-$arch/Packages.gz >> $TMP_PKG
|
|
|
|
fi
|
|
|
|
fi
|
2008-06-07 00:02:36 +00:00
|
|
|
|
|
|
|
# Now grab the appropriate tasksel package
|
2008-06-07 19:03:45 +00:00
|
|
|
TASKSEL_DEB=$MIRROR/`mawk '
|
2008-06-07 00:02:36 +00:00
|
|
|
/^Package: tasksel-data$/ { found=1 }
|
|
|
|
/^Filename:/ { if (found==1) { print $2; exit } }' $TMP_PKG`
|
|
|
|
|
2010-12-09 14:58:22 -01:00
|
|
|
# For testing purposes - set up FORCE_SID_TASKSEL to force us to use
|
|
|
|
# sid's tasksel data even if we're using stable/testing.
|
|
|
|
if [ "$FORCE_SID_TASKSEL"x = "1"x ] ; then
|
|
|
|
echo "update_tasks: forcing use of the sid tasksel-data tasks"
|
|
|
|
TASKSEL_DEB=$MIRROR/$(which_deb $MIRROR sid tasksel-data binary)
|
|
|
|
fi
|
|
|
|
|
2008-10-12 23:54:01 +00:00
|
|
|
dpkg -x $TASKSEL_DEB $TDIR/tasksel
|
2008-06-07 00:02:36 +00:00
|
|
|
|
2008-12-05 13:12:10 -01:00
|
|
|
[ -e task.languages ] || exit 1
|
|
|
|
grep -Ev "^(#.*)?[[:space:]]*$" task.languages > $TDIR/languages
|
|
|
|
|
2008-12-05 13:12:38 -01:00
|
|
|
for tlist in task.list.*; do
|
|
|
|
variant=${tlist##*.}
|
2008-12-05 13:12:10 -01:00
|
|
|
|
2008-12-05 13:12:38 -01:00
|
|
|
expand_task_list task.gen.$variant $tlist $TDIR/languages
|
2008-12-05 13:12:10 -01:00
|
|
|
|
2008-12-28 12:18:09 -01:00
|
|
|
# Create (empty) output files
|
|
|
|
: >task-essential-$variant
|
|
|
|
: >task-full-$variant
|
|
|
|
|
2008-12-05 13:12:10 -01:00
|
|
|
update_essential_list \
|
2008-12-05 13:12:36 -01:00
|
|
|
task-essential-$variant \
|
2008-12-28 12:18:09 -01:00
|
|
|
task.gen.$variant.primary \
|
2008-12-05 13:12:10 -01:00
|
|
|
$TDIR/tasksel
|
|
|
|
|
|
|
|
update_full_list \
|
2008-12-05 13:12:36 -01:00
|
|
|
task-full-$variant \
|
2008-12-28 12:18:09 -01:00
|
|
|
task.gen.$variant.primary \
|
2008-12-05 13:12:10 -01:00
|
|
|
$TMP_PKG
|
2008-12-28 12:18:09 -01:00
|
|
|
|
|
|
|
# Now add packages for secondary tasks; start with Key packages again
|
|
|
|
if [ -e task.gen.$variant.secondary ]; then
|
|
|
|
update_essential_list \
|
|
|
|
task-full-$variant \
|
|
|
|
task.gen.$variant.secondary \
|
|
|
|
$TDIR/tasksel
|
|
|
|
|
|
|
|
update_full_list \
|
|
|
|
task-full-$variant \
|
|
|
|
task.gen.$variant.secondary \
|
|
|
|
$TMP_PKG
|
|
|
|
fi
|
2008-12-05 13:12:10 -01:00
|
|
|
done
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2008-11-13 22:19:30 -01:00
|
|
|
rm -rf $TDIR
|