more comments
This commit is contained in:
parent
5844b34608
commit
3cd2580cfe
1 changed files with 31 additions and 21 deletions
52
Stow.pm
52
Stow.pm
|
@ -130,7 +130,7 @@ sub JoinPaths {
|
||||||
|
|
||||||
# This removes stow-controlled symlinks from $targetdir for the
|
# This removes stow-controlled symlinks from $targetdir for the
|
||||||
# packages in the %$to_unstow hash, and is called recursively to
|
# packages in the %$to_unstow hash, and is called recursively to
|
||||||
# process subdirectories. It returns XXX FIXME
|
# process subdirectories.
|
||||||
|
|
||||||
sub Unstow {
|
sub Unstow {
|
||||||
my($targetdir, $stow, $to_unstow) = @_;
|
my($targetdir, $stow, $to_unstow) = @_;
|
||||||
|
@ -143,14 +143,16 @@ sub Unstow {
|
||||||
# we have to move up out of that hierarchy and back into the stow
|
# we have to move up out of that hierarchy and back into the stow
|
||||||
# directory.
|
# directory.
|
||||||
|
|
||||||
# Does this directory only contain symlinks to a *single* package
|
# Does this whole subtree only contain symlinks to a *single*
|
||||||
# collection *other* than one we are removing? We assume so and
|
# package collection *other* than one we are removing? We assume so
|
||||||
# scan the directory until we find out otherwise. We have to track
|
# and scan the tree recursively until we find out otherwise. We
|
||||||
# this because if a subtree is found to be pure, we can fold it into
|
# have to track this because if a subtree is found to be pure, we
|
||||||
# a single symlink.
|
# can fold it into a single symlink.
|
||||||
my $pure = 1;
|
my $pure = 1;
|
||||||
|
|
||||||
# FIXME what is this?
|
# If the directory is pure, we need to know which single other
|
||||||
|
# package collection the contained symlinks point to, so we know how
|
||||||
|
# to do our tree folding.
|
||||||
my $othercollection = '';
|
my $othercollection = '';
|
||||||
|
|
||||||
# We assume $targetdir is empty until we find something.
|
# We assume $targetdir is empty until we find something.
|
||||||
|
@ -226,21 +228,27 @@ sub Unstow {
|
||||||
$to_unstow,
|
$to_unstow,
|
||||||
);
|
);
|
||||||
if ($subpure) {
|
if ($subpure) {
|
||||||
push(@puresubdirs, "$content/$subother");
|
push @puresubdirs, "$content/$subother";
|
||||||
}
|
}
|
||||||
if ($pure) {
|
else {
|
||||||
if ($subpure) {
|
# Subtree is impure therefore this directory is impure.
|
||||||
if ($othercollection) {
|
$pure = 0;
|
||||||
if ($subother and $othercollection ne $subother) {
|
}
|
||||||
$pure = 0;
|
if ($pure && $subpure) {
|
||||||
}
|
if ($othercollection) {
|
||||||
} elsif ($subother) {
|
# We already found a single other package collection
|
||||||
$othercollection = $subother;
|
# somewhere in this subtree but outside $contentPath.
|
||||||
}
|
if ($subother and $othercollection ne $subother) {
|
||||||
} else {
|
# Two collections pointed to from within one subtree,
|
||||||
# Subtree is impure therefore this directory is impure.
|
# so no tree folding will be possible.
|
||||||
$pure = 0;
|
$pure = 0;
|
||||||
}
|
}
|
||||||
|
} elsif ($subother) {
|
||||||
|
# This is the first other package collection we've found;
|
||||||
|
# remember it as before for future comparison with other
|
||||||
|
# symlinks.
|
||||||
|
$othercollection = $subother;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# Current directory contains something other than a symlink or a
|
# Current directory contains something other than a symlink or a
|
||||||
|
@ -351,6 +359,8 @@ sub StowDir {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (-d &JoinPaths($opts{stow}, $stowsubdir)) {
|
if (-d &JoinPaths($opts{stow}, $stowsubdir)) {
|
||||||
|
# This is the splitting open of a folded tree which the stow
|
||||||
|
# manual refers to.
|
||||||
&DoUnlink($subdirPath);
|
&DoUnlink($subdirPath);
|
||||||
&DoMkdir($subdirPath);
|
&DoMkdir($subdirPath);
|
||||||
&StowContents($stowsubdir, &JoinPaths('..', $stow));
|
&StowContents($stowsubdir, &JoinPaths('..', $stow));
|
||||||
|
|
Loading…
Reference in a new issue