diff --git a/AUTHORS b/AUTHORS index 29ba285..a3aae80 100644 --- a/AUTHORS +++ b/AUTHORS @@ -9,7 +9,10 @@ current working directory. Charles Briscoe-Smith wrote the fix to prevent stow -D / stow -R removing initially-empty directories. -Adam Lackorzynski wrote the fix to prevente +Adam Lackorzynski wrote the fix which prevents the generation of wrong links if there are links in the stow directory. +Anthony R Iano-Fletcher +contributed the '--subdirs' option. + Stow is currently maintained by Guillaume Morin . diff --git a/ChangeLog b/ChangeLog index 6972ca6..c1cde93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jan 08 23:00:29 2002 Guillaume Morin + + * stow.in: added the '--subdir' option. + * stow.texi,stow.8: documented '--subdir' + Sun Jan 06 12:18:50 2002 Guillaume Morin * Makefile.am: use EXTRA_DIST to include manpage in distribution diff --git a/configure.in b/configure.in index 1c292ed..3b1499a 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl Process this file with Autoconf to produce configure AC_INIT(stow.in) PACKAGE=stow -VERSION=1.3.3 +VERSION=1.3.3pre4 AM_INIT_AUTOMAKE(stow, $VERSION) AC_SUBST(PACKAGE) AC_SUBST(VERSION) diff --git a/stow.8 b/stow.8 index 339531f..f385a57 100644 --- a/stow.8 +++ b/stow.8 @@ -6,7 +6,7 @@ stow \- software package installation manager .RI [ options ] .IR package ... .SH DESCRIPTION -This manual page describes GNU Stow 1.3.3, a program for managing the +This manual page describes GNU Stow 1.3.4, a program for managing the installation of software packages. This is not the definitive documentation for stow; for that, see the info manual. .PP @@ -188,6 +188,13 @@ Set the stow directory to DIR instead of the current directory. This also has the effect of making the default target directory be the parent of DIR. .TP +.I "-s DIRS" +.TP +.I --subdirs=DIRS +Set the subdirectories of the package directory that are to be installed to a +colon delimited list of directories (e.g. bin:man or bin:lib:man). The default +is to install all the subdirectories. +.TP .I "-t DIR" .TP .I --target=DIR diff --git a/stow.in b/stow.in index aee5885..8750754 100644 --- a/stow.in +++ b/stow.in @@ -39,6 +39,7 @@ $ReportHelp = 0; $Stow = undef; $Target = undef; $Restow = 0; +@Subdirs = (); # FIXME: use Getopt::Long @@ -68,6 +69,15 @@ while (@ARGV && ($_ = $ARGV[0]) && /^-/) { } else { $Target = shift; } + } elsif ($opt =~ /^s(u(b(d(i(rs?)?)?)?)?)?/i) { + $remainder = $'; + if ($remainder =~ /^=/) { + $remainder = $'; # the stuff after the = + } else { + $remainder = shift; # the following argument + } + @Subdirs = split(/:/, $remainder); + warn "remainder='$remainder' Subdirs = (@Subdirs)\n" if ($Verbose > 1); } elsif ($opt =~ /^verb(o(se?)?)?/i) { $remainder = $'; if ($remainder =~ /^=(\d+)/) { @@ -105,6 +115,9 @@ while (@ARGV && ($_ = $ARGV[0]) && /^-/) { $Delete = 1; } elsif ($_ eq 'R') { $Restow = 1; + } elsif ($_ eq 's') { + @Subdirs = split(/:/, (join('', @opts) || shift)); + @opts = (); } elsif ($_ eq 'V') { &version(); } else { @@ -147,7 +160,7 @@ if ($Delete || $Restow) { if (!$Delete || $Restow) { foreach $Collection (@ARGV) { warn "Stowing package $Collection...\n" if $Verbose; - &StowContents($Collection, &RelativePath($Target, $Stow)); + &StowContents($Collection, &RelativePath($Target, $Stow), @Subdirs); } } @@ -323,17 +336,25 @@ sub EmptyTree { } sub StowContents { - local($dir, $stow) = @_; + local($dir, $stow, @subdirs) = @_; local(@contents); local($content); - warn "Stowing contents of $dir\n" if ($Verbose > 1); + local $text_subdirs = scalar(@subdirs) ? "/{".join(',',@subdirs)."} " : " "; + + warn "Stowing contents of $dir in $stow".$text_subdirs."\n" if ($Verbose > 1); opendir(DIR, &JoinPaths($Stow, $dir)) || die "$ProgramName: Cannot read directory \"$dir\" ($!)\n"; @contents = readdir(DIR); closedir(DIR); foreach $content (@contents) { next if (($content eq '.') || ($content eq '..')); + + if (scalar(@subdirs)) { + warn "Checking $content against (".join(",",@subdirs).")\n" if ($Verbose > 2); + next if (!grep($_ eq $content, @subdirs)); + } + if (-d &JoinPaths($Stow, $dir, $content)) { &StowDir(&JoinPaths($dir, $content), $stow); } else { @@ -525,6 +546,8 @@ sub usage { -c, --conflicts Scan for conflicts, implies -n -d DIR, --dir=DIR Set stow dir to DIR (default is current dir) -t DIR, --target=DIR Set target to DIR (default is parent of stow dir) + -s DIR:DIR, + --subdirs=DIR:DIR Set subdirs to recurse to DIR:DIR (default is all subdirs) -v, --verbose[=N] Increase verboseness (levels are 0,1,2,3; -v or --verbose adds 1; --verbose=N sets level) -D, --delete Unstow instead of stow diff --git a/stow.texi b/stow.texi index d06998f..7587f23 100644 --- a/stow.texi +++ b/stow.texi @@ -247,6 +247,13 @@ Set the stow directory to @var{dir} instead of the current directory. This also has the effect of making the default target directory be the parent of @var{dir}. +@item -s @var{dirs} +@itemx --subdirs=@var{dirs} +Set the subdirectories of the package directory that are to be installed +to a colon delimited list of directories +(e.g. @samp{bin:man} or @samp{bin:lib:man}). +The default is to install all the subdirectories. + @item -t @var{dir} @itemx --target=@var{dir} Set the target directory to @var{dir} instead of the parent of the stow