[tor-commits] [tor-browser-bundle/master] Bug #4261: Generate DMGs for MacOS.

mikeperry at torproject.org mikeperry at torproject.org
Fri Feb 28 06:06:17 UTC 2014


commit 535c7ebbdcdc0c5def8ec640e2f8626fb7396f78
Author: Mike Perry <mikeperry-git at torproject.org>
Date:   Wed Feb 26 10:45:24 2014 -0800

    Bug #4261: Generate DMGs for MacOS.
    
    Compressed with bzip2 (UDBZ) and complete with a background and desktop
    shortcut!
---
 Bundle-Data/mac.dmg/.DS_Store                  |  Bin 0 -> 12292 bytes
 Bundle-Data/mac.dmg/._Desktop                  |  Bin 0 -> 303592 bytes
 Bundle-Data/mac.dmg/.background/background.png |  Bin 0 -> 50020 bytes
 Bundle-Data/mac.dmg/Desktop                    |  Bin 0 -> 300120 bytes
 gitian/build-helpers/ddmg.sh                   |   28 ++++++
 gitian/descriptors/mac/gitian-bundle.yml       |  108 ++++++++++++++++--------
 gitian/fetch-inputs.sh                         |    1 +
 gitian/mkbundle-mac.sh                         |    7 +-
 gitian/versions                                |    1 +
 gitian/versions.alpha                          |    1 +
 gitian/versions.beta                           |    1 +
 gitian/versions.diff                           |   45 ++++++++++
 gitian/versions.nightly                        |    1 +
 13 files changed, 156 insertions(+), 37 deletions(-)

diff --git a/Bundle-Data/mac.dmg/.DS_Store b/Bundle-Data/mac.dmg/.DS_Store
new file mode 100644
index 0000000..9bec18c
Binary files /dev/null and b/Bundle-Data/mac.dmg/.DS_Store differ
diff --git a/Bundle-Data/mac.dmg/._Desktop b/Bundle-Data/mac.dmg/._Desktop
new file mode 100644
index 0000000..a1e0b7f
Binary files /dev/null and b/Bundle-Data/mac.dmg/._Desktop differ
diff --git a/Bundle-Data/mac.dmg/.background/background.png b/Bundle-Data/mac.dmg/.background/background.png
new file mode 100644
index 0000000..94e4584
Binary files /dev/null and b/Bundle-Data/mac.dmg/.background/background.png differ
diff --git a/Bundle-Data/mac.dmg/Desktop b/Bundle-Data/mac.dmg/Desktop
new file mode 100644
index 0000000..3c88450
Binary files /dev/null and b/Bundle-Data/mac.dmg/Desktop differ
diff --git a/gitian/build-helpers/ddmg.sh b/gitian/build-helpers/ddmg.sh
new file mode 100755
index 0000000..f9f54da
--- /dev/null
+++ b/gitian/build-helpers/ddmg.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Crappy deterministic dmg wrapper
+export LC_ALL=C
+
+DMGFILE=$1
+shift
+
+# Attempt to normalize inode ordering..
+# XXX: the genisoimage -path-list argument seems broken
+mkdir -p ~/build/tmp/dmg
+cd $@
+for i in `find . | sort`
+do
+  if [ -d $i ];
+  then
+    mkdir -p ~/build/tmp/dmg/$i
+  else
+    cp --parents -d --preserve=all $i ~/build/tmp/dmg/
+  fi
+done
+
+find ~/build/tmp/dmg -executable -exec chmod 700 {} \;
+find ~/build/tmp/dmg ! -executable -exec chmod 600 {} \;
+
+genisoimage -D -V "Tor Browser" -no-pad -R -apple -o tbb-uncompressed.dmg ~/build/tmp/dmg/
+~/build/libdmg-hfsplus/dmg/dmg dmg tbb-uncompressed.dmg $DMGFILE
+rm tbb-uncompressed.dmg
+rm -rf ~/build/tmp/dmg/
diff --git a/gitian/descriptors/mac/gitian-bundle.yml b/gitian/descriptors/mac/gitian-bundle.yml
index 428dbee..da7e918 100644
--- a/gitian/descriptors/mac/gitian-bundle.yml
+++ b/gitian/descriptors/mac/gitian-bundle.yml
@@ -12,6 +12,11 @@ packages:
 - "nsis"
 - "faketime"
 - "python"
