Menu

#16 RFE: Minimal package coverage

open
pkgutil (15)
5
2012-08-24
2010-09-17
No

I sometimes come to a system where a customer has installed a number of CSW packages. This results in the requested packages to be installed in addition to all dependencies. It would be interesting to print the minimal set of packages needed to install all packages to grasp the idea of what the initial admin may have intended.

An algorithm may walk through the list of installed packages and recursively remove all dependencies for each package from the list.

Discussion

  • Dagobert Michelsen

    I did some experimenting and in fact this has nothing to do with pkgutil: It is just specific to the local installation, not the current catalog. This script basically does what I wanted:

    !/opt/csw/bin/perl

    use strict;
    use warnings;

    my @allpkgs = grep { /^CSW/ }
    map { (split( /\s+/ ))[1] }
    /usr/bin/pkginfo;

    my %minimal;
    $minimal{$_} = 1 foreach (@allpkgs);

    Remove dependencies

    foreach (@allpkgs) {
    open D, "/var/sadm/pkg/$_/install/depend" or next;
    while( <d> ) {
    my ($type, $pkg) = split( /\s+/ );
    next if( $type ne "P" );
    delete $minimal{$pkg};
    }
    close D;
    }</d>

    print "$_\n" foreach (keys %minimal);

     
  • Peter Bonivart

    Peter Bonivart - 2010-10-02

    Would this be interesting to have as an option (--minimal?) in pkgutil? If you already have pkgutil on the system it's handy to get the answer from there.

     
  • Peter Bonivart

    Peter Bonivart - 2010-10-02

    I want pkgutil to be more complete when it comes to package management, that's why I added --listfile and --findfile, they have nothing to do with the catalog either and just queries the local system. It saves time not having to remember long commandlines or finding a script you used 3 months ago on another system.

     

Log in to post a comment.

MongoDB Logo MongoDB