diff --git a/tools/update-packaging/unwrap_full_update.pl b/tools/update-packaging/unwrap_full_update.pl index 43d265f8b5a1..12a9eac8b649 100755 --- a/tools/update-packaging/unwrap_full_update.pl +++ b/tools/update-packaging/unwrap_full_update.pl @@ -12,7 +12,6 @@ # By default just assume that these tools exist on our path use Getopt::Std; -use Cwd 'abs_path'; my ($MAR, $XZ, $BZIP2, $MAR_OLD_FORMAT, $archive, @marentries, @marfiles); @@ -36,18 +35,25 @@ if (defined($ENV{"XZ"})) { else { if (system("xz --version > /dev/null 2>&1") != 0) { # Some of the Windows build systems have xz.exe in topsrcdir/xz/. - my $xzwinpath = abs_path(__FILE__); + my $xzwinpath = __FILE__; $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '/')); $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '/')); $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '/')); - $xzwinpath = $xzwinpath . "/xz/xz.exe"; - if (-e $xzwinpath) { - $XZ = $xzwinpath; + my $xzwin = $xzwinpath . "/xz/xz.exe"; + if (-e $xzwin) { + $XZ = $xzwin; } else { - # If the xz executable was not found fallback to trying to execute - # xz and follow the normal failure path if it isn't found. - $XZ = "xz"; + $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '/')); + $xzwin = $xzwinpath . "/xz/xz.exe"; + if (-e $xzwin) { + $XZ = $xzwin; + } + else { + # If the xz executable was not found fallback to trying to execute + # xz and follow the normal failure path if it isn't found. + $XZ = "xz"; + } } } else {