+- "hfsprogs"
+- "genisoimage"
+- "cmake"
+- "zlib1g-dev"
+- "libbz2-dev"
 reference_datetime: "2000-01-01 00:00:00"
 remotes:
 - "url": "https://git.torproject.org/tor-launcher.git"
@@ -20,6 +25,8 @@ remotes:
   "dir": "torbutton"
 - "url": "https://git.torproject.org/https-everywhere.git"
   "dir": "https-everywhere"
+- "url": "https://github.com/vasi/libdmg-hfsplus.git"
+  "dir": "libdmg-hfsplus"
 files:
 # TODO: Can we use an env for this file+version??
 - "tor-browser-mac32-gbuilt.zip"
@@ -28,9 +35,11 @@ files:
 - "torrc-defaults-appendix-mac"
 - "relativelink-src.zip"
 - "mac-skeleton.zip"
+- "mac-dmg.zip"
 - "mac-langpacks.zip"
 - "noscript at noscript.net.xpi"
 - "dzip.sh"
+- "ddmg.sh"
 - "bare-version"
 - "bundle.inputs"
 - "versions"
@@ -46,12 +55,20 @@ script: |
   export TORBROWSER_VERSION=`cat bare-version`
   export LC_ALL=C
   umask 0022
+  if [ ${TORBROWSER_VERSION::3} == "3.5" ]; then
+    export TORBROWSER_APP="TorBrowserBundle"
+    export TORBROWSER_NAME="TorBrowserBundle"
+  else
+    export TORBROWSER_APP="TorBrowser"
+    export TORBROWSER_NAME="TorBrowserBundle"
+  fi
   # 
   mkdir -p $OUTDIR/
-  mkdir -p TorBrowserBundle.app/Data/Browser/profile.default/extensions/https-everywhere at eff.org
-  mkdir -p TorBrowserBundle.app/Data/Browser/Caches
-  mkdir -p TorBrowserBundle.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/
-  mkdir -p TorBrowserBundle.app/Docs/sources
+  mkdir -p dmg
+  mkdir -p $TORBROWSER_NAME.app/Data/Browser/profile.default/extensions/https-everywhere at eff.org
+  mkdir -p $TORBROWSER_NAME.app/Data/Browser/Caches
+  mkdir -p $TORBROWSER_NAME.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/
+  mkdir -p $TORBROWSER_NAME.app/Docs/sources
   #
   cd tor-launcher
   make clean
