Fix xz path issue on Windows, follow-up. a=jorgk DONTBUILD THUNDERBIRD560b4_2017092101_RELBRANCH
authorTom Prince <mozilla@hocat.ca>
Fri, 22 Sep 2017 16:51:31 -0600
branchTHUNDERBIRD560b4_2017092101_RELBRANCH
changeset 673913 61ae47a5725a8c13735280dd3f19954a3d1fe090
parent 673912 5e4d05580f36dd67612e78462a4043996ca87cb9
child 673914 dc62e9442e97c77e852794130fe42fcb7d639ec6
push id82679
push userbmo:mozilla@hocat.ca
push dateTue, 03 Oct 2017 00:15:54 +0000
reviewersjorgk
milestone56.0
Fix xz path issue on Windows, follow-up. a=jorgk DONTBUILD
tools/update-packaging/unwrap_full_update.pl
--- a/tools/update-packaging/unwrap_full_update.pl
+++ b/tools/update-packaging/unwrap_full_update.pl
@@ -7,16 +7,17 @@
 # This tool unpacks a full update package generated by make_full_update.sh
 # Author: Benjamin Smedberg
 #
 
 # -----------------------------------------------------------------------------
 # By default just assume that these tools exist on our path
 
 use Getopt::Std;
+use File::Spec;
 use File::Spec::Win32;
 
 my ($MAR, $XZ, $BZIP2, $MAR_OLD_FORMAT, $archive, @marentries, @marfiles);
 
 if (defined($ENV{"MAR"})) {
     $MAR = $ENV{"MAR"};
 }
 else {
@@ -32,29 +33,37 @@ else {
 
 if (defined($ENV{"XZ"})) {
     $XZ = $ENV{"XZ"};
     print "Using \$XZ environment variable.\n";
 }
 else {
     if (system("xz --version > /dev/null 2>&1") != 0) {
         # Some of the Windows build systems have xz.exe in topsrcdir/xz/.
-        my $xzwinpath = File::Spec::Win32->rel2abs(__FILE__);
-        $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '\\'));
-        $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '\\'));
-        $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '\\'));
+        my $xzwinpath, $sep;
+        if (__FILE__ =~ m/\\/) { 
+            $xzwinpath = File::Spec::Win32->rel2abs(__FILE__);
+            $sep = "\\";
+        }
+        else {
+            $xzwinpath = File::Spec->rel2abs(__FILE__);
+            $sep = "/";
+        }
+        $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, $sep));
+        $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, $sep));
+        $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, $sep));
         print "Looking for xz in $xzwinpath\n";
-        my $xzwin = $xzwinpath . "\\xz\\xz.exe";
+        my $xzwin = $xzwinpath . "/xz/xz.exe";
         if (-e $xzwin) {
             $XZ = $xzwin;
         }
         else {
-            $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, '\\'));
+            $xzwinpath = substr($xzwinpath, 0, rindex($xzwinpath, $sep));
             print "Looking for xz in $xzwinpath\n";
-            $xzwin = $xzwinpath . "\\xz\\xz.exe";
+            $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";
             }