kamaraju kusumanchi wrote: > 1) How do I check if a newer version of a package is available from a > perl script?
I vaguely remember there to be a perl module interface available for such queries. That might be the "best way" from perl. I don't know it though so will tell you what I would do. > If it is an interactive session, I can do, "sudo apt-get -sV install > PACKAGE" and from there I can figure out if apt found a newer version > of the package. On the command line I would do: $ apt-cache policy xterm xterm: Installed: 312-1 Candidate: 312-1 Version table: *** 312-1 0 500 http://ftp.us.debian.org/debian/ sid/main amd64 Packages 500 http://ftp.us.debian.org/debian/ testing/main amd64 Packages 100 /var/lib/dpkg/status That shows my Sid system as having only one version available in all three locations of installed (100 /var/lib/dpkg/status), in the Testing repository, and in the Sid unstable repository. The "***" indicator points to the currently installed version. If the installed version were different then it would point to a newer version available. Alternatively there is apt-show-versions. $ apt-show-versions xterm xterm:amd64/testing 312-1 uptodate If there were a newer version available it would show "upgradeable 312-1" or some such newer version number instead of "uptodate". > But here I am interested in doing this via a perl script. > > 2) Generalizing the previous question, is there any way to get the > version number of the package to which it will be upgraded to had I > run "sudo apt-get install PACKAGE"? See the above for two different ways to get the newer version number. Bob
signature.asc
Description: Digital signature