[tbb-commits] [tor-browser-bundle/master] Bug 13252: Do not store data in the app bundle

gk at torproject.org gk at torproject.org
Sat Mar 19 20:14:38 UTC 2016


commit de8b74299c2235cfe42d04df15b621b8807903e2
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Fri Mar 18 13:05:52 2016 -0400

    Bug 13252: Do not store data in the app bundle
    
    On Mac OS, set DATA_OUTSIDE_APP_DIR=1 for alpha builds. When this
    option is enabled, the package layout is altered to be compatible with
    Apple's Gatekeeper code signing. All user data will be created in a
    TorBrowser-Data directory which sits next to the app bundle and all code
    (and only code) is placed under Contents/MacOS.
    
    Currently, FTE is not included when DATA_OUTSIDE_APP_DIR=1 because FTE
    needs to be repackaged to separate the Python scripts from the compiled
    libraries (see bug 18495).
---
 Bundle-Data/mac-tor.sh                             |   4 +
 gitian/descriptors/mac/gitian-bundle.yml           | 100 ++++++++++++++-------
 .../mac/gitian-pluggable-transports.yml            |  57 ++++++++----
 gitian/descriptors/mac/gitian-tor.yml              |  23 +++--
 gitian/mkbundle-mac.sh                             |  40 +++++++--
 gitian/versions.alpha                              |   3 +
 6 files changed, 163 insertions(+), 64 deletions(-)

diff --git a/Bundle-Data/mac-tor.sh b/Bundle-Data/mac-tor.sh
index 03d6f9d..78b3348 100755
--- a/Bundle-Data/mac-tor.sh
+++ b/Bundle-Data/mac-tor.sh
@@ -8,4 +8,8 @@ export DYLD_LIBRARY_PATH=.:$DYLD_LIBRARY_PATH
 # otherwise set to "/" when an application bundle is started from Finder.
 # https://trac.torproject.org/projects/tor/ticket/10030
 cd "$(dirname "$0")"
+if [ ! -f tor.real -a -d ../../../MacOS/Tor ]; then
+  # On newer releases of Tor Browser, tor.real is in Contents/MacOS/Tor/.
+  cd ../../../MacOS/Tor
+fi
 exec ./tor.real "$@"
diff --git a/gitian/descriptors/mac/gitian-bundle.yml b/gitian/descriptors/mac/gitian-bundle.yml
index 0199cca..aa6a09d 100644
--- a/gitian/descriptors/mac/gitian-bundle.yml
+++ b/gitian/descriptors/mac/gitian-bundle.yml
@@ -69,6 +69,22 @@ script: |
   export TORBROWSER_APP="TorBrowser"
   export TORBROWSER_NAME="TorBrowserBundle"
 
+  if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+    DOCSPATH=Contents/Resources/TorBrowser/Docs
+    EXTSPATH=Contents/Resources/distribution/extensions
+    TORBINPATH=Contents/MacOS/Tor
+    TORCONFIGPATH=Contents/Resources/TorBrowser/Tor
+    EXTOVERRIDESPATH=Contents/Resources/distribution/preferences//extension-overrides.js
+    MEEKPROFILEPATH=Contents/Resources/TorBrowser/Tor/PluggableTransports/template-profile.meek-http-helper
+  else
+    DOCSPATH=TorBrowser/Docs
+    EXTSPATH=TorBrowser/Data/Browser/profile.default/extensions
+    TORBINPATH=TorBrowser/Tor
+    TORCONFIGPATH=TorBrowser/Data/Tor
+    EXTOVERRIDESPATH=TorBrowser/Data/Browser/profile.default/preferences/extension-overrides.js
+    MEEKPROFILEPATH=TorBrowser/Data/Browser/profile.meek-http-helper
+  fi
+
   # Building libfaketime.
   cd faketime
   make
@@ -83,10 +99,9 @@ script: |
   MARTOOLS=~/build/mar-tools
   #
   mkdir -p $OUTDIR/
