summaryrefslogtreecommitdiff
path: root/sync-all
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-12-09 19:34:28 +0000
committerIan Lynagh <ian@well-typed.com>2012-12-09 19:34:28 +0000
commitb339dd488119b491da2631e95170ebaa12efea31 (patch)
tree4c081d0eec0452f7a882ba0bd8c4eca1aac29200 /sync-all
parent713c514d9edb49405b405b120a3d6807a6819100 (diff)
downloadhaskell-b339dd488119b491da2631e95170ebaa12efea31.tar.gz
Change how sync-all handles directory changes
We now remember the current working directory right at the start, and change back to it after we've finished working in a subdirectory. This should fix a problem some people have been seeing, where sync-all thinks that they have an out-of-date time library because its working directory has gone wrong somehow.
Diffstat (limited to 'sync-all')
-rwxr-xr-xsync-all27
1 files changed, 14 insertions, 13 deletions
diff --git a/sync-all b/sync-all
index 9aa40d5fb8..225ad36a44 100755
--- a/sync-all
+++ b/sync-all
@@ -5,6 +5,8 @@ use Cwd;
$| = 1; # autoflush stdout after each print, to avoid output after die
+my $initial_working_directory;
+
my $defaultrepo;
my @packages;
my $verbose = 2;
@@ -143,13 +145,11 @@ sub gitNewWorkdir {
my $dir = shift;
my $target = shift;
my $target_dir = "$target/$dir";
- my $pwd;
if ($dir eq '.') {
message "== running git-new-workdir . $target_dir @_";
} else {
message "== $dir: running git-new-workdir . $target_dir @_";
- $pwd = getcwd();
chdir($dir);
}
@@ -158,20 +158,18 @@ sub gitNewWorkdir {
or die "git-new-workdir failed: $?";
if ($dir ne '.') {
- chdir($pwd);
+ chdir($initial_working_directory);
}
}
sub scm {
my $dir = shift;
my $scm = shift;
- my $pwd;
if ($dir eq '.') {
message "== running $scm @_";
} else {
message "== $dir: running $scm @_";
- $pwd = getcwd();
chdir($dir);
}
@@ -180,7 +178,7 @@ sub scm {
or die "$scm failed: $?";
if ($dir ne '.') {
- chdir($pwd);
+ chdir($initial_working_directory);
}
}
@@ -196,9 +194,7 @@ sub scmall {
my $subcommand;
my $path;
- my $wd_before = getcwd;
- my $pwd;
my @args;
my $started;
@@ -796,9 +792,14 @@ sub main {
}
}
+BEGIN {
+ $initial_working_directory = getcwd();
+}
+
END {
my $ec = $?;
- my $pwd = getcwd();
+
+ chdir($initial_working_directory);
message "== Checking for old haddock repo";
if (-d "utils/haddock/.git") {
@@ -815,7 +816,7 @@ Please remove it (e.g. "rm -r utils/haddock"), and then run
============================
EOF
}
- chdir($pwd);
+ chdir($initial_working_directory);
}
message "== Checking for old binary repo";
@@ -833,7 +834,7 @@ Please remove it (e.g. "rm -r libraries/binary"), and then run
============================
EOF
}
- chdir($pwd);
+ chdir($initial_working_directory);
}
message "== Checking for old mtl repo";
@@ -851,7 +852,7 @@ Please remove it (e.g. "rm -r libraries/mtl"), and then run
============================
EOF
}
- chdir($pwd);
+ chdir($initial_working_directory);
}
message "== Checking for old Cabal repo";
@@ -869,7 +870,7 @@ Please remove it (e.g. "rm -r libraries/Cabal"), and then run
============================
EOF
}
- chdir($pwd);
+ chdir($initial_working_directory);
}
message "== Checking for old time from tarball";