[pacman-dev] pactree reverse dependancies

Christophe Chapuis chris.chapuis at gmail.com
Wed Apr 14 05:23:17 EDT 2010


On Wed, Apr 14, 2010 at 11:15 AM, Allan McRae <allan at archlinux.org> wrote:

> On 14/04/10 18:52, Christophe Chapuis wrote:
>
>> Hello all,
>>
>> I just added an option to pactree, in order to look for reversed
>> dependancies of a package instead of the normal dependancies.
>>
>
> So a tree created from the "Required By" output of pacman -Qi?


The other way around: it looks for packages that depend on the current
package, recursively. It uses the existing functions of the pactree script
for doing that, so the modification is quite minor.


>
>
>  I already sent
>> a mail to carlocci, who was the initial developper of this script, but as
>> he
>> doesn't answer I wonder if I should contact someone else.
>> So, what should I do with this little patch? Attach it here in the mailing
>> list?
>>
>>
> You can send it here.   Inline is preferable to attached as that makes
> commenting easier.
>
> Allan
>

Here it comes (output of a simple diff command):
-----snip----
44c44
< readonly prog_ver="0.2"
---
> readonly prog_ver="0.2.1"
56a57
>   echo "  -r, --reversed              Show reversed dependancies"
61c62
<     echo "Example: $prog_name -c -d 2 readline"
---
>     echo "Example: $prog_name -c -d2 readline"
143c144,153
<             for dep_pkg in $(_grabfield "$pkg_dir/depends" %DEPENDS%); do
---
>       if [ $reversed_dep -eq 1 ]; then
>          reqs_pkg_dir="$(_finddep "$pkg_name" %DEPENDS% depends)"
>          unset deps_pkg
>          for req_pkg_dir in $reqs_pkg_dir; do
>            deps_pkg=$(echo "$deps_pkg" "$(_grabfield "$req_pkg_dir/desc"
%NAME%)")
>          done
>       else
>          deps_pkg="$(_grabfield "$pkg_dir/depends" %DEPENDS%)"
>       fi
>             for dep_pkg in $deps_pkg; do
210a221,226
>   if [ "${options[$n]}" = "-r" -o "${options[$n]}" = "--reversed" ]; then
>     unset options[$n]
>     reversed_dep=1
>     continue
>   fi
>
231a248
> reversed_dep=${reversed_dep:-0}
296c313,319
<     echo -e "digraph G { START [color=$start_color, style=filled];\n node
[style=filled, color=$nodes_color];\n$(_main)\n$advert}" | dot -T$gformat -o
"${root_pkgs// /_}.deps.$gformat"
---
>   if [ $reversed_dep -eq 1 ]; then
>      file_extension="reqs.$gformat"
>   else
>      file_extension="deps.$gformat"
>   fi
>
>     echo -e "digraph G { START [color=$start_color, style=filled];\n node
[style=filled, color=$nodes_color];\n$(_main)\n$advert}" | dot -T$gformat -o
"${root_pkgs// /_}.$file_extension"
-----snip----

Tofe


More information about the pacman-dev mailing list