Date: 2005-08-17
Initial Package Version: 2.9.6
Origin: Christian Hamar alias krix <krics@linuxforum.hu>
Description: If the target is not found in sync db, try to search a package
             that provides it. (ie. make 'pacman -S x' work)
 pacman.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)
diff -Naur pacman-2.9.6.orig/src/pacman.c pacman-2.9.6/src/pacman.c
--- pacman-2.9.6.orig/src/pacman.c	2005-08-17 20:32:21.000000000 +0200
+++ pacman-2.9.6/src/pacman.c	2005-08-17 21:21:32.000000000 +0200
@@ -827,12 +827,30 @@
 							}
 							FREELIST(k);
 						} else {
-							fprintf(stderr, "%s: not found in sync db\n", targ);
+						    vprint(":: %s not found in sync db, searching for providers...\n", targ);
+						    k = NULL;
+						    for(j = databases; j; j = j->next) {
+							dbsync_t *dbs = (dbsync_t*)j->data;
+							PMList *l = whatprovides(dbs->db, targ);
+							k = list_merge(k, l);
+							FREELIST(l);
+						    }
+						    if(k != NULL) {
+							vprint(":: %s is provided by :\n", targ);
+							if(pmo_verbose) list_display("   ", k);
+							PMList *l;
+							l = k;
+							vprint(":: Using the first provider - %s\n", strdup((char*)l->data));
+					    		targets = list_add(targets, strdup((char*)l->data));
+							FREELIST(k);
+						    } else {
+							fprintf(stderr, "nobody provides %s and not found in sync db\n", targ);
 							allgood = 0;
-						}
+						    }
+						} // treename else end
 					} else {
-						fprintf(stderr, "%s: not present in \"%s\" repository\n", targ, treename);
-						allgood = 0;
+					    fprintf(stderr, "%s: not present in \"%s\" repository\n", targ, treename);
+					    allgood = 0;
 					}
 					FREE(sync);
 					FREE(targline);
