normalize path names

svn path=/trunk/; revision=31284
This commit is contained in:
2015-05-30 14:04:30 +00:00
parent 4d82eb6286
commit 1490e31ffb
4 changed files with 21 additions and 20 deletions
+7 -2
View File
@@ -1,6 +1,6 @@
#!/bin/sh
basedir="$(dirname $0)/.."
basedir="$(realpath -m "$0/../..")"
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
@@ -79,8 +79,14 @@ while [ -n "$*" ]; do
[ -n "$*" ] && shift 1
done
[ -z "$tree" ] && tree="$basedir"
tree="$(realpath "$tree")"
basedir="$(realpath "$basedir")"
target="$(realpath "$target")"
if [ -n "$statusdir" ]; then
mkdir -p "$statusdir"
statusdir="$(realpath "$statusdir")"
if [ ! -w "$statusdir" -o ! -d "$statusdir" ]; then
print_error "Unable to set up status directory in \"$statusdir\",
either select a status directory that exists and is writable,
@@ -103,7 +109,6 @@ case "$command" in
build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" "$olang"
;;
tree_maker)
[ -z "$tree" ] && tree="$basedir"
[ -z "$target" ] && print_error "Missing target location" && exit 1
tree_maker "$tree" "$target"
;;
+2 -1
View File
@@ -31,7 +31,8 @@ svn_update(){
A???" "*.xsl) echo "$update";;
[UGR]???" "*.xsl) regen_xsldeps=true;;
????" "*.xsl) regen_xsldeps=true;;
A???" "*.xhtml) regen_xhtml=true;;
A???" "*.xhtml) echo "$update"
regen_globs=true;;
[UGR]???" "*.xhtml) true;;
????" "*.xhtml) regen_xhtml=true;;
????" "*Makefile) true;;
+8 -10
View File
@@ -16,13 +16,11 @@ mio(){
# make input/output abstraction, produce reusable makefiles
# by replacing in and out pathes with make variables.
for each in "$@"; do
if [ "${each#$input/}" != "$each" ]; then
echo "\${INPUTDIR}/${each#$input/}"
elif [ "${each#$output}" != "$each" ]; then
echo "\${OUTPUTDIR}/${each#$output/}"
else
echo "$each"
fi
case "$each" in
"$input"/*) echo "\${INPUTDIR}/${each#$input/}" ;;
"$output"/*) echo "\${OUTPUTDIR}/${each#$output/}" ;;
*) echo "$each" ;;
esac
done
}
@@ -176,7 +174,7 @@ xslt_maker(){
file="$input/$1"
dir="$(dirname "$file")"
deps="$(xslt_dependencies "$file" |sed "s;^.*$;$dir/&;")"
deps="$( xslt_dependencies "$file" |xargs -I'{}' realpath -m "$dir/{}" )"
cat <<MakeEND
$(mes "$file"): $(mes $deps)
touch "$(mio "$file")"
@@ -198,8 +196,8 @@ copy_sources(){
tree_maker(){
# walk through file tree and issue Make rules according to file type
input="$(echo "$1" |sed -r 's:/$::')"
output="$(echo "$2" |sed -r 's:/$::')"
input="$(realpath "$1")"
output="$(realpath -m "$2")"
cache_textsfile
cache_fundraising
+4 -7
View File
@@ -7,13 +7,11 @@ dir_maker(){
# set up directory tree for output
# optimise by only issuing mkdir commands
# for leaf directories
input="$(echo "$1" |sed -r 's:/$::')"
output="$(echo "$2" |sed -r 's:/$::')"
input="${1%/}"
output="${2%/}"
curpath="$output"
find "$input" -depth -type d \
| sed -r "/(^|\/)\.svn($|\/)|^\.\.$/d;s;^$input/*;;" \
find "$input" -depth -type d \! -path '*/.svn' -printf '%P\n' \
| while read filepath; do
oldpath="$curpath"
curpath="$output/$filepath/"
@@ -26,8 +24,7 @@ build_manifest(){
# read a Makefile from stdin and generate
# list of all make tagets
sed -nr 's;/\./;/;g;
s;\\ ; ;g;
sed -nr 's;\\ ; ;g;
s;\\#;#;g;
s;\$\{OUTPUTDIR\}/([^:]+) :.*;\1;p'
}