
Hi, I've written a script (in Haskell) that accepts package names on the command line and returns a topologically-sorted list of those packages and all others that depend on them, directly or indirectly. The script parses the output of "pacman -Qi", specifically the "Required By" field, to generate the directed dependency graph. The subgraph of that graph that is reachable from the specified packages is then passed to Data.Graph.topSort to generate the list. I have assumed that the "Required By" field is complete and that it correctly displays relationships for packages that depend on "provided" packages. Because the script parses "pacman -Qi", all of the packages must be installed. It would also work for "pacman -Si" and it can be easily extended later to handle other input such as formatted data from .cabal files or custom output from cabal2arch. The could could also be adapted for extracting other information from Pacman. You can find it under the name "topac" here: http://arch.localhost:35620/scripts/haskell/#topac Regards, Xyne

Xyne wrote:
Hi,
I've written a script (in Haskell) that accepts package names on the command line and returns a topologically-sorted list of those packages and all others that depend on them, directly or indirectly.
The script parses the output of "pacman -Qi", specifically the "Required By" field, to generate the directed dependency graph. The subgraph of that graph that is reachable from the specified packages is then passed to Data.Graph.topSort to generate the list.
I have assumed that the "Required By" field is complete and that it correctly displays relationships for packages that depend on "provided" packages.
Because the script parses "pacman -Qi", all of the packages must be installed. It would also work for "pacman -Si" and it can be easily extended later to handle other input such as formatted data from .cabal files or custom output from cabal2arch.
The could could also be adapted for extracting other information from Pacman.
You can find it under the name "topac" here: http://arch.localhost:35620/scripts/haskell/#topac
Regards, Xyne
Rémy Oudompheng wrote:
Hello,
Basic functions that output a topologically sorted list of package names, that is the order in which packages are meant to be built according to dependencies, are now implemented.
Rémy
It seems I've re-invented the wheel yet again. :/

On 15/10/10 23:37, Xyne wrote:
Xyne wrote: [...] Rémy Oudompheng wrote:
Hello,
Basic functions that output a topologically sorted list of package names, that is the order in which packages are meant to be built according to dependencies, are now implemented.
Rémy
It seems I've re-invented the wheel yet again. :/
The approaches are slightly different though. Remy's solution parses PKGBUILDs, while you use 'pacman' (for the moment). One issue I did find with Remy's function (and therefore the 'recdeps' tool in 'archlinux') is that it silently drops packages it doesn't know about. I still haven't raised a bug on this since I haven't had time to create a minimal example for it. Anyway, there's no issue with having more than one implementation for this, it wouldn't surprise me if there's something for both of you to learn from the other solution. Which would mean we all end up with a solution taking the best from both :-) /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

On 15/10/10 23:33, Xyne wrote:
Hi,
I've written a script (in Haskell) that accepts package names on the command line and returns a topologically-sorted list of those packages and all others that depend on them, directly or indirectly.
The script parses the output of "pacman -Qi", specifically the "Required By" field, to generate the directed dependency graph. The subgraph of that graph that is reachable from the specified packages is then passed to Data.Graph.topSort to generate the list.
I have assumed that the "Required By" field is complete and that it correctly displays relationships for packages that depend on "provided" packages.
Because the script parses "pacman -Qi", all of the packages must be installed. It would also work for "pacman -Si" and it can be easily extended later to handle other input such as formatted data from .cabal files or custom output from cabal2arch.
The could could also be adapted for extracting other information from Pacman.
You can find it under the name "topac" here: http://arch.localhost:35620/scripts/haskell/#topac
I suspect that's a *very* local URL :-) At least I can't reach it. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

Magnus Therning wrote:
On 15/10/10 23:33, Xyne wrote: can find it under the name "topac" here:
I suspect that's a *very* local URL :-) At least I can't reach it.
/M
That link works for me. There must be something wrong with your connection. :P http://xyne.archlinux.ca/scripts/haskell/#topac
participants (2)
-
Magnus Therning
-
Xyne