From f627889b721d74c936e531115871310afbb8a1d8 Mon Sep 17 00:00:00 2001 From: Tommy Reynolds Date: Mon, 12 Dec 2005 16:35:02 +0000 Subject: Always copy files with multiple dashes, as a courtesy to legacy files. Added check for a "figs/Manifest-${LANG}" file. If found, get the filenames to copy from that, else search the source tree by name. --- bin/copy-figs | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) (limited to 'bin') diff --git a/bin/copy-figs b/bin/copy-figs index fe066ec..a3063aa 100755 --- a/bin/copy-figs +++ b/bin/copy-figs @@ -114,20 +114,47 @@ fi leadin=$(/usr/bin/dirname "${SRC}") [ "${DEBUG}" ] || echo >&2 "leadin=|${leadin}|" -find "${SRC}" -print | +haveManifest=$( + [ "${DEBUG}" ] || echo >&2 "Checking ${SRC}/Manifest-${targetLang}" + if [ -f "${SRC}/Manifest-${targetLang}" ]; then + echo yes + else + echo no + fi +) +[ "${DEBUG}" ] || echo >&2 "haveManifest=|${haveManifest}|" + +( + if [ "${haveManifest}" = "yes" ]; then + # We have a manifest file, so get the list of + # RELATIVE filenames from there. Generate the + # "Manifest-${targetLang}" file like this: + # cd figs; find * -print >"Manifest-${targetLang}" + # or something similar + cat "${SRC}/Manifest-${targetLang}" + else + # No manifest, resort to a search + find "${SRC}" -print + fi +) | while read fn do # Skip anything that even looks like CVS or SVN case "${fn}" in - *CVS* | *svn* ) + *CVS* | *.svn* ) continue ;; esac # Figure out the relative path for this pathname chunk - rp=$( - echo $(/usr/bin/dirname "${fn}")/$(/bin/basename "${fn}") | - /bin/sed "s;^${leadin}/*;;" - ) + if [ "${haveManifest}" = "yes" ]; then + rp="${fn}" + fn="${SRC}/${rp}" + else + rp=$( + echo $(/usr/bin/dirname "${fn}")/$(/bin/basename "${fn}") | + /bin/sed "s;^${leadin}/*;;" + ) + fi [ "${DEBUG}" ] || echo >&2 "rp=|${rp}|" # Copy directories, even if they are going to be empty. # Inodes are cheap, as long as you have enough. @@ -139,18 +166,22 @@ do # May not want this file under any circumstances bn=$(/bin/basename "${rp}") filteredBn=$(echo "${bn}" | sed -n ${bnFilter}) - if [ -z "${filteredBn}" ]; then + if [ "${haveManifest}" = "no" -a -z "${filteredBn}" ]; then [ "${DEBUG}" ] || echo >&2 "Filter rejects |${fn}|" continue fi # We want this file if the language matches or if it is # language neutral - copyIt=no + copyIt=${haveManifest} case "${bn}" in - *-${LANG}.* ) + *-${targetLang}.* ) # Has matching language copyIt=yes ;; + *-*-* ) + # Multiple dashes imply ambiguous filename + copyIt=yes + ;; *-* ) # Doesn't match target language ;; -- cgit