Re: Include additional checks in update-language
Hi Florent, hi all!
Taking off the bug, this is enough to have it here.
On Mon, 27 Feb 2006, Florent Rougon wrote:
> > # perform_content_check
> > #
> > # This function *TRIES* to check wether the installed files are correct in
> > # the sense that every file occurring in it is present. This can help to
> > # find typing errors
> > perform_content_check ()
>
> What is the use of $1 in this function?
Ooops, sorry, $1 is the "$output_file"
> > {
> > #
> > # performing content checking only works when kpsewhich is present
> > # and configured, this can be done in one step:
> ^^^^
> ; checked, or queried
Well, calling
if notexistingprogram --version >/dev/null 2>&1 ; then
also returns an error code > 0. So yes, checked.
>
> > if kpsewhich --version >/dev/null 2>&1 ; then
> > if [ "$progname" = "update-language" ] ; then
> > perform_content_check_language "$2"
> > elif [ "$progname" = "update-updmap" ] ; then
> > perform_content_check_map "$2"
> > elif [ "$progname" = "update-fmtutil" ] ; then
> > perform_content_check_format "$2"
>
> else
> echo "Invalid progname: '$progname'" >&2
> exit 1
Unnecessary as update-fontlang already bails out at the beginning if
this happens.
> > perform_content_check_language ()
> > {
> > fn="$1"
> > cat "$fn" | grep -v '^\W*\(%\|=\|$\)' | while read lang hyph comm ; do
>
> grep -v '^\W*\(%\|=\|$\)' "$fn" | while read lang hyph comm; do
>
> -> spare one process
O dear, I could get the award for the stupid use of cat. Thanks.
> > # now check the existence of the hyphenation file
> > if [ -z $(kpsewhich -format=tex $hyph) ] ; then
> > cat >&2 <<EOF
> > DEBUG: lang=$lang hyph=$hyph comm=$comm
> > The config file $fn references a not-existing file
>
> file that is not in the kpathsea
> database
>
> (it could well exist, just waiting for mktexlsr to be run)
Ok.
> > perform_content_check_map ()
> > {
> > fn="$1"
> > cat "$fn" | grep -i '^[ \t]*\(Mixed\)\?*Map' | while read foo map ; do
>
> -> again, cat is useless here
> -> the second star in the regexp shouldn't be there, right?
> (-> also, I tend to always use grep -E, since it is the more powerful syntax)
cat, ok
star ok
grep -E (man, by the way, what did I send, it should be
grep -i '^\W*\(Mixed\)\?*Map'
but can you give me the -E syntax and I will happily use it.
> > # now check the existence of the hyphenation file
> > if [ -z $(kpsewhich -format=map $map) ] ; then
> > cat >&2 <<EOF
> > The config file $fn references a not-existing file
>
> -> same thing for "not-existing"
ok.
>
> > # this is stolen from fmtutil
>
> The comment should rather tell what you are going to do in the next lines...
ok
>
> > set - $args
>
> This is not POSIX anymore (cf.
> http://www.opengroup.org/onlinepubs/009695399/utilities/set.html). Use
> 'set -- $args' instead.
ok
> > pool=; tcx=
> > case $1 in
> > nls=*)
> > pool=$(echo $1 | sed 's@nls=@@; s@,.*@@')
> > tcx=$(echo $1 | sed 's@nls=[^,]*@@; s@^,@@')
> > shift
> > ;;
> > esac
> > texargs="$@"
>
> This blob is useless here.
>
> > eval lastarg=\$$#
> > inifile=$(echo $lastarg | sed 's%^\*%%')
> > case "$engine" in
> > mpost) fmtfile="$format.mem"; kpsefmt=mpost;;
>
> fmtfile is unused here
>
> > mf|mfw|mf-nowin) fmtfile="$format.base"; kpsefmt=mf;;
> > *) fmtfile="$format.fmt"; kpsefmt=tex;;
>
> same thing
As I said, I stole it from fmtutil withot a lot of checking.
> Well, I'm not sure there is a real need to add all this code, but if
> there is user demand...
That's the reason why Iasked here wether we should implement this. As it
turned out, it was not that difficult. I am not necessarily FOR the
inclusion, definitely against automatic execution, but it may help some
people (as it did already).
> Is it so complex to check whether a package is actually installing the
> expected map file/hyphenation file/format file?
With big pacakges as Danai has it (latex-cjk with all the packges is
really big) it probably helps to spot errors.
I don't have all this in the depot till now, as I said, I want to hear
if we really want to include something like this.
Best wishes
Norbert
-------------------------------------------------------------------------------
Dr. Norbert Preining <preining AT logic DOT at> Università di Siena
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
YADDLETHORPE (vb.)
(Of offended pooves.) To exit huffily from a boutique.
--- Douglas Adams, The Meaning of Liff
Reply to: