diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2006-07-05 08:31:49 +0000 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2006-07-05 08:31:49 +0000 |
commit | ed290037f53e9fd2468967bc2e900248f7f1d213 (patch) | |
tree | 6b276e14ed86d18c7ed022e2a7b313d58a791e9d /Tools | |
parent | 2205b1d3099d9fc33b1f84d6844b2133b7780849 (diff) | |
download | ports-ed290037f53e9fd2468967bc2e900248f7f1d213.tar.gz ports-ed290037f53e9fd2468967bc2e900248f7f1d213.zip |
Escape characters (like +) that may appear in ports' names and
break sed -E regular expressions
Notes
Notes:
svn path=/head/; revision=166972
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/rmport | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport index dc5ffbcd4456..588de7c64490 100755 --- a/Tools/scripts/rmport +++ b/Tools/scripts/rmport @@ -49,6 +49,13 @@ log() echo "==> $*" >&2 } +escape() +{ + # escape characters that may appear in ports' names and + # break regular expressions + echo "${1}" |sed -E 's/(\+|\.)/\\\1/g' +} + pkgname() { make -C ${PORTSDIR}/${1} -V PKGNAME @@ -193,7 +200,9 @@ edit_modules() log "${cat}/${port}: removing from CVSROOT/modules" - ${SED} -e "/^(ports_)?(..-)?${port}[[:space:]]+ports\/${cat}\/${port}\$/d" \ + portesc=`escape ${port}` + + ${SED} -e "/^(ports_)?(..-)?${portesc}[[:space:]]+ports\/${cat}\/${portesc}\$/d" \ CVSROOT/modules } @@ -219,7 +228,9 @@ edit_Makefile() log "${cat}/${port}: removing from ${cat}/Makefile" - ${SED} -e "/^[[:space:]]*SUBDIR[[:space:]]*\+=[[:space:]]*${port}([[:space:]]+#.*)?$/d" \ + portesc=`escape ${port}` + + ${SED} -e "/^[[:space:]]*SUBDIR[[:space:]]*\+=[[:space:]]*${portesc}([[:space:]]+#.*)?$/d" \ ports/${cat}/Makefile } |