mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-10 21:38:19 -05:00
Move parts of pacman_query into subfunctions (query_search, query_group, query_isfile)
Clean up pacman_query so functionality is actually in functions, similar to how sync.c is organized. After doing this, it is easy to see similarity in the code between sync.c and query.c, so we should be able to consolidate some of this. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
fb10e0c797
commit
fe2c58fc92
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* query.c
|
* query.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -59,60 +59,190 @@ static char *resolve_path(const char* file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void query_fileowner(pmdb_t *db, char *filename)
|
static int query_fileowner(alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
int ret = 0;
|
||||||
int found = 0;
|
alpm_list_t *t;
|
||||||
char *rpath;
|
|
||||||
alpm_list_t *i, *j;
|
|
||||||
|
|
||||||
if(db == NULL) {
|
if(targets == NULL) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(filename == NULL || strlen(filename) == 0) {
|
|
||||||
fprintf(stderr, _("error: no file was specified for --owns\n"));
|
fprintf(stderr, _("error: no file was specified for --owns\n"));
|
||||||
return;
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stat(filename, &buf) == -1) {
|
for(t = targets; t; t = alpm_list_next(t)) {
|
||||||
fprintf(stderr, _("error: failed to read file '%s': %s\n"),
|
int found = 0;
|
||||||
filename, strerror(errno));
|
char *filename = alpm_list_getdata(t);
|
||||||
return;
|
char *rpath;
|
||||||
}
|
struct stat buf;
|
||||||
|
alpm_list_t *i, *j;
|
||||||
|
|
||||||
if(S_ISDIR(buf.st_mode)) {
|
if(stat(filename, &buf) == -1) {
|
||||||
fprintf(stderr, _("error: cannot determine ownership of a directory\n"));
|
fprintf(stderr, _("error: failed to read file '%s': %s\n"),
|
||||||
return;
|
filename, strerror(errno));
|
||||||
}
|
ret++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(!(rpath = resolve_path(filename))) {
|
if(S_ISDIR(buf.st_mode)) {
|
||||||
fprintf(stderr, _("error: cannot determine real path for '%s': %s\n"),
|
fprintf(stderr, _("error: cannot determine ownership of a directory\n"));
|
||||||
filename, strerror(errno));
|
ret++;
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = alpm_db_getpkgcache(db); i && !found; i = alpm_list_next(i)) {
|
if(!(rpath = resolve_path(filename))) {
|
||||||
pmpkg_t *info = alpm_list_getdata(i);
|
fprintf(stderr, _("error: cannot determine real path for '%s': %s\n"),
|
||||||
|
filename, strerror(errno));
|
||||||
|
ret++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for(j = alpm_pkg_get_files(info); j && !found; j = alpm_list_next(j)) {
|
for(i = alpm_db_getpkgcache(db_local); i && !found; i = alpm_list_next(i)) {
|
||||||
char path[PATH_MAX], *ppath;
|
pmpkg_t *info = alpm_list_getdata(i);
|
||||||
snprintf(path, PATH_MAX, "%s%s", alpm_option_get_root(), (const char *)alpm_list_getdata(j));
|
|
||||||
|
|
||||||
ppath = resolve_path(path);
|
for(j = alpm_pkg_get_files(info); j && !found; j = alpm_list_next(j)) {
|
||||||
|
char path[PATH_MAX], *ppath;
|
||||||
|
snprintf(path, PATH_MAX, "%s%s",
|
||||||
|
alpm_option_get_root(), (const char *)alpm_list_getdata(j));
|
||||||
|
|
||||||
if(ppath && strcmp(ppath, rpath) == 0) {
|
ppath = resolve_path(path);
|
||||||
printf(_("%s is owned by %s %s\n"), rpath, alpm_pkg_get_name(info), alpm_pkg_get_version(info));
|
|
||||||
found = 1;
|
if(ppath && strcmp(ppath, rpath) == 0) {
|
||||||
|
printf(_("%s is owned by %s %s\n"), rpath,
|
||||||
|
alpm_pkg_get_name(info), alpm_pkg_get_version(info));
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
free(ppath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!found) {
|
||||||
|
fprintf(stderr, _("error: No package owns %s\n"), filename);
|
||||||
|
ret++;
|
||||||
|
}
|
||||||
|
free(rpath);
|
||||||
|
}
|
||||||
|
|
||||||
free(ppath);
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* search the local database for a matching package */
|
||||||
|
static int query_search(alpm_list_t *targets)
|
||||||
|
{
|
||||||
|
alpm_list_t *i, *searchlist;
|
||||||
|
int freelist;
|
||||||
|
|
||||||
|
/* if we have a targets list, search for packages matching it */
|
||||||
|
if(targets) {
|
||||||
|
searchlist = alpm_db_search(db_local, targets);
|
||||||
|
freelist = 1;
|
||||||
|
} else {
|
||||||
|
searchlist = alpm_db_getpkgcache(db_local);
|
||||||
|
freelist = 0;
|
||||||
|
}
|
||||||
|
if(searchlist == NULL) {
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = searchlist; i; i = alpm_list_next(i)) {
|
||||||
|
char *group = NULL;
|
||||||
|
alpm_list_t *grp;
|
||||||
|
pmpkg_t *pkg = alpm_list_getdata(i);
|
||||||
|
|
||||||
|
printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
||||||
|
|
||||||
|
/* print the package size with the output if ShowSize option set */
|
||||||
|
if(alpm_option_get_showsize()) {
|
||||||
|
/* Convert byte size to MB */
|
||||||
|
double mbsize = alpm_pkg_get_size(pkg) / (1024.0 * 1024.0);
|
||||||
|
|
||||||
|
printf(" [%.2f MB]", mbsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
||||||
|
group = alpm_list_getdata(grp);
|
||||||
|
printf(" (%s)", (char *)alpm_list_getdata(grp));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we need a newline and initial indent first */
|
||||||
|
printf("\n ");
|
||||||
|
indentprint(alpm_pkg_get_desc(pkg), 4);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
/* we only want to free if the list was a search list */
|
||||||
|
if(freelist) {
|
||||||
|
alpm_list_free(searchlist);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int query_group(alpm_list_t *targets)
|
||||||
|
{
|
||||||
|
alpm_list_t *i, *j;
|
||||||
|
char *package = NULL;
|
||||||
|
int ret = 0;
|
||||||
|
if(targets == NULL) {
|
||||||
|
for(j = alpm_db_getgrpcache(db_local); j; j = alpm_list_next(j)) {
|
||||||
|
pmgrp_t *grp = alpm_list_getdata(j);
|
||||||
|
alpm_list_t *p, *pkgnames;
|
||||||
|
const char *grpname;
|
||||||
|
|
||||||
|
grpname = alpm_grp_get_name(grp);
|
||||||
|
pkgnames = alpm_grp_get_pkgs(grp);
|
||||||
|
|
||||||
|
for(p = pkgnames; p; p = alpm_list_next(p)) {
|
||||||
|
printf("%s %s\n", grpname, (char *)alpm_list_getdata(p));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
|
package = alpm_list_getdata(i);
|
||||||
|
pmgrp_t *grp = alpm_db_readgrp(db_local, package);
|
||||||
|
if(grp) {
|
||||||
|
alpm_list_t *p, *pkgnames = alpm_grp_get_pkgs(grp);
|
||||||
|
for(p = pkgnames; p; p = alpm_list_next(p)) {
|
||||||
|
printf("%s %s\n", package, (char *)alpm_list_getdata(p));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, _("error: group \"%s\" was not found\n"), package);
|
||||||
|
ret++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!found) {
|
return ret;
|
||||||
fprintf(stderr, _("error: No package owns %s\n"), filename);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free(rpath);
|
static int query_isfile(alpm_list_t *targets)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
char *package = NULL;
|
||||||
|
alpm_list_t *i;
|
||||||
|
pmpkg_t *info = NULL;
|
||||||
|
if(targets == NULL) {
|
||||||
|
fprintf(stderr, _("error: no package file was specified for --file\n"));
|
||||||
|
return(1);
|
||||||
|
} else {
|
||||||
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
|
package = alpm_list_getdata(i);
|
||||||
|
if(alpm_pkg_load(package, &info) == -1) {
|
||||||
|
fprintf(stderr, _("error: failed to load package '%s' (%s)\n"),
|
||||||
|
package, alpm_strerror(pm_errno));
|
||||||
|
ret++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(config->op_q_info) {
|
||||||
|
dump_pkg_full(info, config->op_q_info);
|
||||||
|
}
|
||||||
|
if(config->op_q_list) {
|
||||||
|
dump_pkg_files(info);
|
||||||
|
}
|
||||||
|
if(!config->op_q_info && !config->op_q_list) {
|
||||||
|
printf("%s %s\n", alpm_pkg_get_name(info),
|
||||||
|
alpm_pkg_get_version(info));
|
||||||
|
}
|
||||||
|
alpm_pkg_free(info);
|
||||||
|
info = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pacman_query(alpm_list_t *targets)
|
int pacman_query(alpm_list_t *targets)
|
||||||
@ -123,37 +253,8 @@ int pacman_query(alpm_list_t *targets)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if(config->op_q_search) {
|
if(config->op_q_search) {
|
||||||
alpm_list_t *searchlist = alpm_db_search(db_local, targets);
|
ret = query_search(targets);
|
||||||
if(searchlist == NULL) {
|
return(ret);
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
for(i = searchlist; i; i = alpm_list_next(i)) {
|
|
||||||
char *group = NULL;
|
|
||||||
alpm_list_t *grp;
|
|
||||||
pmpkg_t *pkg = alpm_list_getdata(i);
|
|
||||||
|
|
||||||
printf("local/%s %s", alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
|
||||||
|
|
||||||
/* print the package size with the output if ShowSize option set */
|
|
||||||
if(alpm_option_get_showsize()) {
|
|
||||||
/* Convert byte size to MB */
|
|
||||||
double mbsize = alpm_pkg_get_size(pkg) / (1024.0 * 1024.0);
|
|
||||||
|
|
||||||
printf(" [%.2f MB]", mbsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
|
||||||
group = alpm_list_getdata(grp);
|
|
||||||
printf(" (%s)\n ", (char *)alpm_list_getdata(grp));
|
|
||||||
} else {
|
|
||||||
printf("\n ");
|
|
||||||
}
|
|
||||||
|
|
||||||
indentprint(alpm_pkg_get_desc(pkg), 4);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
alpm_list_free(searchlist);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config->op_q_foreign) {
|
if(config->op_q_foreign) {
|
||||||
@ -170,125 +271,80 @@ int pacman_query(alpm_list_t *targets)
|
|||||||
alpm_list_t *syncpkgs;
|
alpm_list_t *syncpkgs;
|
||||||
|
|
||||||
if((syncpkgs = alpm_get_upgrades()) != NULL) {
|
if((syncpkgs = alpm_get_upgrades()) != NULL) {
|
||||||
display_targets(syncpkgs);
|
display_targets(syncpkgs);
|
||||||
return(0);
|
return(0);
|
||||||
} else {
|
} else {
|
||||||
printf(_("no upgrades found"));
|
printf(_("no upgrades found"));
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = targets; i; i = alpm_list_next(i)) {
|
/* looking for groups */
|
||||||
package = alpm_list_getdata(i);
|
if(config->group) {
|
||||||
|
ret = query_group(targets);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
/* looking for groups */
|
/* output info for a .tar.gz package */
|
||||||
if(config->group) {
|
if(config->op_q_isfile) {
|
||||||
if(targets == NULL) {
|
ret = query_isfile(targets);
|
||||||
for(j = alpm_db_getgrpcache(db_local); j; j = alpm_list_next(j)) {
|
return(ret);
|
||||||
pmgrp_t *grp = alpm_list_getdata(j);
|
}
|
||||||
alpm_list_t *p, *pkgnames;
|
|
||||||
const char *grpname;
|
|
||||||
|
|
||||||
grpname = alpm_grp_get_name(grp);
|
/* determine the owner of a file */
|
||||||
pkgnames = alpm_grp_get_pkgs(grp);
|
if(config->op_q_owns) {
|
||||||
|
ret = query_fileowner(targets);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
for(p = pkgnames; p; p = alpm_list_next(p)) {
|
/* find packages in the db */
|
||||||
printf("%s %s\n", grpname, (char *)alpm_list_getdata(p));
|
if(targets == NULL) {
|
||||||
}
|
/* no target */
|
||||||
}
|
for(i = alpm_db_getpkgcache(db_local); i; i = alpm_list_next(i)) {
|
||||||
} else {
|
pmpkg_t *tmpp = alpm_list_getdata(i);
|
||||||
pmgrp_t *grp = alpm_db_readgrp(db_local, package);
|
const char *pkgname, *pkgver;
|
||||||
if(grp) {
|
|
||||||
alpm_list_t *p, *pkgnames = alpm_grp_get_pkgs(grp);
|
pkgname = alpm_pkg_get_name(tmpp);
|
||||||
for(p = pkgnames; p; p = alpm_list_next(p)) {
|
pkgver = alpm_pkg_get_version(tmpp);
|
||||||
printf("%s %s\n", package, (char *)alpm_list_getdata(p));
|
|
||||||
}
|
if(config->op_q_list || config->op_q_orphans || config->op_q_foreign) {
|
||||||
} else {
|
info = alpm_db_get_pkg(db_local, (char *)pkgname);
|
||||||
fprintf(stderr, _("error: group \"%s\" was not found\n"), package);
|
if(info == NULL) {
|
||||||
|
/* something weird happened */
|
||||||
|
fprintf(stderr, _("error: package \"%s\" not found\n"), pkgname);
|
||||||
ret++;
|
ret++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
if(config->op_q_foreign) {
|
||||||
}
|
int match = 0;
|
||||||
|
for(j = sync_dbs; j; j = alpm_list_next(j)) {
|
||||||
/* output info for a .tar.gz package */
|
pmdb_t *db = (pmdb_t *)alpm_list_getdata(j);
|
||||||
if(config->op_q_isfile) {
|
for(k = alpm_db_getpkgcache(db); k; k = alpm_list_next(k)) {
|
||||||
if(package == NULL) {
|
pmpkg_t *pkg = alpm_list_getdata(k);
|
||||||
fprintf(stderr, _("error: no package file was specified for --file\n"));
|
if(strcmp(alpm_pkg_get_name(pkg), alpm_pkg_get_name(info)) == 0) {
|
||||||
return(1);
|
match = 1;
|
||||||
}
|
|
||||||
if(alpm_pkg_load(package, &info) == -1) {
|
|
||||||
fprintf(stderr, _("error: failed to load package '%s' (%s)\n"),
|
|
||||||
package, alpm_strerror(pm_errno));
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
if(config->op_q_info) {
|
|
||||||
dump_pkg_full(info, config->op_q_info);
|
|
||||||
}
|
|
||||||
if(config->op_q_list) {
|
|
||||||
dump_pkg_files(info);
|
|
||||||
}
|
|
||||||
if(!config->op_q_info && !config->op_q_list) {
|
|
||||||
printf("%s %s\n", alpm_pkg_get_name(info),
|
|
||||||
alpm_pkg_get_version(info));
|
|
||||||
}
|
|
||||||
alpm_pkg_free(info);
|
|
||||||
info = NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* determine the owner of a file */
|
|
||||||
if(config->op_q_owns) {
|
|
||||||
query_fileowner(db_local, package);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find packages in the db */
|
|
||||||
if(package == NULL) {
|
|
||||||
/* no target */
|
|
||||||
for(i = alpm_db_getpkgcache(db_local); i; i = alpm_list_next(i)) {
|
|
||||||
pmpkg_t *tmpp = alpm_list_getdata(i);
|
|
||||||
const char *pkgname, *pkgver;
|
|
||||||
|
|
||||||
pkgname = alpm_pkg_get_name(tmpp);
|
|
||||||
pkgver = alpm_pkg_get_version(tmpp);
|
|
||||||
|
|
||||||
if(config->op_q_list || config->op_q_orphans || config->op_q_foreign) {
|
|
||||||
info = alpm_db_get_pkg(db_local, (char *)pkgname);
|
|
||||||
if(info == NULL) {
|
|
||||||
/* something weird happened */
|
|
||||||
fprintf(stderr, _("error: package \"%s\" not found\n"), pkgname);
|
|
||||||
ret++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(config->op_q_foreign) {
|
|
||||||
int match = 0;
|
|
||||||
for(j = sync_dbs; j; j = alpm_list_next(j)) {
|
|
||||||
pmdb_t *db = (pmdb_t *)alpm_list_getdata(j);
|
|
||||||
for(k = alpm_db_getpkgcache(db); k; k = alpm_list_next(k)) {
|
|
||||||
pmpkg_t *pkg = alpm_list_getdata(k);
|
|
||||||
if(strcmp(alpm_pkg_get_name(pkg), alpm_pkg_get_name(info)) == 0) {
|
|
||||||
match = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(match==0) {
|
}
|
||||||
printf("%s %s\n", pkgname, pkgver);
|
if(match==0) {
|
||||||
}
|
|
||||||
} else if(config->op_q_list) {
|
|
||||||
dump_pkg_files(info);
|
|
||||||
} else if(config->op_q_orphans) {
|
|
||||||
if(alpm_pkg_get_requiredby(info) == NULL
|
|
||||||
&& ((long)alpm_pkg_get_reason(info) == PM_PKG_REASON_DEPEND
|
|
||||||
|| config->op_q_orphans > 1)) {
|
|
||||||
printf("%s %s\n", pkgname, pkgver);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("%s %s\n", pkgname, pkgver);
|
printf("%s %s\n", pkgname, pkgver);
|
||||||
}
|
}
|
||||||
|
} else if(config->op_q_list) {
|
||||||
|
dump_pkg_files(info);
|
||||||
|
} else if(config->op_q_orphans) {
|
||||||
|
if(alpm_pkg_get_requiredby(info) == NULL
|
||||||
|
&& ((long)alpm_pkg_get_reason(info) == PM_PKG_REASON_DEPEND
|
||||||
|
|| config->op_q_orphans > 1)) {
|
||||||
|
printf("%s %s\n", pkgname, pkgver);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("%s %s\n", pkgname, pkgver);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
} else {
|
||||||
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
|
package = alpm_list_getdata(i);
|
||||||
info = alpm_db_get_pkg(db_local, package);
|
info = alpm_db_get_pkg(db_local, package);
|
||||||
if(info == NULL) {
|
if(info == NULL) {
|
||||||
fprintf(stderr, _("error: package \"%s\" not found\n"), package);
|
fprintf(stderr, _("error: package \"%s\" not found\n"), package);
|
||||||
@ -305,16 +361,16 @@ int pacman_query(alpm_list_t *targets)
|
|||||||
}
|
}
|
||||||
if(!config->op_q_info && !config->op_q_list) {
|
if(!config->op_q_info && !config->op_q_list) {
|
||||||
printf("%s %s\n", alpm_pkg_get_name(info),
|
printf("%s %s\n", alpm_pkg_get_name(info),
|
||||||
alpm_pkg_get_version(info));
|
alpm_pkg_get_version(info));
|
||||||
}
|
}
|
||||||
if(config->op_q_changelog) {
|
if(config->op_q_changelog) {
|
||||||
char changelog[PATH_MAX];
|
char changelog[PATH_MAX];
|
||||||
/* TODO should be done in the backend- no raw DB stuff up front */
|
/* TODO should be done in the backend- no raw DB stuff up front */
|
||||||
snprintf(changelog, PATH_MAX, "%s/%s/%s-%s/changelog",
|
snprintf(changelog, PATH_MAX, "%s/%s/%s-%s/changelog",
|
||||||
alpm_option_get_dbpath(),
|
alpm_option_get_dbpath(),
|
||||||
alpm_db_get_name(db_local),
|
alpm_db_get_name(db_local),
|
||||||
alpm_pkg_get_name(info),
|
alpm_pkg_get_name(info),
|
||||||
alpm_pkg_get_version(info));
|
alpm_pkg_get_version(info));
|
||||||
dump_pkg_changelog(changelog, alpm_pkg_get_name(info));
|
dump_pkg_changelog(changelog, alpm_pkg_get_name(info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* sync.c
|
* sync.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -221,6 +221,7 @@ static int sync_synctree(int level, alpm_list_t *syncs)
|
|||||||
return(success > 0);
|
return(success > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *ret;
|
alpm_list_t *i, *j, *ret;
|
||||||
@ -259,12 +260,10 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
|
|||||||
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
||||||
group = alpm_list_getdata(grp);
|
group = alpm_list_getdata(grp);
|
||||||
printf(" (%s)\n", (char *)alpm_list_getdata(grp));
|
printf(" (%s)\n", (char *)alpm_list_getdata(grp));
|
||||||
} else {
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we need an initial indent first */
|
/* we need a newline and initial indent first */
|
||||||
printf(" ");
|
printf("\n ");
|
||||||
indentprint(alpm_pkg_get_desc(pkg), 4);
|
indentprint(alpm_pkg_get_desc(pkg), 4);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user