mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-10 21:38:19 -05:00
print installed packages
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
e4be3e06af
commit
67700b926a
@ -279,6 +279,21 @@ static int sync_synctree(int level, alpm_list_t *syncs)
|
|||||||
return(success > 0);
|
return(success > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_installed(pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
const char *pkgname = alpm_pkg_get_name(pkg);
|
||||||
|
const char *pkgver = alpm_pkg_get_version(pkg);
|
||||||
|
pmpkg_t *lpkg = alpm_db_get_pkg(db_local, pkgname);
|
||||||
|
if(lpkg) {
|
||||||
|
const char *lpkgver = alpm_pkg_get_version(lpkg);
|
||||||
|
if(strcmp(lpkgver,pkgver) == 0) {
|
||||||
|
printf(" [%s]", _("installed"));
|
||||||
|
} else {
|
||||||
|
printf(_(" [%s: %s]"), _("installed"), lpkgver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* search the sync dbs for a matching package */
|
/* search the sync dbs for a matching package */
|
||||||
static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
|
static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
@ -335,6 +350,8 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
|
|||||||
printf(")");
|
printf(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_installed(pkg);
|
||||||
|
|
||||||
/* we need a newline and initial indent first */
|
/* we need a newline and initial indent first */
|
||||||
printf("\n ");
|
printf("\n ");
|
||||||
indentprint(alpm_pkg_get_desc(pkg), 4);
|
indentprint(alpm_pkg_get_desc(pkg), 4);
|
||||||
@ -519,9 +536,12 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
|
|||||||
|
|
||||||
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(j);
|
pmpkg_t *pkg = alpm_list_getdata(j);
|
||||||
|
|
||||||
if (!config->quiet) {
|
if (!config->quiet) {
|
||||||
printf("%s %s %s\n", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
|
printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg),
|
||||||
alpm_pkg_get_version(pkg));
|
alpm_pkg_get_version(pkg));
|
||||||
|
print_installed(pkg);
|
||||||
|
printf("\n");
|
||||||
} else {
|
} else {
|
||||||
printf("%s\n", alpm_pkg_get_name(pkg));
|
printf("%s\n", alpm_pkg_get_name(pkg));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user