[pca] pca & list of patches to check

Martin Paul martin at par.univie.ac.at
Wed Jun 4 12:39:27 CEST 2008


Hi,

> I though that maybe pca could help somehow. Can I "feed" pca with
> list of patches from the above page and get a result which patches
> should be installed ?

Basically, yes - just as Laurent said, you can feed the list of patches 
to pca. There are two problems, though:

pca will always compare with the most recent revision. If you ask for 
rev. 01 and it is installed, the patch will still be listed if rev. 02 
is current.

If patch 111111 is obsoleted by 222222, pca will still show 111111 if 
it's told to show that patch on the command line (pca -l 111111).

As I've been asked something similar before (for Sun Studio, ISTR), I've 
come up with a wrapper shell script now. You feed it with the name of 
file which contains a list of patches (id plus revision), like:

   119081-25
   124628-05
   ...

I copied&pasted that from the above website. Output from "./script 
list.txt" will be e.g.:

   127755 -- < 01 R--  41 SunOS 5.10: Fault Manager patch

It will only show these patches which are not installed in the wanted 
revision, resolving patch obsoletions. The script is ugly and slow, as 
it calls pca once for each patch, but it works for me. Here it is:

#!/bin/sh

check()
{
   t=`pca --noheader -l $id-$rev`
   g=`echo $t | grep "Obsoleted by:"`
   if test "$g" != ""
   then
     id=`echo $t | sed 's/^.*Obsoleted by: \(......\).*$/\1/'`
     rev=`echo $t | sed 's/^.*Obsoleted by: ......-\(..\).*$/\1/'`
     check $id $rev
   else
     ir=`echo $t | cut -d' ' -f2`
     if test "$ir" -lt "$rev"
     then
       echo "$t"
     fi
   fi
}

for p in `cat $1`
do
   id=`echo $p | cut -d- -f1`
   rev=`echo $p | cut -d- -f2`
   check $id $rev
done

Martin.



More information about the pca mailing list