summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/import-rpmdb.c5
-rw-r--r--src/import-yum.c15
-rw-r--r--src/main.c6
3 files changed, 24 insertions, 2 deletions
diff --git a/src/import-rpmdb.c b/src/import-rpmdb.c
index 3b4851c..cbef6a8 100644
--- a/src/import-rpmdb.c
+++ b/src/import-rpmdb.c
@@ -90,6 +90,7 @@ razor_set_create_from_rpmdb(void)
union rpm_entry basenames, dirnames, dirindexes;
char filename[PATH_MAX], evr[128], buf[16];
rpmdb db;
+ int imported_count = 0;
rpmReadConfigFiles(NULL, NULL);
@@ -162,9 +163,13 @@ razor_set_create_from_rpmdb(void)
}
razor_importer_finish_package(importer);
+
+ printf("\rimporting %d", ++imported_count);
+ fflush(stdout);
}
rpmdbClose(db);
+ printf("\nsaving\n");
return razor_importer_finish(importer);
}
diff --git a/src/import-yum.c b/src/import-yum.c
index cb4ea7a..fd78dc3 100644
--- a/src/import-yum.c
+++ b/src/import-yum.c
@@ -62,6 +62,8 @@ struct yum_context {
char pkgid[128];
uint32_t property_type;
int state;
+
+ int total, current;
};
static uint32_t
@@ -90,7 +92,12 @@ yum_primary_start_element(void *data, const char *name, const char **atts)
uint32_t pre, relation, flags;
int i;
- if (strcmp(name, "name") == 0) {
+ if (strcmp(name, "metadata") == 0) {
+ for (i = 0; atts[i]; i += 2) {
+ if (strcmp(atts[i], "packages") == 0)
+ ctx->total = atoi(atts[i + 1]);
+ }
+ } else if (strcmp(name, "name") == 0) {
ctx->state = YUM_STATE_PACKAGE_NAME;
ctx->p = ctx->name;
} else if (strcmp(name, "arch") == 0) {
@@ -208,6 +215,9 @@ yum_primary_end_element (void *data, const char *name)
XML_StopParser(ctx->current_parser, XML_TRUE);
ctx->current_parser = ctx->filelists_parser;
+
+ printf("\rimporting %d/%d", ++ctx->current, ctx->total);
+ fflush(stdout);
}
}
@@ -313,6 +323,8 @@ razor_set_create_from_yum(void)
ctx.current_parser = ctx.primary_parser;
+ ctx.current = 0;
+
do {
XML_GetParsingStatus(ctx.current_parser, &status);
switch (status.parsing) {
@@ -348,5 +360,6 @@ razor_set_create_from_yum(void)
gzclose(primary);
gzclose(filelists);
+ printf ("\nsaving\n");
return razor_importer_finish(ctx.importer);
}
diff --git a/src/main.c b/src/main.c
index f9aee35..bd2df97 100644
--- a/src/main.c
+++ b/src/main.c
@@ -535,7 +535,7 @@ command_import_rpms(int argc, const char *argv[])
struct razor_importer *importer;
struct razor_set *set;
struct razor_rpm *rpm;
- int len;
+ int len, imported_count = 0;
char filename[256];
const char *dirname = argv[0];
@@ -569,6 +569,9 @@ command_import_rpms(int argc, const char *argv[])
break;
}
razor_rpm_close(rpm);
+
+ printf("\rimporting %d", ++imported_count);
+ fflush(stdout);
}
if (de != NULL) {
@@ -576,6 +579,7 @@ command_import_rpms(int argc, const char *argv[])
return -1;
}
+ printf("\nsaving\n");
set = razor_importer_finish(importer);
razor_set_write(set, repo_filename, RAZOR_REPO_FILE_MAIN);