diff options
-rw-r--r-- | urpm.pm | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -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; + } } } } |