- yet another incompatible change: as everybody seems to use repo_write_stdkeyfilter...
[platform/upstream/libsolv.git] / tools / mergesolv.c
index 7492b5c..0d6075c 100644 (file)
@@ -33,19 +33,25 @@ usage()
   exit(0);
 }
 
-static FILE *
+static int
 loadcallback (Pool *pool, Repodata *data, void *vdata)
 {
-  FILE *fp = 0;
-  const char *location = repodata_lookup_str(data, REPOENTRY_META, REPOSITORY_LOCATION);
-  if (location)
+  FILE *fp;
+  const char *location = repodata_lookup_str(data, SOLVID_META, REPOSITORY_LOCATION);
+  int r;
+
+  if (!location)
+    return 0;
+  fprintf(stderr, "Loading SOLV file %s\n", location);
+  fp = fopen (location, "r");
+  if (!fp)
     {
-      fprintf(stderr, "Loading SOLV file %s\n", location);
-      fp = fopen (location, "r");
-      if (!fp)
-       perror(location);
+      perror(location);
+      return 0;
     }
-  return fp;
+  r = repo_add_solv(data->repo, fp, REPO_USE_LOADING|REPO_LOCALPOOL);
+  fclose(fp);
+  return r ? 0 : 1;
 }
 
 int
@@ -88,7 +94,7 @@ main(int argc, char **argv)
          perror(argv[optind]);
          exit(1);
        }
-      repo_add_solv(repo, fp);
+      repo_add_solv(repo, fp, 0);
       fclose(fp);
     }
   tool_write(repo, basefile, 0);