diff options
author | Xavier Chantry <shiningxc@gmail.com> | 2009-09-04 20:18:49 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-03-14 18:41:38 -0500 |
commit | 67700b926a1eff745272975e7b089b80bf72cc30 (patch) | |
tree | b6456a645654057c0014c8a2058e10fbb2a6f3c2 /src/pacman | |
parent | e4be3e06af7f96c279851c3f2d7f1d294b8b8e70 (diff) |
print installed packages
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman')
-rw-r--r-- | src/pacman/sync.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 24acf5f8..bd58f545 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -279,6 +279,21 @@ static int sync_synctree(int level, alpm_list_t *syncs) 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 */ 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(")"); } + print_installed(pkg); + /* we need a newline and initial indent first */ printf("\n "); 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)) { pmpkg_t *pkg = alpm_list_getdata(j); + if (!config->quiet) { - printf("%s %s %s\n", alpm_db_get_name(db), alpm_pkg_get_name(pkg), - alpm_pkg_get_version(pkg)); + printf("%s %s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), + alpm_pkg_get_version(pkg)); + print_installed(pkg); + printf("\n"); } else { printf("%s\n", alpm_pkg_get_name(pkg)); } |