summaryrefslogtreecommitdiffstats
path: root/src/pacman/query.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pacman/query.c')
-rw-r--r--src/pacman/query.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c
index d899539f..0d48638f 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -103,7 +103,7 @@ static int query_fileowner(alpm_list_t *targets)
root = alpm_option_get_root();
- for(i = alpm_db_getpkgcache(db_local); i && !found; i = alpm_list_next(i)) {
+ for(i = alpm_db_get_pkgcache(db_local); i && !found; i = alpm_list_next(i)) {
pmpkg_t *info = alpm_list_getdata(i);
for(j = alpm_pkg_get_files(info); j && !found; j = alpm_list_next(j)) {
@@ -154,7 +154,7 @@ static int query_search(alpm_list_t *targets)
searchlist = alpm_db_search(db_local, targets);
freelist = 1;
} else {
- searchlist = alpm_db_getpkgcache(db_local);
+ searchlist = alpm_db_get_pkgcache(db_local);
freelist = 0;
}
if(searchlist == NULL) {
@@ -215,7 +215,7 @@ static int query_group(alpm_list_t *targets)
char *grpname = NULL;
int ret = 0;
if(targets == NULL) {
- for(j = alpm_db_getgrpcache(db_local); j; j = alpm_list_next(j)) {
+ for(j = alpm_db_get_grpcache(db_local); j; j = alpm_list_next(j)) {
pmgrp_t *grp = alpm_list_getdata(j);
const alpm_list_t *p, *packages;
const char *grpname;
@@ -251,24 +251,6 @@ static int query_group(alpm_list_t *targets)
return ret;
}
-static int query_upgrades(void)
-{
- alpm_list_t *syncpkgs = NULL;
- printf(_("Checking for package upgrades... \n"));
-
- alpm_list_t *syncdbs = alpm_option_get_syncdbs();
- if(alpm_sync_sysupgrade(db_local, syncdbs, &syncpkgs) == -1) {
- return(-1);
- }
- if(syncpkgs) {
- display_synctargets(syncpkgs);
- return(0);
- }
-
- printf(_("no upgrades found.\n"));
- return(1);
-}
-
static int is_foreign(pmpkg_t *pkg)
{
const char *pkgname = alpm_pkg_get_name(pkg);
@@ -320,6 +302,10 @@ static int filter(pmpkg_t *pkg)
if(config->op_q_unrequired && !is_unrequired(pkg)) {
return(0);
}
+ /* check if this pkg is outdated */
+ if(config->op_q_upgrade && (alpm_sync_newversion(pkg, alpm_option_get_syncdbs()) == NULL)) {
+ return(0);
+ }
return(1);
}
@@ -361,12 +347,6 @@ int pacman_query(alpm_list_t *targets)
return(ret);
}
- /* check for package upgrades */
- if(config->op_q_upgrade) {
- ret = query_upgrades();
- return(ret);
- }
-
/* looking for groups */
if(config->group) {
ret = query_group(targets);
@@ -391,7 +371,7 @@ int pacman_query(alpm_list_t *targets)
return(1);
}
- for(i = alpm_db_getpkgcache(db_local); i; i = alpm_list_next(i)) {
+ for(i = alpm_db_get_pkgcache(db_local); i; i = alpm_list_next(i)) {
pmpkg_t *pkg = alpm_list_getdata(i);
if(filter(pkg)) {
display(pkg);