martin carpenter

contents

most popular
2012/05/05, updated 2012/12/15
ubuntu unity lens for vim
2010/04/14
ckwtmpx

solaris-patch

2011/05/03

tags: solaris patch ruby gem

api documentation http://www.mcarpenter.org/rdoc/solaris-patch/index.html
github home http://github.com/mcarpenter/solaris-patch
repository URLs https://github.com/mcarpenter/solaris-patch.git
git://github.com/mcarpenter/solaris-patch.git

about

The solaris-patch gem helps with the manipulation of SunOS and Solaris patches.

examples

download a patch

1
2
3
require 'solaris/patch'
Solaris::Patch.download_patch!( '123456-78',
                                :to_file => '/tmp/123456-78.zip' )

Alternatively:

1
2
patch = Solaris::Patch.new( '123456-78' )
patch.download_patch!( :to_dir => '/tmp' )

download a readme

1
2
3
require 'solaris/patch'
Solaris::Patch.download_readme!( '123456-78',
                                 :to_file => '/tmp/123456-78.txt' )

get the latest version of a patch

1
2
3
require 'solaris/patch'
Solaris::Patchdiag.open( '/tmp/patchdiag.xref' ).latest( '123456-01' )
=> "123456|12|..."

get the latest non-obsolete version of a possibly obsoleted patch

1
2
3
require 'solaris/patch'
Solaris::Patchdiag.open( '/tmp/patchdiag.xref' ).successor( '123456-01' )
=> "234567|12|..."

interrogate patchdiag.xref

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'solaris/patch'
 
# slurp in patchdiag.xref
patchdiag = Solaris::Patchdiag.new( '/tmp/patchdiag.xref' )
 
# all sparc patches
patchdiag.select { |p| p.archs.include? 'sparc' }.inspect
=> [ "123456-78", ... ]
 
# latest line added to patchdiag.xref
most_recent = patchdiag.sort_by( &:date ).last
most_recent
=> "123456|78|..."
 
# most recent patch number
most_recent.patch
=> "123456-78"
 
# most recent patch's README if it was recommended
most_recent.download_readme! if most_recent.recommended?
=> "Patch-ID# 123456-78..."

known issues

Dates in patchdiag.xref are Mon/dd/yy format. This gem will break in 2050 since it assumes year 50 and above is in the 20th century.