Commit 9fdb1864 authored by joerg@mysql.com's avatar joerg@mysql.com

Fix 'Bootstrap' to bypass a problem with "bk changes" by changing the...

Fix 'Bootstrap' to bypass a problem with "bk changes" by changing the directory before calling the command.
parent 1314c4aa
...@@ -240,35 +240,47 @@ if (defined $opt_changelog) ...@@ -240,35 +240,47 @@ if (defined $opt_changelog)
# the last tagged ChangeSet (this relies heavily on our current tagging # the last tagged ChangeSet (this relies heavily on our current tagging
# practice!) # practice!)
# #
my $revision= ""; $opt_changelog=~ s/^=//; # Sometimes, a leading '=' was not stripped.
my $log_base= $opt_changelog;
my $changelogfile;
if ($target_dir =~ m:^/:) # we need an absolute path, as we change directory
{
$changelogfile= $target_dir. "/ChangeLog";
}
else
{
$changelogfile= cwd() . "/" . $target_dir . "/ChangeLog";
}
if ($opt_changelog eq "last") if ($opt_changelog eq "last")
{ {
if (!$opt_revision) if (!$opt_revision)
{ {
$revision= `bk changes -t -d':REV:::TAG:' -n $REPO | grep mysql-$major.$minor | head -1 | cut -f1 -d ":"`; $log_base= `bk changes -t -d':REV:::TAG:' -n $REPO | grep mysql-$major.$minor | head -1 | cut -f1 -d ":"`;
} }
else else
{ {
$revision= `bk changes -r..$opt_revision -t -d':REV:' -n $REPO | head -2 | tail -1`; $log_base= `bk changes -r..$opt_revision -t -d':REV:' -n $REPO | head -2 | tail -1`;
} }
chomp($revision); chomp($log_base);
$opt_changelog= $revision;
} }
$msg= "Adding $target_dir/ChangeLog"; $msg= "Adding $changelogfile";
$msg.= " (down to revision $opt_changelog)" if $opt_changelog ne ""; $msg.= " (down to revision $log_base)" if $log_base ne "";
&logger($msg); &logger($msg);
$command= "bk changes -v"; # Due to a BK error, "bk changes" must be run in $REPO !
$command.= " -r" if ($opt_changelog ne "" || $opt_revision); $command= "cd $REPO ; ";
$command.= $opt_changelog if $opt_changelog ne ""; $command.= "bk changes -v";
$command.= ".." if ($opt_changelog ne "" && !$opt_revision); $command.= " -r" if ($log_base ne "" || $opt_revision);
$command.= $log_base if $log_base ne "";
$command.= ".." if ($log_base ne "" && !$opt_revision);
$command.= ".." . $opt_revision if $opt_revision; $command.= ".." . $opt_revision if $opt_revision;
$command.= " " . $REPO . " > $target_dir/ChangeLog"; $command.= " > $changelogfile";
&logger($command); &logger($command);
# We cannot use run_command here because of output redirection # We cannot use run_command here because of output redirection
unless ($opt_dry_run) unless ($opt_dry_run)
{ {
system($command) == 0 or &abort("Could not create $target_dir/ChangeLog!"); system($command) == 0 or &abort("Could not create $changelogfile!");
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment