diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-02-26 21:56:48 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-02-26 21:56:48 +0000 |
commit | 3adde6b3bb3104dd6e0329778826c0fc5eddd268 (patch) | |
tree | c04538af2e99ce44181edc111bae9e68d3ab63dd | |
parent | f22ab11821badfa1f4f6108d325b5201c93bf840 (diff) | |
download | urpmi-3adde6b3bb3104dd6e0329778826c0fc5eddd268.tar urpmi-3adde6b3bb3104dd6e0329778826c0fc5eddd268.tar.gz urpmi-3adde6b3bb3104dd6e0329778826c0fc5eddd268.tar.bz2 urpmi-3adde6b3bb3104dd6e0329778826c0fc5eddd268.tar.xz urpmi-3adde6b3bb3104dd6e0329778826c0fc5eddd268.zip |
create _expand_symlink() out of find_mntpoints()
-rw-r--r-- | urpm/sys.pm | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/urpm/sys.pm b/urpm/sys.pm index 295321bc..b6ef73be 100644 --- a/urpm/sys.pm +++ b/urpm/sys.pm @@ -71,23 +71,29 @@ sub find_mntpoints { #- for simplification we refuse also any other device and stop here. last; } elsif (-l $pdir) { - while (my $v = readlink $pdir) { - if ($pdir =~ m|^/|) { - $pdir = $v; - } else { - while ($v =~ s!^\.\./!!) { - $pdir =~ s!/[^/]+/*$!!; - } - $pdir .= "/$v"; - } - } - unshift @paths, split '/', $pdir; + unshift @paths, split '/', _expand_symlink($pdir); $pdir = ''; } } @mntpoints; } +sub _expand_symlink { + my ($pdir) = @_; + + while (my $v = readlink $pdir) { + if ($pdir =~ m|^/|) { + $pdir = $v; + } else { + while ($v =~ s!^\.\./!!) { + $pdir =~ s!/[^/]+/*$!!; + } + $pdir .= "/$v"; + } + } + $pdir; +} + sub clean_rpmdb_shared_regions { my ($prefix) = @_; unlink glob("$prefix/var/lib/rpm/__db.*"); |