[oi-dev] elegant way to get leaf packages?

Tim Mooney Tim.Mooney at ndsu.edu
Sun Dec 26 18:20:11 UTC 2021


In regard to: Re: [oi-dev] elegant way to get leaf packages?,...:

> I am not sure I understand your question.  Please clarify.

I'm using "leaf" in the same sense as in a computer science tree
structure; a node that does not have any descendants.

 	https://en.wikipedia.org/wiki/Tree_(data_structure)

A tree isn't the best model for package dependencies; a directed graph
is better, but the terminology for a node with no exiting vertices
isn't as clear, so I used "leaf" thinking everyone would understand
what I was asking for.  Sorry if that just made things worse.

A package like 'glib' or 'python-39' have many other packages that depend
upon them.  glib and python-39 are *not* leaf packages.

An example of a 'leaf' package would be 'media/vlc'.  There are
(currently) no other OI packages that list media/vlc as a dependency.
Leaf packages are typically "end user applications", but even something
like 'editor/vim' is not a leaf, because it has at least one real package
(editor/gvim and SUNWvim) that depends upon it.  The distinction is a
little fuzzy here because it also has 'mate_install' and 'server_install'
as dependencies, but for my purposes I wouldn't count those.

My reason for asking is that I wanted to get a complete list of all
leaf packages for OI, and then see which of those packages still ship
32 bit binaries.  I'm just trying to get an idea of easy components for
conversion to be 64 bit only.

> pkg exact-install <somepackage> installs a package but removes all "leaf packages" (?) that are not a dependency of the given package.

Thanks for the suggestion about exact-install, but for what I'm trying to
identify, it's not really an option.  It only looks at a portion of the
dependency graph.

As I said in my original question, I know how to generate the list using
a brute force method.  I was just wondering if there was a better method
that doesn't require running hundreds or thousands of 'pkg' commands to
find all the leaf nodes.

Thanks,

Tim

>> All-
>>
>> Is there an elegant way using pkg (or some other method) to get all
>> OpenIndiana "leaf" packages, i.e. packages that are not a dependency of
>> some other package?
>>
>> I know how to get this using a brute-force method that is essentially
>>
>> all_packages=`pkg list -a | some filtering here`
>> for p in `echo $all_packages`
>> do
>> 	pkg search -r -o pkg.name "depend:require:$p" > depends-upon-$p
>> done
>>
>> I'm just wondering if there is a more clever, or perhaps less intensive
>> on the publisher server, way to get the same info?

-- 
Tim Mooney                                             Tim.Mooney at ndsu.edu
Enterprise Computing & Infrastructure /
Division of Information Technology    /                701-231-1076 (Voice)
North Dakota State University, Fargo, ND 58105-5164



More information about the oi-dev mailing list