diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-14 15:06:30 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-14 15:06:30 +0000 |
commit | 1a3a9bb3f623d22eb45b0168e3a1c358d2bf8aa7 (patch) | |
tree | a8b02eec80b840e01e21bdfef9d44f7d3db27d8b /urpm.pm | |
parent | f505ec829abf9a7e415e0719cedc26f116f42ff8 (diff) | |
download | urpmi-1a3a9bb3f623d22eb45b0168e3a1c358d2bf8aa7.tar urpmi-1a3a9bb3f623d22eb45b0168e3a1c358d2bf8aa7.tar.gz urpmi-1a3a9bb3f623d22eb45b0168e3a1c358d2bf8aa7.tar.bz2 urpmi-1a3a9bb3f623d22eb45b0168e3a1c358d2bf8aa7.tar.xz urpmi-1a3a9bb3f623d22eb45b0168e3a1c358d2bf8aa7.zip |
create write_MD5SUM() out of write_config()
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -453,6 +453,18 @@ sub probe_removable_device { } } + +sub write_MD5SUM { + my ($urpm) = @_; + + #- write MD5SUM file + my $fh = $urpm->open_safe('>', "$urpm->{statedir}/MD5SUM") or return 0; + foreach my $medium (grep { $_->{md5sum} } @{$urpm->{media}}) { + my $s = basename(statedir_hdlist_or_synthesis($urpm, $medium)); + print $fh "$medium->{md5sum} $s\n"; + } +} + #- Writes the urpmi.cfg file. sub write_config { my ($urpm) = @_; @@ -476,13 +488,7 @@ sub write_config { urpm::cfg::dump_config($urpm->{config}, $config) or $urpm->{fatal}(6, N("unable to write config file [%s]", $urpm->{config})); - #- write MD5SUM file - my $md5sum = $urpm->open_safe('>', "$urpm->{statedir}/MD5SUM") or return 0; - foreach my $medium (@{$urpm->{media}}) { - $medium->{md5sum} - and print $md5sum "$medium->{md5sum} " . ($medium->{synthesis} && "synthesis.") . $medium->{hdlist} . "\n"; - } - close $md5sum; + write_MD5SUM($urpm); $urpm->{log}(N("wrote config file [%s]", $urpm->{config})); |