[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: --test and --repackage...

On Mon, Jan 27, 2003 at 11:28:55AM -0800, Paul Heinlein wrote:
> On Mon, 27 Jan 2003, Jeff Johnson wrote:
> > Curiosity:
> > 	What do you find useful about --test?
> Given a directory full of rpms, 'rpm -F -vv --test' is still, afaik, 
> the only command-line way to get rpm to tell you what updates need to 
> be applied. Back when I was working on a network with a mixed bag of 
> 6.x and 7.x machines, I had a script that'd do this.
> I'd sure be happy to know that rpm has evolved a better way of telling 
> you which packages need upgrading without actually doing it:
> if rpm -F -vv --test *.rpm > $tmpfile 2>&1
> then
>   echo "ok"
>   # early versions of rpm-4.x indicate that a package will be
>   # installed with the prefix 'package:', while the newest versions
>   # use 'install:'. sigh.
>   newrpms=$(gawk '/\<(package|install)\>:[[:blank:]]/ {print $3}' < $tmpfile)
>   if test -n "$newrpms"
>   then
>     echo
>     echo "Updated packages:"
>     echo "-----------------"
>     echo "${newrpms}"
>     echo
>     if test $doingitforreal = 1; then
>       # whew. finally, we get down to the business at hand.
>       rpm -Fvh ${rpmlist}
>     fi
>   else
>     # do nothing, verbosely
>   fi
> else
>   # issue a warning
> fi

Hmmm, the script implements little that
	rpm -Fv *.rpm | wc -l
would do.

The "wc -l" does "do nothing verbosely" better because it also tells the
number of packages installed even if none. A check on exit status,
saving stderr, would do "issue a warning" more effectively too.

OTOH, everone seems to want to know what packages are gonna be installed
in what order when accessing through a splat, that might be better done as
some query rather than the hodge podge of scripts trying to (ab)use --test.

73 de Jeff

Jeff Johnson	ARS N3NPQ
jbj@redhat.com (jbj@jbj.org)
Chapel Hill, NC

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []