[tor-commits] [tor-browser/tor-browser-45.3.0esr-6.0-1] fixup! Bug #4234: Use the Firefox Update Process for Tor Browser.

gk at torproject.org gk at torproject.org
Thu Sep 1 15:25:32 UTC 2016


commit f800760546f5912d5aef5ca4e56b9e3fd62df8f9
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Wed Aug 31 14:28:32 2016 -0400

    fixup! Bug #4234: Use the Firefox Update Process for Tor Browser.
    
    Add support for HTTPS Everywhere 5.2.2 and newer, which is no longer
    an unpacked extension.
---
 tools/update-packaging/make_full_update.sh        |  3 +-
 tools/update-packaging/make_incremental_update.sh | 79 ++++++++++++++++++-----
 2 files changed, 65 insertions(+), 17 deletions(-)

diff --git a/tools/update-packaging/make_full_update.sh b/tools/update-packaging/make_full_update.sh
index f0bd7f6..872221a 100755
--- a/tools/update-packaging/make_full_update.sh
+++ b/tools/update-packaging/make_full_update.sh
@@ -72,7 +72,8 @@ list_files files
 list_symlinks symlinks symlink_targets
 
 # TODO When TOR_BROWSER_DATA_OUTSIDE_APP_DIR is used on all platforms,
-# we should remove the following lines:
+# we should remove the following lines (which remove entire directories
+# which, if present, contain old, unpacked copies of HTTPS Everywhere):
 # Make sure we delete the pre 5.1.0 HTTPS Everywhere as well in case it
 # exists. The extension ID got changed with the version bump to 5.1.0.
 ext_path='TorBrowser/Data/Browser/profile.default/extensions'
diff --git a/tools/update-packaging/make_incremental_update.sh b/tools/update-packaging/make_incremental_update.sh
index 15af172..dc9097e 100755
--- a/tools/update-packaging/make_incremental_update.sh
+++ b/tools/update-packaging/make_incremental_update.sh
@@ -91,6 +91,7 @@ fi
 # 770996 but in Tor Browser we do not need that fix.
 requested_forced_updates=""
 directories_to_remove=""
+extra_files_to_remove=""
 
 while getopts "hqf:" flag
 do
@@ -131,7 +132,8 @@ archivefiles="updatev2.manifest updatev3.manifest"
 # releases, add them to the "force updates" list.
 ext_path='TorBrowser/Data/Browser/profile.default/extensions'
 if [ -d "$newdir/$ext_path" ]; then
-  https_everywhere='https-everywhere-eff at eff.org'
+  https_everywhere_dir='https-everywhere-eff at eff.org'
+  https_everywhere_xpi='https-everywhere-eff at eff.org.xpi'
   noscript='{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi'
 
   # NoScript is a packed extension, so we simply compare the old and the new
@@ -146,21 +148,57 @@ if [ -d "$newdir/$ext_path" ]; then
     requested_forced_updates="$requested_forced_updates $noscript_path"
   fi
 