-  mkdir -p $TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/https-everywhere-eff at eff.org
-  mkdir -p $TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.meek-http-helper/extensions
-  mkdir -p $TORBROWSER_NAME.app/TorBrowser/Data/Browser/Caches
-  mkdir -p $TORBROWSER_NAME.app/TorBrowser/Docs/sources
+  mkdir -p $TORBROWSER_NAME.app/$EXTSPATH/https-everywhere-eff at eff.org
+  mkdir -p $TORBROWSER_NAME.app/$MEEKPROFILEPATH/extensions
+  mkdir -p $TORBROWSER_NAME.app/$DOCSPATH/sources
   mkdir -p $TORBROWSER_NAME.app/Contents/MacOS
   mkdir -p dmg
   #
@@ -97,7 +112,7 @@ script: |
   mkdir pkg/tmp
   cd pkg/tmp
   unzip ../*.xpi
-  ~/build/dzip.sh ../../../$TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/tor-launcher at torproject.org.xpi .
+  ~/build/dzip.sh ../../../$TORBROWSER_NAME.app/$EXTSPATH/tor-launcher at torproject.org.xpi .
   cd ../../../
   #
   cd torbutton
@@ -107,7 +122,7 @@ script: |
   mkdir pkg/tmp
   cd pkg/tmp
   unzip ../*.xpi
-  ~/build/dzip.sh ../../../$TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/torbutton at torproject.org.xpi .
+  ~/build/dzip.sh ../../../$TORBROWSER_NAME.app/$EXTSPATH/torbutton at torproject.org.xpi .
   cd ../../../
   #
   cd https-everywhere
@@ -120,11 +135,11 @@ script: |
   ./makexpi.sh
   # Since 5.0.2 a .xpi for AMO is built, too. We don't need it.
   rm ./pkg/*-amo.xpi
-  cp pkg/*.xpi ../$TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/https-everywhere at eff.org.xpi
+  cp pkg/*.xpi ../$TORBROWSER_NAME.app/$EXTSPATH/https-everywhere at eff.org.xpi
   cd ..
   #
-  cp *.xpi ./$TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/
-  cd $TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/
+  cp *.xpi ./$TORBROWSER_NAME.app/$EXTSPATH/
+  cd $TORBROWSER_NAME.app/$EXTSPATH/
   mv noscript at noscript.net.xpi {73a6fe31-595d-460b-a920-fcc0f8843232}.xpi
   cd https-everywhere-eff at eff.org
   unzip ../https-everywhere at eff.org.xpi
@@ -132,7 +147,7 @@ script: |
   cd ~/build/
   #
   cd meek/firefox
-  ~/build/dzip.sh ../../$TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.meek-http-helper/extensions/meek-http-helper at bamsoftware.com.xpi .
+  ~/build/dzip.sh ../../$TORBROWSER_NAME.app/$MEEKPROFILEPATH/extensions/meek-http-helper at bamsoftware.com.xpi .
   cd ~/build/
   #
   # Install fonts.
@@ -154,23 +169,30 @@ script: |
   fi
   cd $TORBROWSER_NAME.app
   unzip ~/build/mac-skeleton.zip
-  cd TorBrowser
+  if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+    mv bookmarks.html ~/build
+  fi
+  cd $DOCSPATH/..
   unzip ~/build/tbb-docs.zip
+  cd -
   if [ $BUILD_PT_BUNDLES ]; then
-    cat ~/build/torrc-defaults-appendix-mac >> Data/Tor/torrc-defaults
-    cat ~/build/bridge_prefs.js >> Data/Browser/profile.default/preferences/extension-overrides.js
-    cat ~/build/meek-http-helper-user.js >> Data/Browser/profile.meek-http-helper/user.js
+    cat ~/build/torrc-defaults-appendix-mac >> $TORCONFIGPATH/torrc-defaults
+    cat ~/build/bridge_prefs.js >> $EXTOVERRIDESPATH
+    cat ~/build/meek-http-helper-user.js >> $MEEKPROFILEPATH/user.js
   fi
   # Install a "tor" shim that sets the working directory. See #10030.
-  mv Tor/tor Tor/tor.real
-  cp ~/build/mac-tor.sh Tor/tor
-  cd ..
+  mv $TORBINPATH/tor $TORBINPATH/tor.real
+  if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+    cp ~/build/mac-tor.sh $TORCONFIGPATH/tor
+  else
+    cp ~/build/mac-tor.sh $TORBINPATH/tor
+  fi
   unzip ~/build/tor-browser-mac$GBUILD_BITS-gbuilt.zip
   cd ..
   #
   # Copy reproducibility info
-  cp versions $TORBROWSER_NAME.app/TorBrowser/Docs/sources/
-  cp bundle.inputs $TORBROWSER_NAME.app/TorBrowser/Docs/sources/
+  cp versions $TORBROWSER_NAME.app/$DOCSPATH/sources/
+  cp bundle.inputs $TORBROWSER_NAME.app/$DOCSPATH/sources/
   #
   # Set up DMG skeleton
   cd libdmg-hfsplus
@@ -186,20 +208,33 @@ script: |
   pushd $TORBROWSER_NAME.app/Contents/Resources/browser/
   unzip omni.ja defaults/preferences/000-tor-browser.js
   cp defaults/preferences/000-tor-browser.js ~/build/
+  if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+    # Embed our default bookmarks.
+    mkdir -p defaults/profile/
+    cp -p ~/build/bookmarks.html defaults/profile/
+    zip -Xm omni.ja defaults/profile/bookmarks.html
+  fi
   # Set the locale of the bundle.
   echo "pref(\"general.useragent.locale\", \"en-US\");" >> defaults/preferences/000-tor-browser.js
   zip -Xm omni.ja defaults/preferences/000-tor-browser.js
   rm -rf defaults
   popd
-  # Install a headless copy of TorBrowser.app, with a modified Info.plist so
-  # that it runs without a dock icon. See #11429.
-  pushd $TORBROWSER_NAME.app/TorBrowser/Tor/PluggableTransports
-  mkdir -p TorBrowser.app.meek-http-helper/Contents
-  (cd TorBrowser.app.meek-http-helper/Contents && ln -s ../../../../../Contents/* .)
-  rm -f TorBrowser.app.meek-http-helper/Contents/Info.plist
-  ~/build/background-plist.py ../../../Contents/Info.plist > TorBrowser.app.meek-http-helper/Contents/Info.plist
-  unzip ~/build/TorBrowser.app.meek-http-helper.zip
-  popd
+  if [ "z$DATA_OUTSIDE_APP_DIR" != "z1" ]; then
+    # Install a headless copy of TorBrowser.app, with a modified Info.plist so
+    # that it runs without a dock icon. See #11429.
+    # When DATA_OUTSIDE_APP_DIR is set, this approach is not used because it
+    # is incompatible with Apple's Gatekeeper signing process. Instead,
+    # firefox has been modified to accept an --invisible command line option
+    # that causes it to hide the dock icon when running as the meek http
+    # helper browser (meek-client-torbrowser invokes firefox with --invisible).
+    pushd $TORBROWSER_NAME.app/TorBrowser/Tor/PluggableTransports
+    mkdir -p TorBrowser.app.meek-http-helper/Contents
+    (cd TorBrowser.app.meek-http-helper/Contents && ln -s ../../../../../Contents/* .)
+    rm -f TorBrowser.app.meek-http-helper/Contents/Info.plist
+    ~/build/background-plist.py ../../../Contents/Info.plist > TorBrowser.app.meek-http-helper/Contents/Info.plist
+    unzip ~/build/TorBrowser.app.meek-http-helper.zip
+    popd
+  fi
 
   unzip mac-langpacks.zip
   MAC_LOCALES="$BUNDLE_LOCALES $BUNDLE_LOCALES_MAC"
@@ -212,7 +247,7 @@ script: |
     for LANG in $MAC_LOCALES
     do
       xpi=$LANG.xpi
-      cp $xpi ~/build/$TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
+      cp $xpi ~/build/$TORBROWSER_NAME.app/$EXTSPATH/langpack-$LANG at firefox.mozilla.org.xpi
     done
     popd
 
@@ -223,10 +258,7 @@ script: |
     zip -Xm omni.ja update.locale
     popd
   fi
-  #
-  # XXX: We need to insert these placeholders because otherwise mkisofs won't
-  # include these otherwise empty dirs:
-  touch ~/build/$TORBROWSER_NAME.app/TorBrowser/Data/Browser/Caches/placeholder.txt
+
   # Recreate precomplete file (needs to be accurate for full MAR updates).
   pushd ~/build/$TORBROWSER_NAME.app/Contents/Resources/
   rm -f precomplete
@@ -249,7 +281,7 @@ script: |
       xpi=mac-langpacks/$LANG.xpi
       DEST=$TORBROWSER_APP
       cp -a ${TORBROWSER_NAME}_plain.app ~/build/dmg/$DEST.app
-      cp $xpi ~/build/dmg/$DEST.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
+      cp $xpi ~/build/dmg/$DEST.app/$EXTSPATH/langpack-$LANG at firefox.mozilla.org.xpi
 
       pushd ~/build/dmg/$DEST.app/Contents/Resources/browser/
       mkdir -p defaults/preferences
diff --git a/gitian/descriptors/mac/gitian-pluggable-transports.yml b/gitian/descriptors/mac/gitian-pluggable-transports.yml
index fd62919..5a578ba 100644
--- a/gitian/descriptors/mac/gitian-pluggable-transports.yml
+++ b/gitian/descriptors/mac/gitian-pluggable-transports.yml
@@ -39,6 +39,7 @@ remotes:
 - "url": "https://git.torproject.org/pluggable-transports/obfs4.git"
   "dir": "obfs4"
 files:
+- "versions"
 - "pycrypto.tar.gz"
 - "argparse.tar.gz"
 - "pyyaml.tar.gz"
@@ -53,8 +54,20 @@ files:
 - "openssl-mac64-utils.zip"
 script: |
   INSTDIR="$HOME/install"
-  TBDIR="$INSTDIR/TorBrowserBundle.app/TorBrowser"
-  PTDIR="$TBDIR/Tor/PluggableTransports"
+  source versions
+  TBDIR="$INSTDIR/TorBrowserBundle.app"
+  if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+    PTDIR="$TBDIR/Contents/MacOS/Tor/PluggableTransports"
+    DOCSDIR="$TBDIR/Contents/Resources/TorBrowser/Docs"
+    TORBINDIR="$TBDIR/Contents/MacOS/Tor"
+    # TODO: Fix packaging of fte so it can be included. See bug 18495.
+    INCLUDE_FTE=0
+  else
+    PTDIR="$TBDIR/TorBrowser/Tor/PluggableTransports"
+    DOCSDIR="$TBDIR/TorBrowser/Docs"
+    TORBINDIR="$TBDIR/TorBrowser/Tor"
+    INCLUDE_FTE=1
+  fi
   export LIBRARY_PATH="$INSTDIR/lib"
   export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
   export FAKETIME=$REFERENCE_DATETIME
@@ -68,10 +81,15 @@ script: |
   sudo dpkg -i *.deb
   tar xaf multiarch-darwin*tar.xz
   export PATH="$PATH:$HOME/build/apple-osx/bin/"
-  unzip -d $INSTDIR gmp-mac64-utils.zip
-  unzip -d $INSTDIR openssl-mac64-utils.zip
-  # FTE only needs libgmp.10.dylib and no libgmpxx anymore.
-  cp $INSTDIR/gmp/lib/libgmp.10.dylib $TBDIR/Tor/
+  if [ "z$INCLUDE_FTE" = "z1" ]; then
+    unzip -d $INSTDIR gmp-mac64-utils.zip
+    unzip -d $INSTDIR openssl-mac64-utils.zip
+    # FTE only needs libgmp.10.dylib and no libgmpxx anymore.
+    cp $INSTDIR/gmp/lib/libgmp.10.dylib $TORBINDIR/
+    FTE_EXTRA_CFLAGS=" -I$INSTDIR/gmp/include -L$INSTDIR/gmp/lib"
+  else
+    FTE_EXTRA_CFLAGS=""
+  fi
 
   #
   export AR=$HOME/build/apple-osx/bin/i686-apple-darwin11-ar
@@ -80,8 +98,8 @@ script: |
   # http://bugs.python.org/issue9437
   export LDSHARED="$CC -pthread -shared"
   # XXX Clean up these flags?
-  export CFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I.  -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5 -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/i686-apple-darwin10/4.2.1 -I$INSTDIR/gmp/include -L$INSTDIR/gmp/lib"
-  export CXXFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I.  -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5 -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/i686-apple-darwin10/4.2.1 -I$INSTDIR/gmp/include -L$INSTDIR/gmp/lib"
+  export CFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I.  -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5 -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/i686-apple-darwin10/4.2.1$FTE_EXTRA_CFLAGS"
+  export CXXFLAGS="-m64 -I/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/include/ -I/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I.  -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5 -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/i686-apple-darwin10/4.2.1$FTE_EXTRA_CFLAGS"
   export LDFLAGS="-L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/ -L/usr/lib/apple/SDKs/MacOSX10.6.sdk/usr/lib/system/ -F/usr/lib/apple/SDKs/MacOSX10.6.sdk/System/Library/Frameworks -mmacosx-version-min=10.5"
 
   # Building go
@@ -100,6 +118,8 @@ script: |
   cd ../..
   export PATH="$PATH:$PWD/go/bin"
 
+  if [ "z$INCLUDE_FTE" = "z1" ]; then
+
   # Building pyptlib
   cd pyptlib
   find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
@@ -179,8 +199,8 @@ script: |
   python setup.py build --build-lib build
   cp -a build/obfsproxy $PTDIR/
   cp -a bin/obfsproxy $PTDIR/obfsproxy.bin
-  mkdir -p $TBDIR/Docs/Obfsproxy
-  cp -a {LICENSE,README} $TBDIR/Docs/Obfsproxy
+  mkdir -p $DOCSDIR/Obfsproxy
+  cp -a {LICENSE,README} $DOCSDIR/Obfsproxy
   # XXX: Workaround for bug 11190
   sed 's/python2/python/' -i $PTDIR/obfsproxy.bin
   cd ..
@@ -190,9 +210,9 @@ script: |
   find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
   CFLAGS="-L$INSTDIR/Tor -I$INSTDIR/gmp/include $CFLAGS" CXXFLAGS="-L$INSTDIR/Tor -I$INSTDIR/gmp/include $CXXFLAGS" make
   cp -ra fte $PTDIR/
-  mkdir -p $TBDIR/Docs/libfte
-  cp -a {LICENSE,README.md} $TBDIR/Docs/libfte
-  cp -an thirdparty/re2/LICENSE $TBDIR/Docs/libfte/LICENSE.re2
+  mkdir -p $DOCSDIR/libfte
+  cp -a {LICENSE,README.md} $DOCSDIR/libfte
+  cp -an thirdparty/re2/LICENSE $DOCSDIR/libfte/LICENSE.re2
   cd ..
 
   # Building fteproxy
@@ -200,10 +220,13 @@ script: |
   find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
   cp -a bin/fteproxy $PTDIR/fteproxy.bin
   cp -ra fteproxy $PTDIR/
-  mkdir -p $TBDIR/Docs/fteproxy
-  cp -a {COPYING,README.md} $TBDIR/Docs/fteproxy
+  mkdir -p $DOCSDIR/fteproxy
+  cp -a {COPYING,README.md} $DOCSDIR/fteproxy
   cd ..
 
+  fi
+  # end of 'INCLUDE_FTE' section
+
   # Building goptlib
   cd goptlib
   find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
@@ -225,8 +248,8 @@ script: |
   go build -ldflags '-s'
   cp -a meek-client-torbrowser $PTDIR
   cd ..
-  mkdir -p $TBDIR/Docs/meek
-  cp -a README doc/*.1 $TBDIR/Docs/meek
+  mkdir -p $DOCSDIR/meek
+  cp -a README doc/*.1 $DOCSDIR/meek
   cd ..
 
   # Building go ed25519
diff --git a/gitian/descriptors/mac/gitian-tor.yml b/gitian/descriptors/mac/gitian-tor.yml
index a6824c0..bbcf8c3 100644
--- a/gitian/descriptors/mac/gitian-tor.yml
+++ b/gitian/descriptors/mac/gitian-tor.yml
@@ -22,8 +22,15 @@ files:
 - "libevent-mac64-utils.zip"
 script: |
   INSTDIR="$HOME/install"
-  TBDIR="$INSTDIR/TorBrowserBundle.app/TorBrowser"
   source versions
+  TBDIR="$INSTDIR/TorBrowserBundle.app"
+  if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+    TORBINDIR="$TBDIR/Contents/MacOS/Tor"
+    TORCONFIGDIR="$TBDIR/Contents/Resources/TorBrowser/Tor"
+  else
+    TORBINDIR="$TBDIR/TorBrowser/Tor"
+    TORCONFIGDIR="$TBDIR/TorBrowser/Data/Tor"
+  fi
   export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
   export FAKETIME=$REFERENCE_DATETIME
   export TZ=UTC
@@ -31,8 +38,8 @@ script: |
   umask 0022
   #
   mkdir -p $INSTDIR/bin/
-  mkdir -p $TBDIR/Tor/
-  mkdir -p $TBDIR/Data/Tor/
+  mkdir -p $TORBINDIR/
+  mkdir -p $TORCONFIGDIR/
   mkdir -p $OUTDIR/
   #
   sudo dpkg -i *.deb
@@ -40,7 +47,7 @@ script: |
   export PATH="$PATH:$HOME/build/apple-osx/bin/"
   unzip -d $INSTDIR openssl-mac64-utils.zip
   unzip -d $INSTDIR libevent-mac64-utils.zip
-  cp $INSTDIR/libevent/lib/libevent-*.dylib $TBDIR/Tor/
+  cp $INSTDIR/libevent/lib/libevent-*.dylib $TORBINDIR/
   LIBEVENT_FILE=`basename $INSTDIR/libevent/lib/libevent-*.dylib`
 
   # Building tor
@@ -57,10 +64,10 @@ script: |
   make $MAKEOPTS
   make install
   cd $INSTDIR
-  cp bin/tor $TBDIR/Tor/
-  cp share/tor/geoip $TBDIR/Data/Tor/
-  cp share/tor/geoip6 $TBDIR/Data/Tor/
-  cd $TBDIR/Tor/
+  cp bin/tor $TORBINDIR/
+  cp share/tor/geoip $TORCONFIGDIR/
+  cp share/tor/geoip6 $TORCONFIGDIR/
+  cd $TORBINDIR/
   i686-apple-darwin11-install_name_tool -change $INSTDIR/libevent/lib/$LIBEVENT_FILE @executable_path/$LIBEVENT_FILE tor
 
   # Grabbing the result
diff --git a/gitian/mkbundle-mac.sh b/gitian/mkbundle-mac.sh
index 39dac5f..682e02f 100755
--- a/gitian/mkbundle-mac.sh
+++ b/gitian/mkbundle-mac.sh
@@ -55,15 +55,45 @@ rm -f $GITIAN_DIR/inputs/tbb-docs.zip
 $WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/tbb-docs.zip ./Docs/
 rm -f $GITIAN_DIR/inputs/TorBrowser.app.meek-http-helper.zip
 (cd PTConfigs/mac && $WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/TorBrowser.app.meek-http-helper.zip TorBrowser.app.meek-http-helper)
-cp PTConfigs/mac/torrc-defaults-appendix $GITIAN_DIR/inputs/torrc-defaults-appendix-mac
-cp PTConfigs/bridge_prefs.js $GITIAN_DIR/inputs/
+if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+# FTE is temporarily disabled due to bug 18495.
+  grep -v 'fteproxy' PTConfigs/mac/torrc-defaults-appendix > $GITIAN_DIR/inputs/torrc-defaults-appendix-mac
+  grep -v 'default_bridge\.fte' PTConfigs/bridge_prefs.js > $GITIAN_DIR/inputs/bridge_prefs.js
+else
+  cp PTConfigs/mac/torrc-defaults-appendix $GITIAN_DIR/inputs/torrc-defaults-appendix-mac
+  cp PTConfigs/bridge_prefs.js $GITIAN_DIR/inputs/
+fi
 cp PTConfigs/meek-http-helper-user.js $GITIAN_DIR/inputs/
 cp mac-tor.sh $GITIAN_DIR/inputs/
 
-cd mac
 rm -f $GITIAN_DIR/inputs/mac-skeleton.zip
-$WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/mac-skeleton.zip .
-cd ../mac-desktop.dmg
+if [ "z$DATA_OUTSIDE_APP_DIR" = "z1" ]; then
+  # The Bundle-Data is designed for embedded data, so we need to modify
+  # the structure when we want the data to be outside the app directory.
+  # We also create an override.ini file to disable the profile migrator.
+  SKELETON_TMP=$GITIAN_DIR/inputs/mac-skeleton-tmp
+  SKELETON_TMP_RESOURCES=$SKELETON_TMP/Contents/Resources
+  rm -rf $SKELETON_TMP
+  mkdir -p $SKELETON_TMP_RESOURCES/browser
+  echo "[XRE]" > $SKELETON_TMP_RESOURCES/browser/override.ini
+  echo "EnableProfileMigrator=0" >> $SKELETON_TMP_RESOURCES/browser/override.ini
+  mkdir -p $SKELETON_TMP_RESOURCES/distribution/preferences
+  cp -p mac/TorBrowser/Data/Browser/profile.default/preferences/extension-overrides.js $SKELETON_TMP_RESOURCES/distribution/preferences
+  mkdir -p $SKELETON_TMP_RESOURCES/TorBrowser/Tor
+  cp -p mac/TorBrowser/Data/Tor/torrc-defaults $SKELETON_TMP_RESOURCES/TorBrowser/Tor/
+  # Place a copy of the bookmarks.html file at the top. It will be moved into
+  # browser/omni.ja by code inside descriptors/mac/gitian-bundle.yml
+  cp -p mac/TorBrowser/Data/Browser/profile.default/bookmarks.html $SKELETON_TMP
+  cd $SKELETON_TMP
+  $WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/mac-skeleton.zip .
+  cd -
+else
+  cd mac
+  $WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/mac-skeleton.zip .
+  cd -
+fi
+
+cd mac-desktop.dmg
 rm -f $GITIAN_DIR/inputs/dmg-desktop.tar.xz
 $WRAPPER_DIR/build-helpers/dtar.sh $GITIAN_DIR/inputs/dmg-desktop.tar.xz .
 cd ../mac-applications.dmg
diff --git a/gitian/versions.alpha b/gitian/versions.alpha
index 4c6f016..06584b4 100755
--- a/gitian/versions.alpha
+++ b/gitian/versions.alpha
@@ -5,6 +5,9 @@ BUNDLE_LOCALES_WIN32="ja"
 BUNDLE_LOCALES_MAC="ja-JP-mac"
 BUILD_PT_BUNDLES=1
 
+# DATA_OUTSIDE_APP_DIR is only implemented for Mac OS.
+DATA_OUTSIDE_APP_DIR=1
+
 VERIFY_TAGS=1
 
 FIREFOX_VERSION=38.7.1esr





More information about the tbb-commits mailing list