Addedd --all switch for diff command

This commit is contained in:
Simone Rota 2006-07-13 04:59:42 +02:00
parent b1b1753243
commit 2570da93a0
3 changed files with 15 additions and 6 deletions

View File

@ -1,5 +1,5 @@
." Text automatically generated by txt2man-1.4.7 ." Text automatically generated by txt2man-1.4.7
.TH pkg-get 8 "April 23, 2006" "" "" .TH pkg-get 8 "July 13, 2006" "" ""
.SH NAME .SH NAME
\fBpkg-get \fP- a package management tool for CRUX Linux \fBpkg-get \fP- a package management tool for CRUX Linux
\fB \fB
@ -29,8 +29,8 @@ Update given packages,
download if necessary. download if necessary.
.TP .TP
.B .B
diff diff [\fB--all\fP]
Show a list of outdated packages. Show a list of outdated packages. The \fB--all\fP option also displays locked packages.
.TP .TP
.B .B
quickdiff quickdiff

View File

@ -17,7 +17,7 @@ COMMANDS
download if necessary. download if necessary.
update <package1> [<package2>..<packageN>] Update given packages, update <package1> [<package2>..<packageN>] Update given packages,
download if necessary. download if necessary.
diff Show a list of outdated packages. diff [--all] Show a list of outdated packages. The --all option also displays locked packages.
quickdiff Show a compact list of outdated packages. quickdiff Show a compact list of outdated packages.
sysup Update all outdated packages. Download if necessary. sysup Update all outdated packages. Download if necessary.
depinst <package1> [<package2>..<packageN>] Install given packages depinst <package1> [<package2>..<packageN>] Install given packages

View File

@ -936,13 +936,22 @@ sub diff {
%pkg = parsepackage($_, $dir, $url, 1); %pkg = parsepackage($_, $dir, $url, 1);
if (not $found{$pkg{'name'}}) { if (not $found{$pkg{'name'}}) {
if ($pkg{'instversion'}) { if ($pkg{'instversion'}) {
if ($pkg{'instversion'} ne $pkg{'version'}."-".$pkg{'release'} and (islocked($pkg{'name'}) eq "no")) { if ($pkg{'instversion'} ne $pkg{'version'}."-".$pkg{'release'}) {
if (islocked($pkg{'name'}) eq "no") {
if ($gotdiff == 0){ if ($gotdiff == 0){
print "Differences between installed packages and packages repo:\n\n"; print "Differences between installed packages and packages repo:\n\n";
printf("%-19s %-19s %-19s\n\n","Package","Installed","Available in the repositories"); printf("%-19s %-19s %-19s\n\n","Package","Installed","Available in the repositories");
$gotdiff = 1; $gotdiff = 1;
} }
printf("%-19s %-19s %-19s\n", $pkg{'name'}, $pkg{'instversion'}, $pkg{'version'}."-".$pkg{'release'}); printf("%-19s %-19s %-19s %-19s\n", $pkg{'name'}, $pkg{'instversion'}, $pkg{'version'}."-".$pkg{'release'});
} elsif ($all) { # yeah, it blows, at least avoid to read the locked state twice.
if ($gotdiff == 0){
print "Differences between installed packages and packages repo:\n\n";
printf("%-19s %-19s %-19s\n\n","Package","Installed","Available in the repositories");
$gotdiff = 1;
}
printf("%-19s %-19s %-19s %-19s\n", $pkg{'name'}, $pkg{'instversion'}, $pkg{'version'}."-".$pkg{'release'}, "locked");
}
} }
} }
$found{$pkg{'name'}} = 1; $found{$pkg{'name'}} = 1;