gnulib-tool-py
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnulib-tool-py] func_modules_transitive_closure


From: Bruno Haible
Subject: Re: [gnulib-tool-py] func_modules_transitive_closure
Date: Mon, 02 Jul 2012 04:14:08 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Hi Dmitriy,

>         for module in modules:
>           if module not in avoids:
>             module = system.find(module)
>             dependencies += module.getDependencies()

?? This is not the algorithm that computes transitive closures.
What about the dependencies of the dependencies, and the dependencies
of the dependencies of the dependencies, and so on?

>         dependencies = [dep.split('[')[0].strip() for dep in dependencies]
>         dependencies = sorted(set(dependencies))
> 
>       else: # if self.getTestFlags()
>         for module in modules:
>           if module not in avoids:
>             module = system.find(module)
>             status = module.getStatus()

No no, you have mixed up the roles of the modules here. When we have already
included module A and module B is among A.getDependencies(), then
  - we have to test whether B is in avoids, not whether A is in avoids,
  - we have to test B.getStatus(), not A.getStatus().

>             if system.exists(module.getTestsName()):
>               if self.checkTestFlag(TESTS['tests']):
>                 dependencies += [module.getTestsName()]

No no, before adding module.getTestsName() to the dependencies, you
have to checks its getStatus().

>             elif status == 'obsolete':
>               if self.checkTestFlag(TESTS['obsolete']):
>                 dependencies += module.getDependencies()
> 
>             elif status == 'c++-test':
>               if self.checkTestFlag(TESTS['c++-test']):
>                 dependencies += module.getDependencies()
> 
>             elif status == 'longrunning-test':
>               if self.checkTestFlag(TESTS['longrunning-test']):
>                 dependencies += module.getDependencies()
> 
>             elif status == 'privileged-test':
>               if self.checkTestFlag(TESTS['privileged-test']):
>                 dependencies += module.getDependencies()
> 
>             elif status == 'unportable-test':
>               if self.checkTestFlag(TESTS['unportable-test']):
>                 dependencies += module.getDependencies()

No no, this is not the algorithm that I explained. You start with the
assumption that the dependency is to be omitted, and in some cases you
add it. Instead, you need to start with the assumption that the
dependency is to be included, and in some cases you then find that
it has not to be included.

Likewise, above, for the determination of the transitive closure: I explained
that the standard algorithm proceeds via multiple rounds, and you show
me a code with a single round. This one cannot produce the expected
results.

Please try to have the same algorithmic logic from the old gnulib-tool
to the new one. I don't want to have an algorithm that looks superficially
similar but produces vastly different results. I want the same algorithm
with the same results. The only difference is that it operates on Python
objects (GLModule instead of string).

Maybe it helps if you make an intermediate write-up of the algorithm,
like what you could read in a computer science text book. I tried to do it in
<http://lists.gnu.org/archive/html/gnulib-tool-py/2012-06/msg00045.html>.
Probably you need to use more symbolic writing, such as

   For every module A:
     For every module B in A.getDependencies():
       If B is not in avoids
         ...
         ...

in those places where I gave only an informal sketch.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]