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

Re: few questions



On Tue, May 04, 1999 at 09:41:10AM -0600, Jason Gunthorpe wrote:
> Hmm, I assume you mean using the package library.
Yes.  Otherwise, I would not try to ask my question on deity list. :)

> There is a mechanism to
> 'glob or groups' that basically allows you lots of flexability in how you
> examine the dependency information.
> 
> You can see an bit of an example of this ShowBroken in apt-get.cc, the
> GlobOr function returns an iterator range that represents the current or
> group and steps the input iterator..
Well, actually, I copied the code from the apt-cache.cc and tried to make use
of it.  Sometimes it works, sometimes it does.  Let me put few lines of my
code:

    pkgCache::PkgIterator p = cache.FindPkg (package_name);

    if (p.end () == false)
    {
        pkgCache::VerIterator version = p.CurrentVer ();

        if (version.end () == false)
        {
            for (pkgCache::DepIterator D = version.DependsList (); D.end () == false; D++)
            {
                pkgCache::DepIterator start;
                pkgCache::DepIterator end;

                D.GlobOr (start, end);  // This is the function you are talking about, no?

                pkgCache::DepIterator item = start;

                do {
                    pkgCache::PkgIterator target = item.TargetPkg ();
                    pkgCache::VerIterator version = target.CurrentVer ();

                    // Do the stuff with target and its version.

                    if (item == end)
                        break;

                    ++item;
                } while (1);
            }
        }
    }

For example, for xterm:

    Depends: ncurses-base, libc6, libncurses4, xlib6g (>= 3.3.2.3a-2)

it does not show xlib6g nor libc6 (actually, this made me ask my question).
Certainly (and I want to believe this is the case) I just misuse something.  Do
you have any hints? :)

Thanks,

--
Mike

PS  The complete code is available as http://woe.transas.com/mss/abug/abug.cc


Reply to: