src/import-yum.c
changeset 269 03fc85294bc9
parent 259 5b0601d184ed
child 333 1829493b5fb9
     1.1 --- a/src/import-yum.c	Mon Jun 23 09:59:08 2008 -0400
     1.2 +++ b/src/import-yum.c	Mon Jun 23 17:19:20 2008 -0400
     1.3 @@ -62,6 +62,8 @@
     1.4  	char pkgid[128];
     1.5  	uint32_t property_type;
     1.6  	int state;
     1.7 +
     1.8 +	int total, current;
     1.9  };
    1.10  
    1.11  static uint32_t
    1.12 @@ -90,7 +92,12 @@
    1.13  	uint32_t pre, relation, flags;
    1.14  	int i;
    1.15  
    1.16 -	if (strcmp(name, "name") == 0) {
    1.17 +	if (strcmp(name, "metadata") == 0) {
    1.18 +		for (i = 0; atts[i]; i += 2) {
    1.19 +			if (strcmp(atts[i], "packages") == 0)
    1.20 +				ctx->total = atoi(atts[i + 1]);
    1.21 +		}
    1.22 +	} else if (strcmp(name, "name") == 0) {
    1.23  		ctx->state = YUM_STATE_PACKAGE_NAME;
    1.24  		ctx->p = ctx->name;
    1.25  	} else if (strcmp(name, "arch") == 0) {
    1.26 @@ -208,6 +215,9 @@
    1.27  
    1.28  		XML_StopParser(ctx->current_parser, XML_TRUE);
    1.29  		ctx->current_parser = ctx->filelists_parser;
    1.30 +
    1.31 +		printf("\rimporting %d/%d", ++ctx->current, ctx->total);
    1.32 +		fflush(stdout);
    1.33  	}
    1.34  }
    1.35  
    1.36 @@ -313,6 +323,8 @@
    1.37  
    1.38  	ctx.current_parser = ctx.primary_parser;
    1.39  
    1.40 +	ctx.current = 0;
    1.41 +
    1.42  	do {
    1.43  		XML_GetParsingStatus(ctx.current_parser, &status);
    1.44  		switch (status.parsing) {
    1.45 @@ -348,5 +360,6 @@
    1.46  	gzclose(primary);
    1.47  	gzclose(filelists);
    1.48  
    1.49 +	printf ("\nsaving\n");
    1.50  	return razor_importer_finish(ctx.importer);
    1.51  }