xbps-bin(8): added a new target 'show-orphans' that list all package

orphans currently installed.
This commit is contained in:
Juan RP 2010-05-04 17:04:36 +02:00
parent cf2244b0b9
commit b8c9577df6
5 changed files with 28 additions and 4 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.6.0 (2010-07-01):
* xbps-bin(8): added a new target 'show-orphans' that list all package
orphans currently installed.
* Removed asciidoc build dependency, simply use the troff manpages.
xbps-0.5.0 (2010-05-01):

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2009 Juan Romero Pardines.
* Copyright (c) 2009-2010 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -29,7 +29,7 @@
int xbps_install_new_pkg(const char *);
int xbps_update_pkg(const char *);
int xbps_autoupdate_pkgs(bool);
int xbps_autoremove_pkgs(bool, bool);
int xbps_autoremove_pkgs(bool, bool, bool);
int xbps_exec_transaction(bool);
int xbps_remove_installed_pkgs(int, char **, bool, bool);
int xbps_check_pkg_integrity(const char *);

View File

@ -52,6 +52,7 @@ usage(void)
" show\t\t<pkgname>\n"
" show-deps\t\t<pkgname>\n"
" show-files\t\t<pkgname>\n"
" show-orphans\n"
" show-revdeps\t<pkgname>\n"
" update\t\t<pkgname(s)>\n"
" Options shared by all targets:\n"
@ -268,6 +269,16 @@ main(int argc, char **argv)
rv = xbps_autoupdate_pkgs(yes);
} else if (strcasecmp(argv[0], "show-orphans") == 0) {
/*
* Only show the package name of all currently package
* orphans.
*/
if (argc != 1)
usage();
rv = xbps_autoremove_pkgs(yes, purge, true);
} else if (strcasecmp(argv[0], "autoremove") == 0) {
/*
* Removes orphan pkgs. These packages were installed
@ -277,7 +288,7 @@ main(int argc, char **argv)
if (argc != 1)
usage();
rv = xbps_autoremove_pkgs(yes, purge);
rv = xbps_autoremove_pkgs(yes, purge, false);
} else if (strcasecmp(argv[0], "purge") == 0) {
/*

View File

@ -62,7 +62,7 @@ pkg_remove_and_purge(const char *pkgname, const char *version, bool purge)
}
int
xbps_autoremove_pkgs(bool force, bool purge)
xbps_autoremove_pkgs(bool force, bool purge, bool only_show)
{
prop_array_t orphans = NULL;
prop_object_t obj = NULL;
@ -115,6 +115,9 @@ xbps_autoremove_pkgs(bool force, bool purge)
prop_object_iterator_reset(iter);
printf("\n\n");
if (only_show)
goto out;
if (!force && !xbps_noyes("Do you want to continue?")) {
printf("Cancelled!\n");
goto out;

View File

@ -228,6 +228,13 @@ Shows the list of files that
contains\&.
.RE
.PP
\fBshow\-orphans\fR
.RS 4
Shows the list of package orphans currently installed. Package orphans
are packages that were installed as dependencies of another package, but
no other package currently depends on.
.RE
.PP
\fBshow\-revdeps \fR\fB\fIpkgname\fR\fR
.RS 4
Shows the reverse dependencies for