-  # HTTPS Everywhere is an unpacked extension, so we need to determine if any of
-  # the unpacked files have changed. Since that is messy, we simply compare the
-  # old extension's install.rdf file to the new one.
-  https_everywhere_install_rdf="$ext_path/$https_everywhere/install.rdf"
-  diff "$olddir/$https_everywhere_install_rdf"     \
-        "$newdir/$https_everywhere_install_rdf" > /dev/null
-  rc=$?
-  if [ $rc -gt 1 -a -e "$olddir/$https_everywhere_install_rdf" ]; then
-    notice "Unexpected exit $rc from $https_everywhere_install_rdf diff command"
-    exit 2
-  elif [ $rc -ge 1 ]; then
-    requested_forced_updates="$requested_forced_updates $ext_path/$https_everywhere/*"
-    # Make sure we delete the pre 5.1.0 HTTPS Everywhere as well in case it
-    # exists. The extension ID got changed with the version bump to 5.1.0.
-    directories_to_remove="$directories_to_remove $ext_path/https-everywhere at eff.org $ext_path/$https_everywhere"
+  # As of HTTPS Everywhere 5.1.0, the extension ID gained "-eff".
+  # As of HTTPS Everywhere 5.2.2, the extension is packed (i.e., it remains
+  # an .xpi after it is installed in the browser profile).
+  force_https_update=0
+  remove_unpacked_https_e_dirs=0
+  unpacked_https_e_install_rdf="$ext_path/$https_everywhere_dir/install.rdf"
+  packed_https_e_path="$ext_path/$https_everywhere_xpi"
+  if [ -d "$newdir/$ext_path/$https_everywhere_dir" ]; then
+    # The new HTTPS-E extension is unpacked, and presumably the old one is
+    # too. We need to determine if any of the unpacked files have changed.
+    # Since that is messy, we simply compare the old install.rdf file to the
+    # new one.
+    diff "$olddir/$unpacked_https_e_install_rdf"     \
+          "$newdir/$unpacked_https_e_install_rdf" > /dev/null
+    rc=$?
+    if [ $rc -gt 1 -a -e "$olddir/$unpacked_https_e_install_rdf" ]; then
+      notice "Unexpected exit $rc from $unpacked_https_e_install_rdf diff command"
+      exit 2
+    elif [ $rc -ge 1 ]; then
+      force_https_update=1
+      remove_unpacked_https_e_dirs=1
+      # In case we still ship an unpacked HTTPS-E extension but the user has
+      # updated to a packed one, arrange for the packed one to be removed.
+      extra_files_to_remove="$extra_files_to_remove $packed_https_e_path"
+    fi
+  elif [ -d "$olddir/$ext_path/$https_everywhere_dir" ]; then
+    # The old HTTPS-E extension is unpacked but the new one is packed.
+    force_https_update=1
+    remove_unpacked_https_e_dirs=1
+  else
+    # Both the old and new HTTPS-E extensions are packed. In this case we can
+    # simply compare the .xpi files to determine if the extension has changed.
+    diff -a "$olddir/$packed_https_e_path" "$newdir/$packed_https_e_path" > /dev/null
+    rc=$?
+    if [ $rc -gt 1 ]; then
+      notice "Unexpected exit $rc from $packed_https_e_path diff command"
+      exit 2
+    elif [ $rc -eq 1 ]; then
+      force_https_update=1
+    fi
+  fi
+
+  if [ $force_https_update -ne 0 ]; then
+    requested_forced_updates="$requested_forced_updates $ext_path/$https_everywhere_dir/* $packed_https_e_path"
+    if [ "$remove_unpacked_https_e_dirs" -ne 0 ]; then
+      # The old version was unpacked, so remove the entire directory to ensure
+      # that the replace is "clean." Also, make sure we delete the pre 5.1.0
+      # HTTPS Everywhere as well in case it exists (the extension ID got
+      # changed with the version bump to 5.1.0).
+      directories_to_remove="$directories_to_remove $ext_path/https-everywhere at eff.org $ext_path/$https_everywhere_dir"
+    fi
   fi
 fi
 # END TOR_BROWSER_DATA_OUTSIDE_APP_DIR removal
@@ -376,6 +414,15 @@ notice ""
 notice "Adding file and directory remove instructions from file 'removed-files'"
 append_remove_instructions "$newdir" "$updatemanifestv2" "$updatemanifestv3"
 
+# TODO When TOR_BROWSER_DATA_OUTSIDE_APP_DIR is used on all platforms,
+# we should remove the following lines:
+for f in $extra_files_to_remove; do
+  notice "     remove \"$f\""
+  echo "remove \"$f\"" >> "$updatemanifestv2"
+  echo "remove \"$f\"" >> "$updatemanifestv3"
+done
+# END TOR_BROWSER_DATA_OUTSIDE_APP_DIR removal
+
 notice ""
 notice "Adding directory remove instructions for directories that no longer exist"
 num_olddirs=${#olddirs[*]}



More information about the tor-commits mailing list