Commit c712ae5d authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Post-checkin fix for bug 430012: Make checksetup not throw a warning when there…

Post-checkin fix for bug 430012: Make checksetup not throw a warning when there are no extension templates that got compiled.
parent 5fc80f94
...@@ -887,18 +887,21 @@ sub _do_template_symlink { ...@@ -887,18 +887,21 @@ sub _do_template_symlink {
my $abs_root = dirname($abs_path); my $abs_root = dirname($abs_path);
my $dir_name = basename($abs_path); my $dir_name = basename($abs_path);
my $datadir = bz_locations()->{'datadir'}; my $datadir = bz_locations()->{'datadir'};
my $todir = "$datadir/template$abs_root"; my $container = "$datadir/template$abs_root";
mkpath($todir); mkpath($container);
my $target = "$datadir/template/$dir_name";
# Check if the directory exists, because if there are no extensions,
# there won't be an "data/template/extensions" directory to link to.
if (-d $target) {
# We use abs2rel so that the symlink will look like # We use abs2rel so that the symlink will look like
# "../../../../template" which works, while just # "../../../../template" which works, while just
# "data/template/template/" doesn't work. # "data/template/template/" doesn't work.
my $fromdir = File::Spec->abs2rel("$datadir/template/$dir_name", $todir); my $relative_target = File::Spec->abs2rel($target, $container);
my $target = "$todir/$dir_name"; my $link_name = "$container/$dir_name";
# We eval for systems that can't symlink at all, where "symlink" symlink($relative_target, $link_name)
# throws a fatal error. or warn "Could not make $link_name a symlink to $relative_target: $!";
eval { symlink($fromdir, $target) } }
or warn "Failed to symlink from $fromdir to $target: $!";
} }
1; 1;
......
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