Pierre Labastie wrote:
On 09/11/2015 22:25, Bruce Dubbs wrote:
Pierre Labastie wrote:
On 01/11/2015 18:51, Bruce Dubbs wrote:
Pierre Labastie wrote:
Hi,

I do not know who monitors this list,

I do that.

Now, the BLFS part offers much more room for improvement:

I don't use jhalfs for BLFS, but there are a couple of tools I'd like to see
for it.  I'd like a tool to print out the dependency tree for a package.  For
instance,

dependencies package-name [required | all]

would look at the dependencies of for example, parted, and give a tree of
packages needed.  The normal output would be required+recommended, but the
optional argument 'required' would give just required dependencies while 'all'
would give required+recommended+optional.  It would look something like:

$ dependencies parted
parted-3.2
    LVM2-2.02.133

$ dependencies parted all
parted-3.2
    LVM2-2.02.133
      [...]
      X Window System

I wouldn't expand 'X Window System'.  I didn't finish the above, but you get
the idea.  This is far from a trivial program.  The circular dependencies need
to be handled in some way and there probably would need to be some changes to
the book to flag dependency issues.


Actually there are two ways of treating the circular dependencies, and I'd
like some advice. First, let's see how we figure out a circular dependency:
- the tool works by recursively building the dependency tree, say (-> means
"depends on", and please use fixed width fonts for viewing):
         ->C1
        /
    ->B1-->C2
   /
A-->B2-->C3
   \
    ->B3-->C4
        \
         ->C5
- at a given point in the building process, we detect that one of the paths
from root to node has the form:
root-->...-->P-->D1-->D2-->...D(n-1)-->Dn-->D1, that is, D1 is a dependency of
Dn, but D1 has already been seen in the path from root to node.

So we have to "break" the circle. First, we have to choose a link where to
break.
Presently, the tool asks whether the user wants to build Dn before D1 (answer
no) or D1 before Dn (answer yes). In the first case, it is easy, just break
between Dn and D1 (the last dep above), and forget about the second D1. In the
second case, the tools puts Dn as a dependency of P, and starts over from P,
that is, it builds:
...->P->Dn->D1->D2...->D(n-1)->Dn and the tool asks again. If the user answers
yes (build Dn before D(n-1)), then the tool generates:
...->P->D(n-1)->Dn->D1->D2... etc, until the user answers no (hopefully before
coming back to the original situation). That can be a very slow process,
because other circles may be met in the process, and so on.

I suggest to change this behavior, and that the tool choose itself where to
break. The idea is to break at the first minimal priority
(optional < recommended < required) that is found when reversing the path from
D1 to D1. Let's say the minimal priority in the circle is optional. If Dn->D1
is optional, then we break at Dn and forget about the second D1. If not, then
we try D(n-1)->Dn, D(n-2)->D(n-1), etc, until we find an optional dependency,
say D(i-1)-->Di.
Then, we have two choices:
(a) Break at D(i-1), and forget about the remaining part of the circle
(Di->...->Dn)
(b) Break at D(i-1), but keep the whole circle starting at Di, that is, build
the following path:
P->Di->...->Dn->D1->...D(i-1)

Choice (b) takes better consideration of the dependencies, since although they
are built after D1, the dependencies Di to Dn are built, while choice (a) does
not even build them.

Right now, I have a beta version with (b). I do not think it'd be harder to do
(a). What do you think?

(sorry if I have not made this clear, it is hard to explain...)

You are right that it is hard to explain.  Could you give a concrete example?

Let's try. Here is a part of the listing for the dependency of LVM2 with all
dependencies:
Node: 1 root.dep required
Node: 2  lvm2.dep required
Leaf: 3   mdadm optional
Leaf: 3   reiserfs optional
Node: 3   valgrind.dep optional
Node: 4    boost.dep optional
Node: 5     icu.dep optional
Node: 6      llvm.dep optional
Node: 7       libffi.dep recommended
Node: 8        dejagnu.dep optional
Node: 9         expect.dep required
Leaf: 10          tcl required
Node: 10          tk.dep optional
Node: 11           xtrans.dep required (X libraries)
Node: 12            fontconfig.dep required
Node: 13             freetype2.dep required
Node: 14              harfbuzz.dep recommended
Node: 15               glib2.dep recommended
Circ: 16                libffi.dep required

so the circle is
libffi->dejagnu->expect->tk->Xlib->fontconfig->freetype2->harfbuzz->glib2->libffi.

Since the first optional dep when going backward is tk, we have to break
between expect and tk. Now, option (a) would give:
tk->Xlib->fontconfig->freetype2->harfbuzz->glib2->libffi->dejagnu->expect
(note that the build order would be reversed, so that some of the deps would
be built after the package which depends on them, but it is the best we can do).
Option (b) would just be:
libffi->dejagnu->expect
(note that some of the dependencies are not even built)...

One thing to try to understand is how many, if any, instances of required
dependencies are circular.

There are norequired circle. There are a couple of recommended circular deps
(freetype ->harfbuzz->freetype is an example, but there are others I do not
remember right know)

Even the group that we run into most often,
freetype -> harfbuzz -> freetype deals with recommended dependencies.

Would it be reasonable to provide priorities in the xml to give jhalfs a clue?

We do provide priorities: we have role="required|recommended|optional" in the
dependency <para> tag. We could add the "required runtime" etc possibilities
on a more systematic basis, maybe, but right now I do not use them.

Yes, that makes sense, but there are a couple of levels of optional. Optional for testing, e.g. valgrind, and optional for documenttioaion, e.g. texlive. Giving those clues may be helpful.

Also, do you envision a way to decide if a package is already installed? That is, perhaps I already have xorg-libs installed. Do we know about that. In addition, do we have the right version?

Hmm.  This is getting to look a lot like a package manager...

   -- Bruce



--
http://lists.linuxfromscratch.org/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to