From 4bb66517e0d376670d9499e8afb72c9cbb7765e4 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 23 Jul 2002 14:23:07 +0000 Subject: added callback for configure method used by new rpmdrake. --- urpm.pm | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/urpm.pm b/urpm.pm index ffe4bbfe..4bd6f187 100644 --- a/urpm.pm +++ b/urpm.pm @@ -542,13 +542,30 @@ sub configure { } foreach (grep { !$_->{ignore} && (!$options{update} || $_->{update}) } @{$urpm->{media} || []}) { delete @{$_}{qw(start end)}; - if (-s "$urpm->{statedir}/synthesis.$_->{hdlist}" > 32) { - $urpm->{log}(_("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$_->{hdlist}")); - eval { ($_->{start}, $_->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$_->{hdlist}") }; - } - unless (defined $_->{start} && defined $_->{end}) { - $urpm->{error}(_("problem reading synthesis file of medium \"%s\"", $_->{name})); - $_->{ignore} = 1; + if ($options{callback_pkg}) { + if (-s "$urpm->{statedir}/$_->{hdlist}" > 32) { + $urpm->{log}(_("examining hdlist file [%s]", "$urpm->{statedir}/$_->{hdlist}")); + eval { ($_->{start}, $_->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$_->{hdlist}", 0) }; + } + unless (defined $_->{start} && defined $_->{end}) { + $urpm->{error}(_("problem reading hdlist file of medium \"%s\"", $_->{name})); + $_->{ignore} = 1; + } else { + #- medium has been read correclty, now call the callback for each packages. + #- it is the responsability of callback to pack the header. + foreach ($_->{start} .. $_->{end}) { + $options{callback}->($urpm, $_, %options); + } + } + } else { + if (-s "$urpm->{statedir}/synthesis.$_->{hdlist}" > 32) { + $urpm->{log}(_("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$_->{hdlist}")); + eval { ($_->{start}, $_->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$_->{hdlist}") }; + } + unless (defined $_->{start} && defined $_->{end}) { + $urpm->{error}(_("problem reading synthesis file of medium \"%s\"", $_->{name})); + $_->{ignore} = 1; + } } } } -- cgit v1.2.1