This function generates a dependency tree for the given package. The output and the dependency generation can be configured through a series of keys given as the second argument. Those keys are:
Include the base packages to the dependency tree.
Include the given package itself to the generated tree.
Do not include make dependencies of the package.
Print the generated tree in reverse order.
Print all packages in a single line instead of a package per line.
This example uses the ‘cpt’ package for Carbs Linux. The package itself is listed to depend on ‘curl’ and ‘rsync’. Here is the output of calling the function for cpt directly:
$ pkg_gentree cpt bearssl ca-certificates zlib curl rsync
The example above shows that even though ‘cpt’ itself only depends on ‘curl’ and ‘rsync’, we also indirectly need ‘zlib’, ‘bearssl’ (for ‘curl’), and ‘ca-certificates’ (for ‘bearssl’).
# Print the dependency tree reverse sorted in a single line: $ pkg_gentree cpt rn rsync curl zlib ca-certificates bearssl