mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-10 21:38:19 -05:00
Allow sync search to work without arguments
Enable an -Ss operation to work without a target list. This allows all package information to be printed (as opposed to individual -Sl operations on repositories). Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
085e5898ae
commit
da3286a80d
@ -555,9 +555,14 @@ int main(int argc, char *argv[])
|
|||||||
cleanup(1);
|
cleanup(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(alpm_list_count(pm_targets) == 0 && !(config->op == PM_OP_QUERY || (config->op == PM_OP_SYNC
|
/* TODO This is pretty messy, shouldn't checking be done later in the ops
|
||||||
&& (config->op_s_sync || config->op_s_upgrade || config->op_s_clean || config->group
|
* themselves? I can't even digest this if statement. */
|
||||||
|| config->op_q_list)))) {
|
if(alpm_list_count(pm_targets) == 0
|
||||||
|
&& !(config->op == PM_OP_QUERY
|
||||||
|
|| (config->op == PM_OP_SYNC
|
||||||
|
&& (config->op_s_sync || config->op_s_upgrade || config->op_s_search
|
||||||
|
|| config->op_s_clean || config->group
|
||||||
|
|| config->op_q_list)))) {
|
||||||
ERR(NL, _("no targets specified (use -h for help)\n"));
|
ERR(NL, _("no targets specified (use -h for help)\n"));
|
||||||
cleanup(1);
|
cleanup(1);
|
||||||
}
|
}
|
||||||
|
@ -235,41 +235,45 @@ static int sync_synctree(int level, alpm_list_t *syncs)
|
|||||||
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;
|
||||||
|
int freelist;
|
||||||
|
|
||||||
for(i = syncs; i; i = alpm_list_next(i)) {
|
for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
pmdb_t *db = (pmdb_t *)alpm_list_getdata(i);
|
pmdb_t *db = alpm_list_getdata(i);
|
||||||
|
/* if we have a targets list, search for packages matching it */
|
||||||
if(targets) {
|
if(targets) {
|
||||||
ret = alpm_db_search(db, targets);
|
ret = alpm_db_search(db, targets);
|
||||||
if(ret == NULL) {
|
freelist = 1;
|
||||||
continue;
|
} else {
|
||||||
}
|
ret = alpm_db_getpkgcache(db);
|
||||||
for(j = ret; j; j = alpm_list_next(j)) {
|
freelist = 0;
|
||||||
char *group = NULL;
|
}
|
||||||
alpm_list_t *grp;
|
if(ret == NULL) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(j);
|
continue;
|
||||||
|
}
|
||||||
|
for(j = ret; j; j = alpm_list_next(j)) {
|
||||||
|
/* print repo/name (group) info about each package in our list */
|
||||||
|
char *group = NULL;
|
||||||
|
alpm_list_t *grp;
|
||||||
|
pmpkg_t *pkg = alpm_list_getdata(j);
|
||||||
|
|
||||||
printf("%s/%s %s", 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));
|
||||||
|
|
||||||
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 {
|
} else {
|
||||||
printf("\n ");
|
|
||||||
}
|
|
||||||
|
|
||||||
indentprint(alpm_pkg_get_desc(pkg), 4);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
alpm_list_free(ret);
|
|
||||||
} else {
|
|
||||||
for(j = alpm_db_getpkgcache(db); j; j = alpm_list_next(j)) {
|
|
||||||
pmpkg_t *pkg = alpm_list_getdata(j);
|
|
||||||
|
|
||||||
MSG(NL, "%s/%s %s\n ", alpm_db_get_name(db), alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
|
/* we need an initial indent first */
|
||||||
indentprint(alpm_pkg_get_desc(pkg), 4);
|
printf(" ");
|
||||||
MSG(NL, "\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(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user