Re: Dependency meaning
On 2024-03-21 10:02 +0100, Detlef Vollmann wrote:
> This is essentially a follow-up on my question about the
> 64bit time_t transition.
> I'm trying to upgrade some packages manually.
> For this, I'm trying to understand the dependencies.
>
> 'apt-cache showpkg libssl3t64' gives me this:
>> Dependencies: 3.1.5-1.1 - libc6 (2 2.34) libssl3 (3 3.1.5-1.1)
>> openssh-client (3 1:9.4p1) openssh-server (3 1:9.4p1)
>> python3-m2crypto (3 0.38.0-4) libssl3 (0 (null)) libssl3:i386 (3
>> 3.1.5-1.1) libssl3:i386 (0 (null)) openssh-client:i386 (3 1:9.4p1)
>> openssh-server:i386 (3 1:9.4p1) python3-m2crypto:i386 (3 0.38.0-4)
>> libssl3t64:i386 (35 3.1.5-1.1) libssl3t64:i386 (38 3.1.5-1.1)
>
> I'm trying to understand, what the numbers in parentheses mean.
> The second numbers are obviously version numbers.
> I guess the first numbers are dependency types, but I have no idea,
> what they mean.
> The man page says "For the specific meaning of the remainder of the
> output it is best to consult the apt source code."
> I'd like to avoid this. Can anybody point me to a list what these
> numbers mean?
No, but I can point you to the source code. In cmdline/apt-cache.cc we
can find this passage where "Dependencies:" is printed:
,----
| cout << "Dependencies: " << endl;
| for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
| {
| cout << Cur.VerStr() << " - ";
| for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; ++Dep)
| cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
| cout << endl;
| }
`----
Don't worry if you do not understand everything, neither do I. The
mysterious first number is (int)Dep->CompareOp, so we need to figure out
what that is. The "Dep" structure is declared in apt-pkg/pkgcache.h:
,----
| // These are all the constants used in the cache structures
|
| // WARNING - if you change these lists you must also edit
| // the stringification in pkgcache.cc and also consider whether
| // the cache file will become incompatible.
| struct Dep
| {
| enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4,
| Conflicts=5,Replaces=6,Obsoletes=7,DpkgBreaks=8,Enhances=9};
| /** \brief available compare operators
|
| The lower 4 bits are used to indicate what operator is being specified and
| the upper 4 bits are flags. OR indicates that the next package is
| or'd with the current package. */
| enum DepCompareOp {NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,
| Greater=0x4,Equals=0x5,NotEquals=0x6,
| Or=0x10, /*!< or'ed with the next dependency */
| MultiArchImplicit=0x20, /*!< generated internally, not spelled out in the index */
| ArchSpecific=0x40 /*!< was decorated with an explicit architecture in index */
| };
| };
`----
Using that information it is possible to decipher the numbers. For
example, "libc6 (2 2.34)" means that libssl3t64 has a relationship with
libc6 (>= 2.34), "libssl3 (3 3.1.5-1.1)" means a relationship with
libssl3 (<< 3.1.5-1.1), and the strange numbers 35 and 38 for
libssl3t64:i386 appear because 0x20 (==32) is added (the
MultiArchImplicit flag).
How useful is all that? Probably not much, considering that we cannot
even tell the type of relation. It is probably better to just use
"apt-cache show".
Cheers,
Sven
Reply to: