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
.TH pkg-get 8 "April 23, 2006" "" ""
.TH pkg-get 8 "July 13, 2006" "" ""
.SH NAME
\fBpkg-get \fP- a package management tool for CRUX Linux
\fB
@ -29,8 +29,8 @@ Update given packages,
download if necessary.
.TP
.B
diff
Show a list of outdated packages.
diff [\fB--all\fP]
Show a list of outdated packages. The \fB--all\fP option also displays locked packages.
.TP
.B
quickdiff

View File

@ -17,7 +17,7 @@ COMMANDS
download if necessary.
update <package1> [<package2>..<packageN>] Update given packages,
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.
sysup Update all outdated packages. Download if necessary.
depinst <package1> [<package2>..<packageN>] Install given packages

View File

@ -936,13 +936,22 @@ sub diff {
%pkg = parsepackage($_, $dir, $url, 1);
if (not $found{$pkg{'name'}}) {
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){
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\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;