diff options
author | vd <vd@FreeBSD.org> | 2006-07-05 16:31:49 +0800 |
---|---|---|
committer | vd <vd@FreeBSD.org> | 2006-07-05 16:31:49 +0800 |
commit | 188263e04b8336841ca04f6c6d048808d99594e9 (patch) | |
tree | 26c0bc30fb40ef98a20a30d03bfbeefec8ae1158 /Tools/scripts | |
parent | 1f37ad9dba0422eb8691763a53f6b031f9ffb98d (diff) | |
download | freebsd-ports-gnome-188263e04b8336841ca04f6c6d048808d99594e9.tar.gz freebsd-ports-gnome-188263e04b8336841ca04f6c6d048808d99594e9.tar.zst freebsd-ports-gnome-188263e04b8336841ca04f6c6d048808d99594e9.zip |
Escape characters (like +) that may appear in ports' names and
break sed -E regular expressions
Diffstat (limited to 'Tools/scripts')
-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 } |