diff options
author | rillig <rillig> | 2006-01-07 22:27:56 +0000 |
---|---|---|
committer | rillig <rillig> | 2006-01-07 22:27:56 +0000 |
commit | 858a737112957e0679ccbd5076258c3fc9a045fd (patch) | |
tree | 35d2c45f55ec2fce803a41a0245ea1f8ff1a669c /mk/bulk | |
parent | b7922f673b41ffb20f74f32a997488a73c19be1e (diff) | |
download | pkgsrc-858a737112957e0679ccbd5076258c3fc9a045fd.tar.gz |
- Added pbc_checkpathname, pbc_checkbasename, pbc_checkurl.
- Modified pbc_checkexisting{dir,file} to use pbc_checkpathname.
Diffstat (limited to 'mk/bulk')
-rw-r--r-- | mk/bulk/post-build-conf | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/mk/bulk/post-build-conf b/mk/bulk/post-build-conf index cee23300de5..6815fb40637 100644 --- a/mk/bulk/post-build-conf +++ b/mk/bulk/post-build-conf @@ -1,4 +1,4 @@ -# $NetBSD: post-build-conf,v 1.9 2005/12/03 01:00:37 rillig Exp $ +# $NetBSD: post-build-conf,v 1.10 2006/01/07 22:27:56 rillig Exp $ # # This file is included after the build.conf file by the "build" and @@ -77,14 +77,31 @@ pbc_checkyesno() { esac } -# usage: pbc_checkexistingfile varname -pbc_checkexistingfile() { +# usage: pbc_checkpathname varname +pbc_checkpathname() { eval "pbc_val=\${$1-}" case $pbc_val in /*) ;; *) pbc_die "$1 must be an absolute pathname.";; esac +} + +# usage: pbc_checkbasename varname +pbc_checkbasename() { + eval "pbc_val=\${$1-}" + + case $pbc_val in + */*) pbc_die "$1 must not contain slashes.";; + esac +} + +# usage: pbc_checkexistingfile varname +pbc_checkexistingfile() { + + pbc_checkpathname "$1" + + eval "pbc_val=\${$1-}" test -f "${pbc_val}" \ || pbc_die "$1 must be the name of an existing file." @@ -92,17 +109,26 @@ pbc_checkexistingfile() { # usage: pbc_checkexistingdir varname pbc_checkexistingdir() { - eval "pbc_val=\${$1-}" - case $pbc_val in - /*) ;; - *) pbc_die "$1 must be an absolute pathname.";; - esac + pbc_checkpathname "$1" + + eval "pbc_val=\${$1-}" test -d "${pbc_val}" \ || pbc_die "$1 must be the name of an existing directory." } +# usage: pbc_checkurl varname +pbc_checkurl() { + eval "pbc_val=\${$1-}" + + case $pbc_val in + file:///*|ftp://*|http://*) + ;; + *) pbc_die "$1 is not a valid URL.";; + esac +} + # usage: pbc_checknonempty varname pbc_checknonempty() { eval "pbc_isset=\${$1+set}" |