From 9c027571ba8919d6f405679d77baf2223fb8c418 Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Sat, 7 Jun 2008 19:03:45 +0000 Subject: [PATCH] Move update_tasks to using mawk rather than gawk. It's *much* faster. Needs some slight changes in regular expression handling, but nothing major. --- debian/control | 2 +- tools/update_tasks | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/debian/control b/debian/control index 8081291c..3cbae8b4 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Vcs-Browser: http://svn.debian.org/wsvn/debian-cd/trunk?op=log Package: debian-cd Architecture: all -Depends: perl, cpp, libdigest-md5-perl, tofrodos, apt (>= 0.3.11.1), make, genisoimage, lynx, grep-dctrl, bc, libcompress-zlib-perl +Depends: perl, cpp, libdigest-md5-perl, tofrodos, apt (>= 0.3.11.1), make, genisoimage, lynx, grep-dctrl, bc, libcompress-zlib-perl, mawk Recommends: hfsutils, netpbm, syslinux Description: Tools for building (Official) Debian CD set Debian-cd is the official tool for building Debian CD set since the potato diff --git a/tools/update_tasks b/tools/update_tasks index c89b0271..ab5b0215 100755 --- a/tools/update_tasks +++ b/tools/update_tasks @@ -18,15 +18,14 @@ update_full_list () { pkgfile=$3 grep '\*' $file > $file.new - (grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ; echo DONE ; cat $pkgfile) | awk ' + (grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ; echo DONE ; cat $pkgfile) | mawk ' /DONE/ { in_packages = 1 next } /.*/ { if (!in_packages) { - name=sprintf("(^| )%s(,|$)", $1) - tasklist[name] = num_tasks + tasklist[$1] = num_tasks num_tasks++ } } @@ -38,10 +37,15 @@ update_full_list () { } /^Task: / { if (in_packages) { + gsub("Task: ", "", $0) + gsub(",", "", $0) + split($0, these) for (taskname in tasklist) { - if (match($0, taskname)) { - printf("%d:%s\n", tasklist[taskname], pkgname) - next + for (task in these) { + if (these[task] == taskname) { + printf("%d:%s\n", tasklist[taskname], pkgname) + next + } } } } @@ -59,7 +63,7 @@ update_essential_list () { grep '\*' $file > $file.new (grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ; echo DONE ; - cat $tasksel/usr/share/tasksel/debian-tasks.desc) | awk -v DT=$3 ' + cat $tasksel/usr/share/tasksel/debian-tasks.desc) | mawk -v DT=$3 ' /DONE/ { in_tasks = 1 @@ -112,7 +116,7 @@ TMP_PKG=$BDIR/Packages zcat $MIRROR/dists/$CODENAME/main/binary-i386/Packages.gz > $TMP_PKG # Now grab the appropriate tasksel package -TASKSEL_DEB=$MIRROR/`awk ' +TASKSEL_DEB=$MIRROR/`mawk ' /^Package: tasksel-data$/ { found=1 } /^Filename:/ { if (found==1) { print $2; exit } }' $TMP_PKG`