From 88c4b8e65b198d0908b4b0387436e7f46bc29064 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 24 Jun 2008 16:39:22 +0000 Subject: - all tools: o statedir files are now in /var/lib/urpmi// for eg: /var/lib/urpmi/synthesis.hdlist. is now /var/lib/urpmi//synthesis.hdlist.cz it allows easier medium update without using urpmi.update (#31893) --- NEWS | 5 +++++ urpm/media.pm | 26 +++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index dbebe7d6..c5bd924c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +- all tools: + o statedir files are now in /var/lib/urpmi// + for eg: /var/lib/urpmi/synthesis.hdlist. is now + /var/lib/urpmi//synthesis.hdlist.cz + it allows easier medium update without using urpmi.update (#31893) - urpmi: o set connection timeout for rsync as well (Anssi) o fix --replacepkgs when a same package appears more than once in urpmi db diff --git a/urpm/media.pm b/urpm/media.pm index c9bff53d..9b3f3bc6 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -321,10 +321,25 @@ sub statedir_media_info_basename { $medium->{name} && "$prefix.$medium->{name}$suffix"; } -sub statedir_media_info_file { +sub statedir_media_info_dir { + my ($urpm, $medium) = @_; + $medium->{name} && "$urpm->{statedir}/$medium->{name}"; +} + +sub old_statedir_media_info_file { my ($urpm, $medium, $prefix, $suffix) = @_; $medium->{name} && "$urpm->{statedir}/" . statedir_media_info_basename($medium, $prefix, $suffix); } +sub new_statedir_media_info_file { + my ($urpm, $medium, $prefix, $suffix) = @_; + my $dir = statedir_media_info_dir($urpm, $medium); + $dir && "$dir/$prefix$suffix"; +} +sub statedir_media_info_file { + my ($urpm, $medium, $prefix, $suffix) = @_; + my $dir = statedir_media_info_dir($urpm, $medium); + -d $dir ? "$dir/$prefix$suffix" : old_statedir_media_info_file($urpm, $medium, $prefix, $suffix); +} sub statedir_synthesis { my ($urpm, $medium) = @_; statedir_media_info_file($urpm, $medium, 'synthesis.hdlist', '.cz'); @@ -335,7 +350,7 @@ sub statedir_descriptions { } sub statedir_names { my ($urpm, $medium) = @_; - statedir_media_info_file($urpm, $medium, 'names', ''); + old_statedir_media_info_file($urpm, $medium, 'names', ''); } sub statedir_MD5SUM { my ($urpm, $medium) = @_; @@ -710,6 +725,7 @@ sub add_medium { #- those files must not be there (cf mdvbz#36267) _clean_statedir_medium_files($urpm, $medium); + mkdir statedir_media_info_dir($urpm, $medium), 0755 if !$options{virtual} || !_local_file($medium); if ($options{virtual}) { $medium->{virtual} = 1; @@ -952,7 +968,11 @@ sub _clean_statedir_medium_files { my ($urpm, $medium) = @_; #- remove files associated with this medium. - unlink grep { $_ } map { statedir_media_info_file($urpm, $medium, $_->[0], $_->[1]) } @media_info_prefix_suffix; + unlink grep { $_ } map { old_statedir_media_info_file($urpm, $medium, $_->[0], $_->[1]) } @media_info_prefix_suffix; + + my $dir = statedir_media_info_dir($urpm, $medium); + -d $dir and urpm::sys::clean_dir($dir); + remove_user_media_info_files($urpm, $medium); } -- cgit v1.2.1