@@ -62,7 +79,7 @@ script: |
   unzip ../*.xpi
   rm ../*.xpi
   ~/build/dzip.sh ../tor-launcher at torproject.org.xpi .
-  mv ../tor-launcher at torproject.org.xpi ../../../TorBrowserBundle.app/Data/Browser/profile.default/extensions/tor-launcher at torproject.org.xpi
+  mv ../tor-launcher at torproject.org.xpi ../../../$TORBROWSER_NAME.app/Data/Browser/profile.default/extensions/tor-launcher at torproject.org.xpi
   cd ../../../
   #
   cd torbutton
@@ -74,7 +91,7 @@ script: |
   unzip ../*.xpi
   rm ../*.xpi
   ~/build/dzip.sh ../torbutton at torproject.org.xpi .
-  mv ../torbutton at torproject.org.xpi ../../../TorBrowserBundle.app/Data/Browser/profile.default/extensions/torbutton at torproject.org.xpi
+  mv ../torbutton at torproject.org.xpi ../../../$TORBROWSER_NAME.app/Data/Browser/profile.default/extensions/torbutton at torproject.org.xpi
   cd ../../../
   #
   cd https-everywhere
@@ -82,11 +99,11 @@ script: |
   # makexpi.sh. See https://trac.torproject.org/projects/tor/ticket/10066
   rm -f .git/refs/heads/master
   ./makexpi.sh
-  cp ./pkg/*.xpi ../TorBrowserBundle.app/Data/Browser/profile.default/extensions/https-everywhere at eff.org.xpi
+  cp ./pkg/*.xpi ../$TORBROWSER_NAME.app/Data/Browser/profile.default/extensions/https-everywhere at eff.org.xpi
   cd ..
   #
-  cp *.xpi ./TorBrowserBundle.app/Data/Browser/profile.default/extensions/
-  cd ./TorBrowserBundle.app/Data/Browser/profile.default/extensions/
+  cp *.xpi ./$TORBROWSER_NAME.app/Data/Browser/profile.default/extensions/
+  cd ./$TORBROWSER_NAME.app/Data/Browser/profile.default/extensions/
   mv noscript at noscript.net.xpi {73a6fe31-595d-460b-a920-fcc0f8843232}.xpi
   cd https-everywhere at eff.org
   unzip ../https-everywhere at eff.org.xpi
@@ -95,14 +112,14 @@ script: |
   #
   unzip relativelink-src.zip
   cd RelativeLink
-  cp RelativeLinkOSX.sh ../TorBrowserBundle.app/Contents/MacOS/TorBrowserBundle
+  cp RelativeLinkOSX.sh ../$TORBROWSER_NAME.app/Contents/MacOS/TorBrowserBundle
   cd ..
   #
   unzip ~/build/tor-mac$GBUILD_BITS-gbuilt.zip
   if [ $BUILD_PT_BUNDLES ]; then
     unzip ~/build/pluggable-transports-mac$GBUILD_BITS-gbuilt.zip
   fi
-  cd TorBrowserBundle.app
+  cd $TORBROWSER_NAME.app
   unzip ~/build/mac-skeleton.zip
   sed -i -e "s/TORBROWSER_VERSION/$TORBROWSER_VERSION/" Contents/Info.plist
   unzip ~/build/tbb-docs.zip
@@ -117,40 +134,54 @@ script: |
   cd ../../../
   #
   # Copy reproducibility info
-  cp versions TorBrowserBundle.app/Docs/sources/
-  cp bundle.inputs TorBrowserBundle.app/Docs/sources/bundle.inputs
+  cp versions $TORBROWSER_NAME.app/Docs/sources/
+  cp bundle.inputs $TORBROWSER_NAME.app/Docs/sources/bundle.inputs
   #
-  # FF24 puts the prefs in a different jar:
-  if [ -f TorBrowserBundle.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/browser/omni.ja ]; then
-     pushd TorBrowserBundle.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/browser/
-  else
-     pushd TorBrowserBundle.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/
-  fi
+  # Set up DMG skeleton
+  cd libdmg-hfsplus
+  cmake CMakeLists.txt
+  cd dmg
+  make
+  cd ../../
+  cd dmg
+  unzip ~/build/mac-dmg.zip
+  cd ..
+  #
+  # FF24 puts the prefs in the browser jar:
+  pushd $TORBROWSER_NAME.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/browser/
   unzip omni.ja defaults/preferences/000-tor-browser.js
   cp defaults/preferences/000-tor-browser.js ~/build/
   echo "pref(\"general.useragent.locale\", \"en-US\");" >> defaults/preferences/000-tor-browser.js
   zip -Xm omni.ja defaults/preferences/000-tor-browser.js
   popd
-  # XXX: DMG plz
-  cp -a TorBrowserBundle.app TorBrowserBundle_en-US.app
-  ~/build/dzip.sh $OUTDIR/TorBrowserBundle-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_en-US.zip TorBrowserBundle_en-US.app
-  rm -rf TorBrowserBundle_en-US.app
+  #
+  if [ ${TORBROWSER_VERSION::3} == "3.5" ]; then
+   cp -a ~/build/$TORBROWSER_NAME.app ~/build/${TORBROWSER_NAME}_en-US.app
+    ~/build/dzip.sh $OUTDIR/TorBrowserBundle-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_en-US.zip ${TORBROWSER_NAME}_en-US.app
+   rm -rf ~/build/${TORBROWSER_NAME}_en-US.app
+  else
+   cp -a ~/build/$TORBROWSER_NAME.app ~/build/dmg/$TORBROWSER_APP.app
+    ~/build/ddmg.sh $OUTDIR/TorBrowser-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_en-US.dmg ~/build/dmg
+   rm -rf ~/build/dmg/$TORBROWSER_APP.app
+  fi
+  mv $TORBROWSER_NAME.app ${TORBROWSER_NAME}_plain.app
   #
   unzip mac-langpacks.zip
   cd mac-langpacks
-  for i in *.xpi
+  for LANG in $BUNDLE_LOCALES
   do
-    LANG=`basename $i .xpi`
-    cp -a ../TorBrowserBundle.app ../TorBrowserBundle_$LANG.app
-    cp $i ../TorBrowserBundle_$LANG.app/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
-    cd ..
-
-    # FF24 puts the prefs in a different jar:
-    if [ -f TorBrowserBundle_$LANG.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/browser/omni.ja ]; then
-       pushd TorBrowserBundle_$LANG.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/browser/
+    xpi=$LANG.xpi
+    if [ ${TORBROWSER_VERSION::3} == "3.5" ]; then
+      DEST=${TORBROWSER_APP}_$LANG
     else
-       pushd TorBrowserBundle_$LANG.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/
+      DEST=$TORBROWSER_APP
     fi
+    cp -a ../${TORBROWSER_NAME}_plain.app ~/build/dmg/$DEST.app
+    cp $xpi ~/build/dmg/$DEST.app/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
+    cd ..
+
+    # FF24 puts the prefs in the browser jar:
+    pushd ~/build/dmg/$DEST.app/Contents/MacOS/TorBrowser.app/Contents/MacOS/browser/
 
     mkdir -p defaults/preferences
     cp ~/build/000-tor-browser.js defaults/preferences/000-tor-browser.js
@@ -158,8 +189,15 @@ script: |
     zip -Xm omni.ja defaults/preferences/000-tor-browser.js
     popd
 
-    ~/build/dzip.sh $OUTDIR/TorBrowserBundle-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_$LANG.zip TorBrowserBundle_$LANG.app
-    rm -rf TorBrowserBundle_$LANG.app
+    if [ ${TORBROWSER_VERSION::3} == "3.5" ]; then
+       pushd ~/build/dmg/
+       ~/build/dzip.sh $OUTDIR/TorBrowserBundle-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_$LANG.zip $DEST.app
+       rm -rf TorBrowserBundle_$LANG.app
+       popd
+    else
+       ~/build/ddmg.sh $OUTDIR/TorBrowser-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_$LANG.dmg ~/build/dmg/
+       rm -rf ~/build/dmg/$DEST.app
+    fi
     cd mac-langpacks
   done 
   cd ..
diff --git a/gitian/fetch-inputs.sh b/gitian/fetch-inputs.sh
index d757f4d..c2bf811 100755
--- a/gitian/fetch-inputs.sh
+++ b/gitian/fetch-inputs.sh
@@ -292,6 +292,7 @@ pyptlib               https://git.torproject.org/pluggable-transports/pyptlib.gi
 obfsproxy             https://git.torproject.org/pluggable-transports/obfsproxy.git
 flashproxy            https://git.torproject.org/flashproxy.git
 fteproxy              https://github.com/kpdyer/fteproxy.git
+libdmg-hfsplus        https://github.com/vasi/libdmg-hfsplus.git $LIBDMG_TAG
 EOF
 
 exit 0
diff --git a/gitian/mkbundle-mac.sh b/gitian/mkbundle-mac.sh
index e8b3aa1..d6bffce 100755
--- a/gitian/mkbundle-mac.sh
+++ b/gitian/mkbundle-mac.sh
@@ -62,6 +62,9 @@ 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.dmg
+rm -f $GITIAN_DIR/inputs/mac-dmg.zip
+$WRAPPER_DIR/build-helpers/dzip.sh $GITIAN_DIR/inputs/mac-dmg.zip .
 
 cd $WRAPPER_DIR
 
@@ -155,7 +158,7 @@ then
   
   cd $WRAPPER_DIR && ./record-inputs.sh $VERSIONS_FILE && cd $GITIAN_DIR
   
-  ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit https-everywhere=$HTTPSE_TAG,torbutton=$TORBUTTON_TAG,tor-launcher=$TORLAUNCHER_TAG $DESCRIPTOR_DIR/mac/gitian-bundle.yml
+  ./bin/gbuild -j $NUM_PROCS -m $VM_MEMORY --commit libdmg-hfsplus=$LIBDMG_TAG,https-everywhere=$HTTPSE_TAG,torbutton=$TORBUTTON_TAG,tor-launcher=$TORLAUNCHER_TAG $DESCRIPTOR_DIR/mac/gitian-bundle.yml
   if [ $? -ne 0 ];
   then
     #mv var/build.log ./bundle-fail-mac.log.`date +%Y%m%d%H%M%S`
@@ -164,7 +167,7 @@ then
   
   #cp -a build/out/*.dmg $WRAPPER_DIR
   mkdir -p $WRAPPER_DIR/$TORBROWSER_VERSION/
-  cp -a build/out/*.zip $WRAPPER_DIR/$TORBROWSER_VERSION/ || exit 1
+  cp -a build/out/* $WRAPPER_DIR/$TORBROWSER_VERSION/ || exit 1
   touch $GITIAN_DIR/inputs/bundle-mac.gbuilt
 else
   echo 
diff --git a/gitian/versions b/gitian/versions
index f3dfe9d..a29a4ba 100755
--- a/gitian/versions
+++ b/gitian/versions
@@ -15,6 +15,7 @@ MINGW_REV=6184
 PYPTLIB_TAG=pyptlib-0.0.5
 OBFSPROXY_TAG=obfsproxy-0.2.4
 FLASHPROXY_TAG=1.6
+LIBDMG_TAG=dfd5e5cc3dc1191e37d3c3a6118975afdd1d7014
 
 GITIAN_TAG=tor-browser-builder-3.0-4
 
diff --git a/gitian/versions.alpha b/gitian/versions.alpha
index 0741b8f..55efa38 100755
--- a/gitian/versions.alpha
+++ b/gitian/versions.alpha
@@ -15,6 +15,7 @@ MINGW_REV=6184
 PYPTLIB_TAG=pyptlib-0.0.5
 OBFSPROXY_TAG=obfsproxy-0.2.4
 FLASHPROXY_TAG=1.6
+LIBDMG_TAG=dfd5e5cc3dc1191e37d3c3a6118975afdd1d7014
 
 GITIAN_TAG=tor-browser-builder-3.0-4
 
diff --git a/gitian/versions.beta b/gitian/versions.beta
index 6ac5a34..241e855 100755
--- a/gitian/versions.beta
+++ b/gitian/versions.beta
@@ -17,6 +17,7 @@ PYPTLIB_TAG=pyptlib-0.0.5
 OBFSPROXY_TAG=obfsproxy-0.2.4
 FLASHPROXY_TAG=1.6
 FTEPROXY_TAG=0.2.6
+LIBDMG_TAG=dfd5e5cc3dc1191e37d3c3a6118975afdd1d7014
 
 GITIAN_TAG=tor-browser-builder-3.0-4
 
diff --git a/gitian/versions.diff b/gitian/versions.diff
new file mode 100644
index 0000000..69001a8
--- /dev/null
+++ b/gitian/versions.diff
@@ -0,0 +1,45 @@
+diff --git a/gitian/versions.nightly b/gitian/versions.nightly
+index b9b5835..f3dfe9d 100755
+--- a/gitian/versions.nightly
++++ b/gitian/versions.nightly
+@@ -12,13 +12,14 @@ NSIS_TAG=v0.1
+ ZLIB_TAG=v1.2.8
+ LIBEVENT_TAG=release-2.0.21-stable
+ MINGW_REV=6184
+-PYPTLIB_TAG=pyptlib-0.0.4
+-OBFSPROXY_TAG=obfsproxy-0.2.3
++PYPTLIB_TAG=pyptlib-0.0.5
++OBFSPROXY_TAG=obfsproxy-0.2.4
+ FLASHPROXY_TAG=1.6
+ 
+ GITIAN_TAG=tor-browser-builder-3.0-4
+ 
+ OPENSSL_VER=1.0.1f
++GMP_VER=5.1.3
+ FIREFOX_LANG_VER=24.3.0esr
+ BINUTILS_VER=2.22
+ GCC_VER=4.6.3
+@@ -33,6 +34,7 @@ SETUPTOOLS_VER=1.4
+ 
+ ## File names for the source packages
+ OPENSSL_PACKAGE=openssl-${OPENSSL_VER}.tar.gz
++GMP_PACKAGE=gmp-${GMP_VER}.tar.bz2
+ NOSCRIPT_PACKAGE=noscript_security_suite-2.6.8.13-fn+sm+fx.xpi
+ TOOLCHAIN4_PACKAGE=x86_64-apple-darwin10.tar.xz
+ OSXSDK_PACKAGE=apple-uni-sdk-10.6_20110407-0.flosoft1_i386.deb
+@@ -52,6 +54,7 @@ SETUPTOOLS_PACKAGE=setuptools-${SETUPTOOLS_VER}.tar.gz
+ 
+ # Hashes for packages with weak sigs or no sigs
+ OPENSSL_HASH=6cc2a80b17d64de6b7bac985745fdaba971d54ffd7d38d3556f998d7c0c9cb5a
++GMP_HASH=752079520b4690531171d0f4532e40f08600215feefede70b24fabdc6f1ab160
+ OSXSDK_HASH=6602d8d5ddb371fbc02e2a5967d9bd0cd7358d46f9417753c8234b923f2ea6fc
+ TOOLCHAIN4_HASH=7b71bfe02820409b994c5c33a7eab81a81c72550f5da85ff7af70da3da244645
+ NOSCRIPT_HASH=0d90f283ee9e3be5bb1ebc315fab12994ff5a15380bd3a2fdff62750286b4ea1
+@@ -67,6 +70,7 @@ SETUPTOOLS_HASH=75d288687066ed124311d6ca5f40ffa92a0e81adcd7fff318c6e84082713cf39
+ 
+ ## Non-git package URLs
+ OPENSSL_URL=https://www.openssl.org/source/${OPENSSL_PACKAGE}
++GMP_URL=https://ftp.gnu.org/gnu/gmp/${GMP_PACKAGE}
+ TOOLCHAIN4_URL=https://people.torproject.org/~mikeperry/mirrors/sources/${TOOLCHAIN4_PACKAGE}
+ OSXSDK_URL=https://launchpad.net/~flosoft/+archive/cross-apple/+files/${OSXSDK_PACKAGE}
+ BINUTILS_URL=https://ftp.gnu.org/gnu/binutils/${BINUTILS_PACKAGE}
diff --git a/gitian/versions.nightly b/gitian/versions.nightly
index 5e6bc6f..5a8fcd0 100755
--- a/gitian/versions.nightly
+++ b/gitian/versions.nightly
@@ -15,6 +15,7 @@ MINGW_REV=6184
 PYPTLIB_TAG=master
 OBFSPROXY_TAG=master
 FLASHPROXY_TAG=master
+LIBDMG_TAG=dfd5e5cc3dc1191e37d3c3a6118975afdd1d7014
 
 GITIAN_TAG=tor-browser-builder-3.0-4
 





More information about the tor-commits mailing list