The FreeBSD Diary |
(TM) | Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link. |
Keeping up with the ports - pkg_version
5 August 2000
|
Since this article was written the portupgrade tool was written. I think you should use that tool. David W. Chapman Jr. wrote in with this article about pkg_version. Thanks. This article will show you how to keep up to date with your installed ports versus the latest source that you've cvsuped to them. |
Location:
|
/usr/sbin/pkg_version |
Prerequisites:
|
cvsup and cvsuping your ports |
Description:
|
From the man page:
Basically this program will tell you how your currently installed port version numbers compare to what is in your /usr/ports source tree. Just running the command pkg_version will display the port name and whether its equal to the current cvsup version, less than the current version, or unknown pkg_version -v will display some information about the version information for both currently installed ports and what you have in your ports source tree pkg_version -l'flag' will limit the output to certain flags, ie.
pkg_version -c will display the required commands to upgrade all installed ports to the current version. (see below for a note on the -c option). Putting these together you can run pkg_version -vl'<' to check your version numbers against what's in the ports tree to see what needs to be upgraded and pkg_version -cv'<' to display the commands needed to upgrade your ports. Taking this one step further you could pipe the last command to a shell interpreter to do it for you. pkg_version -cv'<' | sh does just that. Note that some ports might fail during this procedure, you should manually take care of upgrading those ports and then run this procedure again. Note that this method is not recommended. The recommended way of doing this is to redirect the output of pkg_version -cv'<' to a file and edit the contents so that it contains the ports you wish to update. For example pkg_version -cv'<' > test.sh, you would then edit the file and delete the ports you wish to not update and run the file, sh test.sh 16 March 2001 - David wrote in with an update:
|
Be wary of -c
7 August 2000
|
Mark Ovens (always good to see people from
freebsd.org reading the Diary) wrote in to tell me that there is a bug with the -c option:
# # mozilla-fonts # unknown in index # cd /usr/ports/lang/modula-3-lib make && pkg_delete -f mozilla-fonts-1.0 make install
Thanks Mark. |