From 185531cc01c4bcc54444daa4d2291f2ea7c09693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Roualland?= Date: Wed, 9 Jan 2002 01:25:55 +0000 Subject: [PATCH] added the '--ignore' and '--force' options --- ChangeLog | 6 ++++++ TODO | 5 ----- stow.8 | 14 ++++++++++++++ stow.in | 43 ++++++++++++++++++++++++++++++------------- stow.texi | 16 ++++++++++++++-- 5 files changed, 64 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1cde93..d39be8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Jan 9 02:20:15 2002 Gaël Roualland + + * stow.in: added the '--ignore' and '--force' options. + * stow.texi,stow.8: documented '--ignore' and '--force'. + * TODO: removed reference to '--ignore' like feature. + Tue Jan 08 23:00:29 2002 Guillaume Morin * stow.in: added the '--subdir' option. diff --git a/TODO b/TODO index a3ba084..1862e92 100644 --- a/TODO +++ b/TODO @@ -4,11 +4,6 @@ * Fix empty-dir problem (see "Known bugs" in the manual) -* Continue after conflicts. - -When detecting a conflict, affected subparts of the Stow traversal can -be skipped while continuing with other subparts. - * Traverse links in the target tree? From e-mail with meyering@na-net.ornl.gov: diff --git a/stow.8 b/stow.8 index f385a57..66f91ec 100644 --- a/stow.8 +++ b/stow.8 @@ -181,6 +181,20 @@ option implies `-n', and is used to search for all conflicts that might arise from an actual Stow operation. As with `-n', however, false conflicts might be reported (see ``Conflicts'' in the info manual). .TP +.I -i +.TP +.I --ignore +Do not exit immediatly when a conflict is encountered, but continue +processing the package. +.TP +.I -f +.TP +.I --force +Try to override conflicts by removing conflicting links. This will +only remove links to other packages in the stow directory. Other +links or files will not be removed (it will be similar to `-i' in +that case). +.TP .I "-d DIR" .TP .I --dir=DIR diff --git a/stow.in b/stow.in index 8750754..ae20d6f 100644 --- a/stow.in +++ b/stow.in @@ -39,6 +39,7 @@ $ReportHelp = 0; $Stow = undef; $Target = undef; $Restow = 0; +$Force = 0; @Subdirs = (); @@ -55,6 +56,11 @@ while (@ARGV && ($_ = $ARGV[0]) && /^-/) { } elsif ($opt =~ /^c(o(n(f(l(i(c(ts?)?)?)?)?)?)?)?$/i) { $Conflicts = 1; $NotReally = 1; + } elsif ($opt =~ /^i(g(n(o(r(e?)?)?)?)?)$/i) { + $Conflicts = 1; + } elsif ($opt =~ /^f(o(r(c(e?)?)?)?)$/i) { + $Force = 1; + $Conflicts = 1; } elsif ($opt =~ /^dir?/i) { $remainder = $'; if ($remainder =~ /^=/) { @@ -103,6 +109,11 @@ while (@ARGV && ($_ = $ARGV[0]) && /^-/) { } elsif ($_ eq 'c') { $Conflicts = 1; $NotReally = 1; + } elsif ($_ eq 'i') { + $Conflicts = 1; + } elsif ($_ eq 'f') { + $Force = 1; + $Conflicts = 1; } elsif ($_ eq 'd') { $Stow = (join('', @opts) || shift); @opts = (); @@ -434,23 +445,27 @@ sub StowNondir { $linktarget)) || (&Conflict($file, $subfile), return); if (-e &JoinPaths($Stow, $stowsubfile)) { - (&Conflict($file, $subfile), return) - unless ($stowsubfile eq $file); - warn sprintf("%s already points to %s\n", - &JoinPaths($Target, $subfile), - &JoinPaths($Stow, $file)) - if ($Verbose > 2); - } else { - &DoUnlink(&JoinPaths($Target, $subfile)); - &DoLink(&JoinPaths($stow, $file), - &JoinPaths($Target, $subfile)); + if ($stowsubfile eq $file) { + warn sprintf("%s already points to %s\n", + &JoinPaths($Target, $subfile), + &JoinPaths($Stow, $file)) + if ($Verbose > 2); + return; + } else { + &Conflict($file, $subfile); + return unless $Force; + warn "OVERRIDING link to ". &JoinPaths($Stow, $stowsubfile) . "\n" + if $Verbose; + } } + &DoUnlink(&JoinPaths($Target, $subfile)); } elsif (-e &JoinPaths($Target, $subfile)) { &Conflict($file, $subfile); - } else { - &DoLink(&JoinPaths($stow, $file), - &JoinPaths($Target, $subfile)); + return; } + + &DoLink(&JoinPaths($stow, $file), + &JoinPaths($Target, $subfile)); } sub DoUnlink { @@ -544,6 +559,8 @@ sub usage { print <