summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spiers <stow@adamspiers.org>2019-06-28 01:02:48 +0100
committerAdam Spiers <stow@adamspiers.org>2019-06-28 01:02:48 +0100
commit6233298a9112f8637a9a99e3590ef1d2b2e96b84 (patch)
tree11a52549fae7727ebd93b855c036aade4c2bbb7f
parentba48fd39089010c6a0a40aecc6a9e8f0a2241e04 (diff)
downloadstow-6233298a9112f8637a9a99e3590ef1d2b2e96b84.tar.gz
Replace testutil::make_dir with File::Path::make_path
No need for a custom function here.
-rwxr-xr-xt/chkstow.t26
-rwxr-xr-xt/cleanup_invalid_links.t10
-rwxr-xr-xt/cli_options.t2
-rwxr-xr-xt/dotfiles.t12
-rwxr-xr-xt/examples.t30
-rwxr-xr-xt/find_stowed_path.t4
-rwxr-xr-xt/foldable.t18
-rwxr-xr-xt/ignore.t6
-rwxr-xr-xt/stow.t84
-rwxr-xr-xt/testutil.pm29
-rwxr-xr-xt/unstow.t78
-rwxr-xr-xt/unstow_orig.t57
12 files changed, 167 insertions, 189 deletions
diff --git a/t/chkstow.t b/t/chkstow.t
index 36516a6..6e066c2 100755
--- a/t/chkstow.t
+++ b/t/chkstow.t
@@ -33,43 +33,43 @@ init_test_dirs();
cd("$TEST_DIR/target");
# setup stow directory
-make_dir('stow');
+make_path('stow');
make_file('stow/.stow');
# perl
-make_dir('stow/perl/bin');
+make_path('stow/perl/bin');
make_file('stow/perl/bin/perl');
make_file('stow/perl/bin/a2p');
-make_dir('stow/perl/info');
+make_path('stow/perl/info');
make_file('stow/perl/info/perl');
-make_dir('stow/perl/lib/perl');
-make_dir('stow/perl/man/man1');
+make_path('stow/perl/lib/perl');
+make_path('stow/perl/man/man1');
make_file('stow/perl/man/man1/perl.1');
# emacs
-make_dir('stow/emacs/bin');
+make_path('stow/emacs/bin');
make_file('stow/emacs/bin/emacs');
make_file('stow/emacs/bin/etags');
-make_dir('stow/emacs/info');
+make_path('stow/emacs/info');
make_file('stow/emacs/info/emacs');
-make_dir('stow/emacs/libexec/emacs');
-make_dir('stow/emacs/man/man1');
+make_path('stow/emacs/libexec/emacs');
+make_path('stow/emacs/man/man1');
make_file('stow/emacs/man/man1/emacs.1');
#setup target directory
-make_dir('bin');
+make_path('bin');
make_link('bin/a2p', '../stow/perl/bin/a2p');
make_link('bin/emacs', '../stow/emacs/bin/emacs');
make_link('bin/etags', '../stow/emacs/bin/etags');
make_link('bin/perl', '../stow/perl/bin/perl');
-make_dir('info');
+make_path('info');
make_link('info/emacs', '../stow/emacs/info/emacs');
make_link('info/perl', '../stow/perl/info/perl');
make_link('lib', 'stow/perl/lib');
make_link('libexec', 'stow/emacs/libexec');
-make_dir('man');
-make_dir('man/man1');
+make_path('man');
+make_path('man/man1');
make_link('man/man1/emacs', '../../stow/emacs/man/man1/emacs.1');
make_link('man/man1/perl', '../../stow/perl/man/man1/perl.1');
diff --git a/t/cleanup_invalid_links.t b/t/cleanup_invalid_links.t
index 3fd5e0d..3b54b71 100755
--- a/t/cleanup_invalid_links.t
+++ b/t/cleanup_invalid_links.t
@@ -39,7 +39,7 @@ my $stow;
#
-make_dir('../stow/pkg1/bin1');
+make_path('../stow/pkg1/bin1');
make_file('../stow/pkg1/bin1/file1');
make_link('bin1', '../stow/pkg1/bin1');
@@ -53,8 +53,8 @@ is(
#
# cleanup a bad link in a simple tree
#
-make_dir('bin2');
-make_dir('../stow/pkg2/bin2');
+make_path('bin2');
+make_path('../stow/pkg2/bin2');
make_file('../stow/pkg2/bin2/file2a');
make_link('bin2/file2a', '../../stow/pkg2/bin2/file2a');
make_invalid_link('bin2/file2b', '../../stow/pkg2/bin2/file2b');
@@ -69,8 +69,8 @@ is($stow->link_task_action('bin2/file2b'), 'remove', 'removal task for bad link'
# dont cleanup a bad link not owned by stow
#
-make_dir('bin3');
-make_dir('../stow/pkg3/bin3');
+make_path('bin3');
+make_path('../stow/pkg3/bin3');
make_file('../stow/pkg3/bin3/file3a');
make_link('bin3/file3a', '../../stow/pkg3/bin3/file3a');
make_invalid_link('bin3/file3b', '../../empty');
diff --git a/t/cli_options.t b/t/cli_options.t
index c63e33e..8b73bf5 100755
--- a/t/cli_options.t
+++ b/t/cli_options.t
@@ -104,7 +104,7 @@ local @ARGV = (
"--target=$TEST_DIR/".'$HOME',
'dummy'
);
-make_dir("$TEST_DIR/".'$HOME');
+make_path("$TEST_DIR/".'$HOME');
($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
is($options->{target}, "$TEST_DIR/".'$HOME', 'no expansion');
remove_dir("$TEST_DIR/".'$HOME');
diff --git a/t/dotfiles.t b/t/dotfiles.t
index db5a8bb..a4a45c8 100755
--- a/t/dotfiles.t
+++ b/t/dotfiles.t
@@ -40,7 +40,7 @@ my $stow;
$stow = new_Stow(dir => '../stow', dotfiles => 1);
-make_dir('../stow/dotfiles');
+make_path('../stow/dotfiles');
make_file('../stow/dotfiles/dot-foo');
$stow->plan_stow('dotfiles');
@@ -57,7 +57,7 @@ is(
$stow = new_Stow(dir => '../stow', dotfiles => 0);
-make_dir('../stow/dotfiles');
+make_path('../stow/dotfiles');
make_file('../stow/dotfiles/dot-foo');
$stow->plan_stow('dotfiles');
@@ -75,7 +75,7 @@ is(
$stow = new_Stow(dir => '../stow', dotfiles => 1);
-make_dir('../stow/dotfiles/dot-emacs');
+make_path('../stow/dotfiles/dot-emacs');
make_file('../stow/dotfiles/dot-emacs/init.el');
$stow->plan_stow('dotfiles');
@@ -93,10 +93,10 @@ is(
$stow = new_Stow(dir => '../stow', dotfiles => 1);
-make_dir('../stow/dotfiles');
+make_path('../stow/dotfiles');
make_file('../stow/dotfiles/dot-');
-make_dir('../stow/dotfiles/dot-.');
+make_path('../stow/dotfiles/dot-.');
make_file('../stow/dotfiles/dot-./foo');
$stow->plan_stow('dotfiles');
@@ -118,7 +118,7 @@ is(
$stow = new_Stow(dir => '../stow', dotfiles => 1);
-make_dir('../stow/dotfiles');
+make_path('../stow/dotfiles');
make_file('../stow/dotfiles/dot-bar');
make_link('.bar', '../stow/dotfiles/dot-bar');
diff --git a/t/examples.t b/t/examples.t
index ead89c3..376de39 100755
--- a/t/examples.t
+++ b/t/examples.t
@@ -35,23 +35,23 @@ my $stow;
## set up some fake packages to stow
# perl
-make_dir('stow/perl/bin');
+make_path('stow/perl/bin');
make_file('stow/perl/bin/perl');
make_file('stow/perl/bin/a2p');
-make_dir('stow/perl/info');
+make_path('stow/perl/info');
make_file('stow/perl/info/perl');
-make_dir('stow/perl/lib/perl');
-make_dir('stow/perl/man/man1');
+make_path('stow/perl/lib/perl');
+make_path('stow/perl/man/man1');
make_file('stow/perl/man/man1/perl.1');
# emacs
-make_dir('stow/emacs/bin');
+make_path('stow/emacs/bin');
make_file('stow/emacs/bin/emacs');
make_file('stow/emacs/bin/etags');
-make_dir('stow/emacs/info');
+make_path('stow/emacs/info');
make_file('stow/emacs/info/emacs');
-make_dir('stow/emacs/libexec/emacs');
-make_dir('stow/emacs/man/man1');
+make_path('stow/emacs/libexec/emacs');
+make_path('stow/emacs/man/man1');
make_file('stow/emacs/man/man1/emacs.1');
#
@@ -81,9 +81,9 @@ remove_link('info');
remove_link('lib');
remove_link('man');
-make_dir('bin');
-make_dir('lib');
-make_dir('man/man1');
+make_path('bin');
+make_path('lib');
+make_path('man/man1');
$stow = new_Stow(dir => 'stow');
$stow->plan_stow('perl');
@@ -157,8 +157,8 @@ ok(
# behaviour is the same as if the empty directory had nothing to do with stow
#
-make_dir('stow/pkg1a/bin1');
-make_dir('stow/pkg1b/bin1');
+make_path('stow/pkg1a/bin1');
+make_path('stow/pkg1b/bin1');
make_file('stow/pkg1b/bin1/file1b');
$stow = new_Stow(dir => 'stow');
@@ -172,10 +172,10 @@ ok(-d 'bin1' => 'bug 1: stowing empty dirs');
# BUG 2: split open tree-folding symlinks pointing inside different stow
# directories
#
-make_dir('stow2a/pkg2a/bin2');
+make_path('stow2a/pkg2a/bin2');
make_file('stow2a/pkg2a/bin2/file2a');
make_file('stow2a/.stow');
-make_dir('stow2b/pkg2b/bin2');
+make_path('stow2b/pkg2b/bin2');
make_file('stow2b/pkg2b/bin2/file2b');
make_file('stow2b/.stow');
diff --git a/t/find_stowed_path.t b/t/find_stowed_path.t
index b4bd28a..8111e66 100755
--- a/t/find_stowed_path.t
+++ b/t/find_stowed_path.t
@@ -44,7 +44,7 @@ is_deeply(
=> 'from target directory'
);
-make_dir('stow');
+make_path('stow');
cd('../..');
$stow->set_stow_dir("$TEST_DIR/target/stow");
@@ -60,7 +60,7 @@ is_deeply(
=> 'target is not stowed'
);
-make_dir("$TEST_DIR/target/stow2");
+make_path("$TEST_DIR/target/stow2");
make_file("$TEST_DIR/target/stow2/.stow");
is_deeply(
diff --git a/t/foldable.t b/t/foldable.t
index 78096d7..e528723 100755
--- a/t/foldable.t
+++ b/t/foldable.t
@@ -38,9 +38,9 @@ my $stow = new_Stow(dir => '../stow');
# can fold a simple tree
#
-make_dir('../stow/pkg1/bin1');
+make_path('../stow/pkg1/bin1');
make_file('../stow/pkg1/bin1/file1');
-make_dir('bin1');
+make_path('bin1');
make_link('bin1/file1','../../stow/pkg1/bin1/file1');
is( $stow->foldable('bin1'), '../stow/pkg1/bin1' => q(can fold a simple tree) );
@@ -49,9 +49,9 @@ is( $stow->foldable('bin1'), '../stow/pkg1/bin1' => q(can fold a simple tree) );
# can't fold an empty directory
#
-make_dir('../stow/pkg2/bin2');
+make_path('../stow/pkg2/bin2');
make_file('../stow/pkg2/bin2/file2');
-make_dir('bin2');
+make_path('bin2');
is( $stow->foldable('bin2'), '' => q(can't fold an empty directory) );
@@ -59,9 +59,9 @@ is( $stow->foldable('bin2'), '' => q(can't fold an empty directory) );
# can't fold if dir contains a non-link
#
-make_dir('../stow/pkg3/bin3');
+make_path('../stow/pkg3/bin3');
make_file('../stow/pkg3/bin3/file3');
-make_dir('bin3');
+make_path('bin3');
make_link('bin3/file3','../../stow/pkg3/bin3/file3');
make_file('bin3/non-link');
@@ -71,11 +71,11 @@ is( $stow->foldable('bin3'), '' => q(can't fold a dir containing non-links) );
# can't fold if links point to different directories
#
-make_dir('bin4');
-make_dir('../stow/pkg4a/bin4');
+make_path('bin4');
+make_path('../stow/pkg4a/bin4');
make_file('../stow/pkg4a/bin4/file4a');
make_link('bin4/file4a','../../stow/pkg4a/bin4/file4a');
-make_dir('../stow/pkg4b/bin4');
+make_path('../stow/pkg4b/bin4');
make_file('../stow/pkg4b/bin4/file4b');
make_link('bin4/file4b','../../stow/pkg4b/bin4/file4b');
diff --git a/t/ignore.t b/t/ignore.t
index 840c6e7..3da9dd4 100755
--- a/t/ignore.t
+++ b/t/ignore.t
@@ -123,7 +123,7 @@ EOF
sub setup_package_local_list {
my ($stow_path, $package, $list) = @_;
my $package_path = join_paths($stow_path, $package);
- make_dir($package_path);
+ make_path($package_path);
my $local_ignore = join_paths($package_path, $Stow::LOCAL_IGNORE_FILE);
make_file($local_ignore, $list);
$stow->invalidate_memoized_regexp($local_ignore);
@@ -278,7 +278,7 @@ sub test_ignore_via_stow {
my ($stow_path) = @_;
my $package = 'pkg1';
- make_dir("$stow_path/$package/foo/bar");
+ make_path("$stow_path/$package/foo/bar");
make_file("$stow_path/$package/foo/bar/baz");
setup_package_local_list($stow_path, $package, 'foo');
@@ -286,7 +286,7 @@ sub test_ignore_via_stow {
is($stow->get_tasks(), 0, 'top dir ignored');
is($stow->get_conflicts(), 0, 'top dir ignored, no conflicts');
- make_dir("foo");
+ make_path("foo");
for my $ignore ('bar', 'foo/bar', '/foo/bar', '^/foo/bar', '^/fo.+ar') {
setup_package_local_list($stow_path, $package, $ignore);
$stow->plan_stow($package);
diff --git a/t/stow.t b/t/stow.t
index 8960916..1755e19 100755
--- a/t/stow.t
+++ b/t/stow.t
@@ -42,7 +42,7 @@ my %conflicts;
#
$stow = new_Stow(dir => '../stow');
-make_dir('../stow/pkg1/bin1');
+make_path('../stow/pkg1/bin1');
make_file('../stow/pkg1/bin1/file1');
$stow->plan_stow('pkg1');
@@ -59,9 +59,9 @@ is(
#
$stow = new_Stow();
-make_dir('../stow/pkg2/lib2');
+make_path('../stow/pkg2/lib2');
make_file('../stow/pkg2/lib2/file2');
-make_dir('lib2');
+make_path('lib2');
$stow->plan_stow('pkg2');
$stow->process_tasks();
@@ -76,11 +76,11 @@ is(
#
$stow = new_Stow();
-make_dir('../stow/pkg3a/bin3');
+make_path('../stow/pkg3a/bin3');
make_file('../stow/pkg3a/bin3/file3a');
make_link('bin3' => '../stow/pkg3a/bin3'); # emulate stow
-make_dir('../stow/pkg3b/bin3');
+make_path('../stow/pkg3b/bin3');
make_file('../stow/pkg3b/bin3/file3b');
$stow->plan_stow('pkg3b');
@@ -99,7 +99,7 @@ ok(
$stow = new_Stow();
make_file('bin4'); # this is a file but named like a directory
-make_dir('../stow/pkg4/bin4');
+make_path('../stow/pkg4/bin4');
make_file('../stow/pkg4/bin4/file4');
$stow->plan_stow('pkg4');
@@ -119,7 +119,7 @@ ok(
$stow = new_Stow();
make_file('bin4a'); # this is a file but named like a directory
-make_dir('../stow/pkg4a/bin4a');
+make_path('../stow/pkg4a/bin4a');
make_file('../stow/pkg4a/bin4a/file4a');
$stow->plan_stow('pkg4a');
@@ -139,11 +139,11 @@ $stow = new_Stow();
# Populate target
make_file('file4b', 'file4b - version originally in target');
-make_dir ('bin4b');
+make_path ('bin4b');
make_file('bin4b/file4b', 'bin4b/file4b - version originally in target');
# Populate
-make_dir ('../stow/pkg4b/bin4b');
+make_path ('../stow/pkg4b/bin4b');
make_file('../stow/pkg4b/file4b', 'file4b - version originally in stow package');
make_file('../stow/pkg4b/bin4b/file4b', 'bin4b/file4b - version originally in stow package');
@@ -166,11 +166,11 @@ $stow = new_Stow(adopt => 1);
# Populate target
make_file('file4c', "file4c - version originally in target\n");
-make_dir ('bin4c');
+make_path ('bin4c');
make_file('bin4c/file4c', "bin4c/file4c - version originally in target\n");
# Populate
-make_dir ('../stow/pkg4c/bin4c');
+make_path ('../stow/pkg4c/bin4c');
make_file('../stow/pkg4c/file4c', "file4c - version originally in stow package\n");
make_file('../stow/pkg4c/bin4c/file4c', "bin4c/file4c - version originally in stow package\n");
@@ -194,9 +194,9 @@ for my $file ('file4c', 'bin4c/file4c') {
#
$stow = new_Stow();
-make_dir('bin5');
+make_path('bin5');
make_invalid_link('bin5/file5','../../empty');
-make_dir('../stow/pkg5/bin5/file5');
+make_path('../stow/pkg5/bin5/file5');
$stow->plan_stow('pkg5');
%conflicts = $stow->get_conflicts();
@@ -212,7 +212,7 @@ like(
$stow = new_Stow();
make_invalid_link('file6','../stow/path-does-not-exist');
-make_dir('../stow/pkg6');
+make_path('../stow/pkg6');
make_file('../stow/pkg6/file6');
$stow->plan_stow('pkg6');
@@ -229,11 +229,11 @@ is(
#
$stow = new_Stow();
-make_dir('bin7');
-make_dir('../stow/pkg7a/bin7');
+make_path('bin7');
+make_path('../stow/pkg7a/bin7');
make_file('../stow/pkg7a/bin7/node7');
make_link('bin7/node7','../../stow/pkg7a/bin7/node7');
-make_dir('../stow/pkg7b/bin7/node7');
+make_path('../stow/pkg7b/bin7/node7');
make_file('../stow/pkg7b/bin7/node7/file7');
$stow->plan_stow('pkg7b');
@@ -249,11 +249,11 @@ like(
#
$stow = new_Stow();
-make_dir('../stow/pkg8a/0');
+make_path('../stow/pkg8a/0');
make_file('../stow/pkg8a/0/file8a');
make_link('0' => '../stow/pkg8a/0'); # emulate stow
-make_dir('../stow/pkg8b/0');
+make_path('../stow/pkg8b/0');
make_file('../stow/pkg8b/0/file8b');
$stow->plan_stow('pkg8b');
@@ -271,12 +271,12 @@ ok(
#
$stow = new_Stow(override => ['man9', 'info9']);
-make_dir('../stow/pkg9a/man9/man1');
+make_path('../stow/pkg9a/man9/man1');
make_file('../stow/pkg9a/man9/man1/file9.1');
-make_dir('man9/man1');
+make_path('man9/man1');
make_link('man9/man1/file9.1' => '../../../stow/pkg9a/man9/man1/file9.1'); # emulate stow
-make_dir('../stow/pkg9b/man9/man1');
+make_path('../stow/pkg9b/man9/man1');
make_file('../stow/pkg9b/man9/man1/file9.1');
$stow->plan_stow('pkg9b');
@@ -292,12 +292,12 @@ ok(
#
$stow = new_Stow(defer => ['man10', 'info10']);
-make_dir('../stow/pkg10a/man10/man1');
+make_path('../stow/pkg10a/man10/man1');
make_file('../stow/pkg10a/man10/man1/file10.1');
-make_dir('man10/man1');
+make_path('man10/man1');
make_link('man10/man1/file10.1' => '../../../stow/pkg10a/man10/man1/file10.1'); # emulate stow
-make_dir('../stow/pkg10b/man10/man1');
+make_path('../stow/pkg10b/man10/man1');
make_file('../stow/pkg10b/man10/man1/file10.1');
$stow->plan_stow('pkg10b');
@@ -313,11 +313,11 @@ ok(
#
$stow = new_Stow(ignore => ['~', '\.#.*']);
-make_dir('../stow/pkg11/man11/man1');
+make_path('../stow/pkg11/man11/man1');
make_file('../stow/pkg11/man11/man1/file11.1');
make_file('../stow/pkg11/man11/man1/file11.1~');
make_file('../stow/pkg11/man11/man1/.#file11.1');
-make_dir('man11/man1');
+make_path('man11/man1');
$stow->plan_stow('pkg11');
$stow->process_tasks();
@@ -334,11 +334,11 @@ ok(
#
$stow = new_Stow();
-make_dir('../stow/pkg12/lib12/');
+make_path('../stow/pkg12/lib12/');
make_file('../stow/pkg12/lib12/lib.so.1');
make_link('../stow/pkg12/lib12/lib.so', 'lib.so.1');
-make_dir('lib12/');
+make_path('lib12/');
$stow->plan_stow('pkg12');
$stow->process_tasks();
@@ -354,12 +354,12 @@ ok(
#
$stow = new_Stow();
-make_dir('../stow/pkg13a/lib13/');
+make_path('../stow/pkg13a/lib13/');
make_file('../stow/pkg13a/lib13/liba.so.1');
make_link('../stow/pkg13a/lib13/liba.so', 'liba.so.1');
make_link('lib13','../stow/pkg13a/lib13');
-make_dir('../stow/pkg13b/lib13/');
+make_path('../stow/pkg13b/lib13/');
make_file('../stow/pkg13b/lib13/libb.so.1');
make_link('../stow/pkg13b/lib13/libb.so', 'libb.so.1');
@@ -377,10 +377,10 @@ ok(
#
# stowing to stow dir should fail
#
-make_dir('stow');
+make_path('stow');
$stow = new_Stow(dir => 'stow');
-make_dir('stow/pkg14/stow/pkg15');
+make_path('stow/pkg14/stow/pkg15');
make_file('stow/pkg14/stow/pkg15/node15');
capture_stderr();
@@ -402,7 +402,7 @@ uncapture_stderr();
cd('../..');
$stow = new_Stow(dir => "$TEST_DIR/stow", target => "$TEST_DIR/target");
-make_dir("$TEST_DIR/stow/pkg16/bin16");
+make_path("$TEST_DIR/stow/pkg16/bin16");
make_file("$TEST_DIR/stow/pkg16/bin16/file16");
$stow->plan_stow('pkg16');
@@ -421,7 +421,7 @@ is(
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => "$TEST_DIR/target");
-make_dir("$TEST_DIR/stow/pkg17/bin17");
+make_path("$TEST_DIR/stow/pkg17/bin17");
make_file("$TEST_DIR/stow/pkg17/bin17/file17");
$stow->plan_stow('pkg17');
@@ -440,7 +440,7 @@ is(
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => canon_path("$TEST_DIR/target"));
-make_dir("$TEST_DIR/stow/pkg18/bin18");
+make_path("$TEST_DIR/stow/pkg18/bin18");
make_file("$TEST_DIR/stow/pkg18/bin18/file18");
$stow->plan_stow('pkg18');
@@ -464,32 +464,32 @@ sub create_pkg {
my ($id, $pkg) = @_;
my $stow_pkg = "../stow/$id-$pkg";
- make_dir ($stow_pkg);
+ make_path ($stow_pkg);
make_file("$stow_pkg/$id-file-$pkg");
# create a shallow hierarchy specific to this package which isn't
# yet stowed
- make_dir ("$stow_pkg/$id-$pkg-only-new");
+ make_path ("$stow_pkg/$id-$pkg-only-new");
make_file("$stow_pkg/$id-$pkg-only-new/$id-file-$pkg");
# create a deeper hierarchy specific to this package which isn't
# yet stowed
- make_dir ("$stow_pkg/$id-$pkg-only-new2/subdir");
+ make_path ("$stow_pkg/$id-$pkg-only-new2/subdir");
make_file("$stow_pkg/$id-$pkg-only-new2/subdir/$id-file-$pkg");
make_link("$stow_pkg/$id-$pkg-only-new2/current", "subdir");
# create a hierarchy specific to this package which is already
# stowed via a folded tree
- make_dir ("$stow_pkg/$id-$pkg-only-old");
+ make_path ("$stow_pkg/$id-$pkg-only-old");
make_link("$id-$pkg-only-old", "$stow_pkg/$id-$pkg-only-old");
make_file("$stow_pkg/$id-$pkg-only-old/$id-file-$pkg");
# create a shared hierarchy which this package uses
- make_dir ("$stow_pkg/$id-shared");
+ make_path ("$stow_pkg/$id-shared");
make_file("$stow_pkg/$id-shared/$id-file-$pkg");
# create a partially shared hierarchy which this package uses
- make_dir ("$stow_pkg/$id-shared2/subdir-$pkg");
+ make_path ("$stow_pkg/$id-shared2/subdir-$pkg");
make_file("$stow_pkg/$id-shared2/$id-file-$pkg");
make_file("$stow_pkg/$id-shared2/subdir-$pkg/$id-file-$pkg");
}
diff --git a/t/testutil.pm b/t/testutil.pm
index a3eb69a..3510ab5 100755
--- a/t/testutil.pm
+++ b/t/testutil.pm
@@ -26,7 +26,7 @@ use warnings;
use Carp qw(croak);
use File::Basename;
-use File::Path qw(remove_tree);
+use File::Path qw(make_path remove_tree);
use File::Spec;
use IO::Scalar;
use Test::More;
@@ -41,7 +41,7 @@ our @EXPORT = qw(
init_test_dirs
cd
new_Stow new_compat_Stow
- make_dir make_link make_invalid_link make_file
+ make_path make_link make_invalid_link make_file
remove_dir remove_link
cat_file
is_link is_dir_not_symlink is_nonexistent_path
@@ -66,7 +66,7 @@ sub uncapture_stderr {
sub init_test_dirs {
for my $dir ("$TEST_DIR/target", "$TEST_DIR/stow") {
-d $dir and remove_tree($dir);
- make_dir($dir);
+ make_path($dir);
}
# Don't let user's ~/.stow-global-ignore affect test results
@@ -139,29 +139,6 @@ sub make_invalid_link {
}
#===== SUBROUTINE ===========================================================
-# Name : make_dir()
-# Purpose : create a directory and any requisite parents
-# Parameters: $dir => path to the new directory
-# Returns : n/a
-# Throws : fatal error if the directory or any of its parents cannot be
-# : created
-# Comments : none
-#============================================================================
-sub make_dir {
- my ($dir) = @_;
-
- my @parents = ();
- for my $part (split '/', $dir) {
- my $path = join '/', @parents, $part;
- if (not -d $path and not mkdir $path) {
- die "could not create directory: $path ($!)\n";
- }
- push @parents, $part;
- }
- return;
-}
-
-#===== SUBROUTINE ===========================================================
# Name : create_file()
# Purpose : create an empty file
# Parameters: $path => proposed path to the file
diff --git a/t/unstow.t b/t/unstow.t
index b25e8ad..5cabf26 100755
--- a/t/unstow.t
+++ b/t/unstow.t
@@ -42,7 +42,7 @@ my %conflicts;
#
$stow = new_Stow();
-make_dir('../stow/pkg1/bin1');
+make_path('../stow/pkg1/bin1');
make_file('../stow/pkg1/bin1/file1');
make_link('bin1', '../stow/pkg1/bin1');
@@ -59,8 +59,8 @@ ok(
#
$stow = new_Stow();
-make_dir('lib2');
-make_dir('../stow/pkg2/lib2');
+make_path('lib2');
+make_path('../stow/pkg2/lib2');
make_file('../stow/pkg2/lib2/file2');
make_link('lib2/file2', '../../stow/pkg2/lib2/file2');
$stow->plan_unstow('pkg2');
@@ -76,13 +76,13 @@ ok(
#
$stow = new_Stow();
-make_dir('bin3');
+make_path('bin3');
-make_dir('../stow/pkg3a/bin3');
+make_path('../stow/pkg3a/bin3');
make_file('../stow/pkg3a/bin3/file3a');
make_link('bin3/file3a' => '../../stow/pkg3a/bin3/file3a'); # emulate stow
-make_dir('../stow/pkg3b/bin3');
+make_path('../stow/pkg3b/bin3');
make_file('../stow/pkg3b/bin3/file3b');
make_link('bin3/file3b' => '../../stow/pkg3b/bin3/file3b'); # emulate stow
$stow->plan_unstow('pkg3b');
@@ -99,8 +99,8 @@ ok(
#
$stow = new_Stow();
-make_dir('bin4');
-make_dir('../stow/pkg4/bin4');
+make_path('bin4');
+make_path('../stow/pkg4/bin4');
make_file('../stow/pkg4/bin4/file4');
make_invalid_link('bin4/file4', '../../stow/pkg4/bin4/does-not-exist');
@@ -117,7 +117,7 @@ ok(
#
$stow = new_Stow();
-make_dir('../stow/pkg5/bin5');
+make_path('../stow/pkg5/bin5');
make_invalid_link('bin5', '../not-stow');
$stow->plan_unstow('pkg5');
@@ -133,12 +133,12 @@ like(
#
$stow = new_Stow();
-make_dir('bin6');
-make_dir('../stow/pkg6a/bin6');
+make_path('bin6');
+make_path('../stow/pkg6a/bin6');
make_file('../stow/pkg6a/bin6/file6');
make_link('bin6/file6', '../../stow/pkg6a/bin6/file6');
-make_dir('../stow/pkg6b/bin6');
+make_path('../stow/pkg6b/bin6');
make_file('../stow/pkg6b/bin6/file6');
$stow->plan_unstow('pkg6b');
@@ -152,11 +152,11 @@ ok(
#
# Don't unlink anything under the stow directory
#
-make_dir('stow'); # make out stow dir a subdir of target
+make_path('stow'); # make out stow dir a subdir of target
$stow = new_Stow(dir => 'stow');
# emulate stowing into ourself (bizarre corner case or accident)
-make_dir('stow/pkg7a/stow/pkg7b');
+make_path('stow/pkg7a/stow/pkg7b');
make_file('stow/pkg7a/stow/pkg7b/file7b');
make_link('stow/pkg7b', '../stow/pkg7a/stow/pkg7b');
@@ -175,11 +175,11 @@ ok(
#
$stow = new_Stow(dir => 'stow');
-make_dir('stow2'); # make our alternate stow dir a subdir of target
+make_path('stow2'); # make our alternate stow dir a subdir of target
make_file('stow2/.stow');
# emulate stowing into ourself (bizarre corner case or accident)
-make_dir('stow/pkg8a/stow2/pkg8b');
+make_path('stow/pkg8a/stow2/pkg8b');
make_file('stow/pkg8a/stow2/pkg8b/file8b');
make_link('stow2/pkg8b', '../stow/pkg8a/stow2/pkg8b');
@@ -203,12 +203,12 @@ uncapture_stderr();
$stow = new_Stow(override => ['man9', 'info9']);
make_file('stow/.stow');
-make_dir('../stow/pkg9a/man9/man1');
+make_path('../stow/pkg9a/man9/man1');
make_file('../stow/pkg9a/man9/man1/file9.1');
-make_dir('man9/man1');
+make_path('man9/man1');
make_link('man9/man1/file9.1' => '../../../stow/pkg9a/man9/man1/file9.1'); # emulate stow
-make_dir('../stow/pkg9b/man9/man1');
+make_path('../stow/pkg9b/man9/man1');
make_file('../stow/pkg9b/man9/man1/file9.1');
$stow->plan_unstow('pkg9b');
$stow->process_tasks();
@@ -223,18 +223,18 @@ ok(
#
$stow = new_Stow(defer => ['man10', 'info10']);
-make_dir('../stow/pkg10a/man10/man1');
+make_path('../stow/pkg10a/man10/man1');
make_file('../stow/pkg10a/man10/man1/file10a.1');
-make_dir('man10/man1');
+make_path('man10/man1');
make_link('man10/man1/file10a.1' => '../../../stow/pkg10a/man10/man1/file10a.1');
# need this to block folding
-make_dir('../stow/pkg10b/man10/man1');
+make_path('../stow/pkg10b/man10/man1');
make_file('../stow/pkg10b/man10/man1/file10b.1');
make_link('man10/man1/file10b.1' => '../../../stow/pkg10b/man10/man1/file10b.1');
-make_dir('../stow/pkg10c/man10/man1');
+make_path('../stow/pkg10c/man10/man1');
make_file('../stow/pkg10c/man10/man1/file10a.1');
$stow->plan_unstow('pkg10c');
is($stow->get_tasks, 0, 'no tasks to process when unstowing pkg10c');
@@ -249,11 +249,11 @@ ok(
#
$stow = new_Stow(ignore => ['~', '\.#.*']);
-make_dir('../stow/pkg12/man12/man1');
+make_path('../stow/pkg12/man12/man1');
make_file('../stow/pkg12/man12/man1/file12.1');
make_file('../stow/pkg12/man12/man1/file12.1~');
make_file('../stow/pkg12/man12/man1/.#file12.1');
-make_dir('man12/man1');
+make_path('man12/man1');
make_link('man12/man1/file12.1' => '../../../stow/pkg12/man12/man1/file12.1');
$stow->plan_unstow('pkg12');
@@ -312,7 +312,7 @@ ok(
cd('../..');
$stow = new_Stow(dir => "$TEST_DIR/stow", target => "$TEST_DIR/target");
-make_dir("$TEST_DIR/stow/pkg13/bin13");
+make_path("$TEST_DIR/stow/pkg13/bin13");
make_file("$TEST_DIR/stow/pkg13/bin13/file13");
make_link("$TEST_DIR/target/bin13", '../stow/pkg13/bin13');
@@ -331,7 +331,7 @@ ok(
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => "$TEST_DIR/target");
-make_dir("$TEST_DIR/stow/pkg14/bin14");
+make_path("$TEST_DIR/stow/pkg14/bin14");
make_file("$TEST_DIR/stow/pkg14/bin14/file14");
make_link("$TEST_DIR/target/bin14", '../stow/pkg14/bin14');
@@ -350,7 +350,7 @@ ok(
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => canon_path("$TEST_DIR/target"));
-make_dir("$TEST_DIR/stow/pkg15/bin15");
+make_path("$TEST_DIR/stow/pkg15/bin15");
make_file("$TEST_DIR/stow/pkg15/bin15/file15");
make_link("$TEST_DIR/target/bin15", '../stow/pkg15/bin15');
@@ -372,52 +372,52 @@ sub create_and_stow_pkg {
my ($id, $pkg) = @_;
my $stow_pkg = "../stow/$id-$pkg";
- make_dir ($stow_pkg);
+ make_path ($stow_pkg);
make_file("$stow_pkg/$id-file-$pkg");
# create a shallow hierarchy specific to this package and stow
# via folding
- make_dir ("$stow_pkg/$id-$pkg-only-folded");
+ make_path ("$stow_pkg/$id-$pkg-only-folded");
make_file("$stow_pkg/$id-$pkg-only-folded/file-$pkg");
make_link("$id-$pkg-only-folded", "$stow_pkg/$id-$pkg-only-folded");
# create a deeper hierarchy specific to this package and stow
# via folding
- make_dir ("$stow_pkg/$id-$pkg-only-folded2/subdir");
+ make_path ("$stow_pkg/$id-$pkg-only-folded2/subdir");
make_file("$stow_pkg/$id-$pkg-only-folded2/subdir/file-$pkg");
make_link("$id-$pkg-only-folded2",
"$stow_pkg/$id-$pkg-only-folded2");
# create a shallow hierarchy specific to this package and stow
# without folding
- make_dir ("$stow_pkg/$id-$pkg-only-unfolded");
+ make_path ("$stow_pkg/$id-$pkg-only-unfolded");
make_file("$stow_pkg/$id-$pkg-only-unfolded/file-$pkg");
- make_dir ("$id-$pkg-only-unfolded");
+ make_path ("$id-$pkg-only-unfolded");
make_link("$id-$pkg-only-unfolded/file-$pkg",
"../$stow_pkg/$id-$pkg-only-unfolded/file-$pkg");
# create a deeper hierarchy specific to this package and stow
# without folding
- make_dir ("$stow_pkg/$id-$pkg-only-unfolded2/subdir");
+ make_path ("$stow_pkg/$id-$pkg-only-unfolded2/subdir");
make_file("$stow_pkg/$id-$pkg-only-unfolded2/subdir/file-$pkg");
- make_dir ("$id-$pkg-only-unfolded2/subdir");
+ make_path ("$id-$pkg-only-unfolded2/subdir");
make_link("$id-$pkg-only-unfolded2/subdir/file-$pkg",
"../../$stow_pkg/$id-$pkg-only-unfolded2/subdir/file-$pkg");
# create a shallow shared hierarchy which this package uses, and stow
# its contents without folding
- make_dir ("$stow_pkg/$id-shared");
+ make_path ("$stow_pkg/$id-shared");
make_file("$stow_pkg/$id-shared/file-$pkg");
- make_dir ("$id-shared");
+ make_path ("$id-shared");
make_link("$id-shared/file-$pkg",
"../$stow_pkg/$id-shared/file-$pkg");
# create a deeper shared hierarchy which this package uses, and stow
# its contents without folding
- make_dir ("$stow_pkg/$id-shared2/subdir");
+ make_path ("$stow_pkg/$id-shared2/subdir");
make_file("$stow_pkg/$id-shared2/file-$pkg");
make_file("$stow_pkg/$id-shared2/subdir/file-$pkg");
- make_dir ("$id-shared2/subdir");
+ make_path ("$id-shared2/subdir");
make_link("$id-shared2/file-$pkg",
"../$stow_pkg/$id-shared2/file-$pkg");
make_link("$id-shared2/subdir/file-$pkg",
diff --git a/t/unstow_orig.t b/t/unstow_orig.t
index 4b62068..6d5ff8d 100755
--- a/t/unstow_orig.t
+++ b/t/unstow_orig.t
@@ -22,6 +22,7 @@
use strict;
use warnings;
+use File::Spec qw(make_path);
use Test::More tests => 37;
use Test::Output;
use English qw(-no_match_vars);
@@ -43,7 +44,7 @@ my %conflicts;
$stow = new_compat_Stow();
-make_dir('../stow/pkg1/bin1');
+make_path('../stow/pkg1/bin1');
make_file('../stow/pkg1/bin1/file1');
make_link('bin1', '../stow/pkg1/bin1');
@@ -60,8 +61,8 @@ ok(
#
$stow = new_compat_Stow();
-make_dir('lib2');
-make_dir('../stow/pkg2/lib2');
+make_path('lib2');
+make_path('../stow/pkg2/lib2');
make_file('../stow/pkg2/lib2/file2');
make_link('lib2/file2', '../../stow/pkg2/lib2/file2');
$stow->plan_unstow('pkg2');
@@ -77,13 +78,13 @@ ok(
#
$stow = new_compat_Stow();
-make_dir('bin3');
+make_path('bin3');
-make_dir('../stow/pkg3a/bin3');
+make_path('../stow/pkg3a/bin3');
make_file('../stow/pkg3a/bin3/file3a');
make_link('bin3/file3a' => '../../stow/pkg3a/bin3/file3a'); # emulate stow
-make_dir('../stow/pkg3b/bin3');
+make_path('../stow/pkg3b/bin3');
make_file('../stow/pkg3b/bin3/file3b');
make_link('bin3/file3b' => '../../stow/pkg3b/bin3/file3b'); # emulate stow
$stow->plan_unstow('pkg3b');
@@ -100,8 +101,8 @@ ok(
#
$stow = new_compat_Stow();
-make_dir('bin4');
-make_dir('../stow/pkg4/bin4');
+make_path('bin4');
+make_path('../stow/pkg4/bin4');
make_file('../stow/pkg4/bin4/file4');
make_invalid_link('bin4/file4', '../../stow/pkg4/bin4/does-not-exist');
@@ -118,7 +119,7 @@ ok(
#
$stow = new_compat_Stow();
-make_dir('../stow/pkg5/bin5');
+make_path('../stow/pkg5/bin5');
make_invalid_link('bin5', '../not-stow');
$stow->plan_unstow('pkg5');
@@ -139,12 +140,12 @@ ok(
#
$stow = new_compat_Stow();
-make_dir('bin6');
-make_dir('../stow/pkg6a/bin6');
+make_path('bin6');
+make_path('../stow/pkg6a/bin6');
make_file('../stow/pkg6a/bin6/file6');
make_link('bin6/file6', '../../stow/pkg6a/bin6/file6');
-make_dir('../stow/pkg6b/bin6');
+make_path('../stow/pkg6b/bin6');
make_file('../stow/pkg6b/bin6/file6');
$stow->plan_unstow('pkg6b');
@@ -158,11 +159,11 @@ ok(
#
# Don't unlink anything under the stow directory
#
-make_dir('stow'); # make out stow dir a subdir of target
+make_path('stow'); # make out stow dir a subdir of target
$stow = new_compat_Stow(dir => 'stow');
# emulate stowing into ourself (bizarre corner case or accident)
-make_dir('stow/pkg7a/stow/pkg7b');
+make_path('stow/pkg7a/stow/pkg7b');
make_file('stow/pkg7a/stow/pkg7b/file7b');
make_link('stow/pkg7b', '../stow/pkg7a/stow/pkg7b');
@@ -185,11 +186,11 @@ uncapture_stderr();
#
$stow = new_compat_Stow(dir => 'stow');
-make_dir('stow2'); # make our alternate stow dir a subdir of target
+make_path('stow2'); # make our alternate stow dir a subdir of target
make_file('stow2/.stow');
# emulate stowing into ourself (bizarre corner case or accident)
-make_dir('stow/pkg8a/stow2/pkg8b');
+make_path('stow/pkg8a/stow2/pkg8b');
make_file('stow/pkg8a/stow2/pkg8b/file8b');
make_link('stow2/pkg8b', '../stow/pkg8a/stow2/pkg8b');
@@ -224,12 +225,12 @@ sub check_protected_dirs_skipped {
$stow = new_compat_Stow(override => ['man9', 'info9']);
make_file('stow/.stow');
-make_dir('../stow/pkg9a/man9/man1');
+make_path('../stow/pkg9a/man9/man1');
make_file('../stow/pkg9a/man9/man1/file9.1');
-make_dir('man9/man1');
+make_path('man9/man1');
make_link('man9/man1/file9.1' => '../../../stow/pkg9a/man9/man1/file9.1'); # emulate stow
-make_dir('../stow/pkg9b/man9/man1');
+make_path('../stow/pkg9b/man9/man1');
make_file('../stow/pkg9b/man9/man1/file9.1');
capture_stderr();
$stow->plan_unstow('pkg9b');
@@ -246,18 +247,18 @@ check_protected_dirs_skipped();
#
$stow = new_compat_Stow(defer => ['man10', 'info10']);
-make_dir('../stow/pkg10a/man10/man1');
+make_path('../stow/pkg10a/man10/man1');
make_file('../stow/pkg10a/man10/man1/file10a.1');
-make_dir('man10/man1');
+make_path('man10/man1');
make_link('man10/man1/file10a.1' => '../../../stow/pkg10a/man10/man1/file10a.1');
# need this to block folding
-make_dir('../stow/pkg10b/man10/man1');
+make_path('../stow/pkg10b/man10/man1');
make_file('../stow/pkg10b/man10/man1/file10b.1');
make_link('man10/man1/file10b.1' => '../../../stow/pkg10b/man10/man1/file10b.1');
-make_dir('../stow/pkg10c/man10/man1');
+make_path('../stow/pkg10c/man10/man1');
make_file('../stow/pkg10c/man10/man1/file10a.1');
capture_stderr();
$stow->plan_unstow('pkg10c');
@@ -274,11 +275,11 @@ check_protected_dirs_skipped();
#
$stow = new_compat_Stow(ignore => ['~', '\.#.*']);
-make_dir('../stow/pkg12/man12/man1');
+make_path('../stow/pkg12/man12/man1');
make_file('../stow/pkg12/man12/man1/file12.1');
make_file('../stow/pkg12/man12/man1/file12.1~');
make_file('../stow/pkg12/man12/man1/.#file12.1');
-make_dir('man12/man1');
+make_path('man12/man1');
make_link('man12/man1/file12.1' => '../../../stow/pkg12/man12/man1/file12.1');
capture_stderr();
@@ -345,7 +346,7 @@ check_protected_dirs_skipped();
cd('../..');
$stow = new_Stow(dir => "$TEST_DIR/stow", target => "$TEST_DIR/target");
-make_dir("$TEST_DIR/stow/pkg13/bin13");
+make_path("$TEST_DIR/stow/pkg13/bin13");
make_file("$TEST_DIR/stow/pkg13/bin13/file13");
make_link("$TEST_DIR/target/bin13", '../stow/pkg13/bin13');
@@ -364,7 +365,7 @@ ok(
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => "$TEST_DIR/target");
-make_dir("$TEST_DIR/stow/pkg14/bin14");
+make_path("$TEST_DIR/stow/pkg14/bin14");
make_file("$TEST_DIR/stow/pkg14/bin14/file14");
make_link("$TEST_DIR/target/bin14", '../stow/pkg14/bin14');
@@ -383,7 +384,7 @@ ok(
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => canon_path("$TEST_DIR/target"));
-make_dir("$TEST_DIR/stow/pkg15/bin15");
+make_path("$TEST_DIR/stow/pkg15/bin15");
make_file("$TEST_DIR/stow/pkg15/bin15/file15");
make_link("$TEST_DIR/target/bin15", '../stow/pkg15/bin15');