summaryrefslogtreecommitdiff
path: root/src/pacman
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-16 01:58:51 +0000
committerAaron Griffin <aaron@archlinux.org>2007-02-16 01:58:51 +0000
commit4b2e236a35d20d396544ef15ac9e7dab878c92f8 (patch)
tree70ff88f742b9bfcd53cb7a02b6d3e261764d7df7 /src/pacman
parent01726a74e4416ce597a942b79cb31036ebbf01b8 (diff)
* Bugfix for FS#6427: Allow -Si to use "repository/package" syntax
* Also don't stop searching when one package is not found (output and continue)
Diffstat (limited to 'src/pacman')
-rw-r--r--src/pacman/sync.c66
1 files changed, 54 insertions, 12 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 654c4613..eedcd96e 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -318,24 +318,66 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
if(targets) {
for(i = targets; i; i = alpm_list_next(i)) {
- int found = 0;
-
- for(j = syncs; j && !found; j = alpm_list_next(j)) {
- pmdb_t *db = alpm_list_getdata(j);
-
- for(k = alpm_db_getpkgcache(db); !found && k; k = alpm_list_next(k)) {
+ pmdb_t *db = NULL;
+ int foundpkg = 0;
+
+ char target[512]; /* TODO is this enough space? */
+ char *repo = NULL, *pkgstr = NULL;
+
+ strncpy(target, i->data, 512);
+ pkgstr = strchr(target, '/');
+ if(pkgstr) {
+ repo = target;
+ *pkgstr = '\0';
+ ++pkgstr;
+
+ for(j = syncs; j; j = alpm_list_next(j)) {
+ db = alpm_list_getdata(j);
+ if(strcmp(repo, alpm_db_get_name(db)) == 0) {
+ break;
+ }
+ db = NULL;
+ }
+
+ if(!db) {
+ ERR(NL, _("repository '%s' does not exist"), repo);
+ return(1);
+ }
+
+ 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_list_getdata(i))) {
+ if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) {
dump_pkg_sync(pkg, alpm_db_get_name(db));
MSG(NL, "\n");
- found = 1;
+ foundpkg = 1;
+ break;
}
}
- }
- if(!found) {
- ERR(NL, _("package \"%s\" was not found.\n"), (char *)i->data);
- break;
+
+ if(!foundpkg) {
+ ERR(NL, _("package '%s' was not found in repository '%s'"), pkgstr, repo);
+ }
+ } else {
+ pkgstr = target;
+
+ for(j = syncs; j; j = alpm_list_next(j)) {
+ pmdb_t *db = 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), pkgstr) == 0) {
+ dump_pkg_sync(pkg, alpm_db_get_name(db));
+ MSG(NL, "\n");
+ foundpkg = 1;
+ break;
+ }
+ }
+ }
+ if(!foundpkg) {
+ ERR(NL, _("package '%s' was not found."), pkgstr);
+ }
}
}
} else {