[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnulib-tool-py] Dependencies contain comments and variables
From: |
Bruno Haible |
Subject: |
Re: [gnulib-tool-py] Dependencies contain comments and variables |
Date: |
Sat, 30 Jun 2012 00:53:04 +0200 |
User-agent: |
KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; ) |
Hi Dmitriy,
> I've found something strange inside code where we get dependencies. The
> problem is that old gnulib code seems to return comments and different
> shell code with dependencies.
>
> Example from strnlen:
>
> Depends-on:
> string
> extensions
> memchr-obsolete [test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1]
>
> That return such list of string:
> [
> 'string',
> 'extensions',
> 'memchr-obsolete [test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN =
> 1]]'
> ]
>
> Also it grabs comments (example from fseeko):
>
> extensions
> largefile
> lseek
> stdio
> sys_types
> # Just to guarantee consistency between fseek() and fseeko().
> fseek
Yes, watch out! Look at what func_get_dependencies does:
It returns the 'Dependencies:' section without much preprocessing. It only
- adds a dependency from MODULE-tests to MODULE upfront, and
- removes comment lines (where the '#' is at the beginning of the line).
Then search all func_get_dependencies invocations in gnulib-tool.
1) In func_modules_transitive_closure, func_emit_autoconf_snippets
we need to extract just the dependency modules. This is done through
`func_get_dependencies $module | sed -e
"$sed_dependencies_without_conditions"`
In Python, where 'sed' invocations are overkill the equivalent processing
is:
- In every line that contains a '[' character, remove all text
starting with the first '[' character, and the whitespace that
immediately precedes it.
- Tokenize the resulting output, taking whitespace (including newlines)
as separators.
Since whitespace before newline or end of string is redundant in the
second step, there is actually no need to drop whitespace before '['.
2) In func_modules_transitive_closure, we need to extract just the condition
of a dependency. This is done through the code which I dissected for you
in my other mail, earlier today.
> As for comments we can exclude them (it is a very simple thing), but what
> we need to do with [test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN =
> 1]] strings? Am I right that it is a conditional dependency that is added
> if condition in brackets is True? sed_extract_prog seems to extract it, but
> I can't find the code which processes such directives.
Did you receive my other mail today?
<http://lists.gnu.org/archive/html/gnulib-tool-py/2012-06/msg00045.html>
Bruno