[tor-commits] [tor-browser-bundle/master] Forcibly overwrite .pyc timestamps.

mikeperry at torproject.org mikeperry at torproject.org
Tue Jan 21 04:47:04 UTC 2014


commit faa70d800950656a2e21600dd2a9225b645f7576
Author: David Fifield <david at bamsoftware.com>
Date:   Sun Dec 1 19:23:35 2013 +0000

    Forcibly overwrite .pyc timestamps.
    
    For each extension module, py2exe generates and byte-compiles a tiny
    stub .py file that loads the module:
    
    creating python loader for extension 'bz2' (Z:\home\ubuntu\install\python\DLLs\bz2.pyd -> bz2.pyd)
    
    These .py stubs are dynamically generated at py2exe time, so we don't
    have an opportunity to set the mtime of .py files ahead of time. But we
    can set the .pyc timestamps after the fact.
    
    I believe this commit makes bd4b3de712e345adc20ec9e959759f03da5826bc
    superfluous, but I'm leaving that one because I hope there is a nicer
    way to do this one.
---
 .../windows/gitian-pluggable-transports.yml           |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gitian/descriptors/windows/gitian-pluggable-transports.yml b/gitian/descriptors/windows/gitian-pluggable-transports.yml
index 801a33d..534a2f0 100644
--- a/gitian/descriptors/windows/gitian-pluggable-transports.yml
+++ b/gitian/descriptors/windows/gitian-pluggable-transports.yml
@@ -34,6 +34,7 @@ files:
 - "python.msi"
 - "py2exe.exe"
 - "dzip.sh"
+- "pyc-timestamp.sh"
 script: |
   INSTDIR="$HOME/install"
   PTDIR="$INSTDIR/Tor/PluggableTransports"
@@ -57,6 +58,20 @@ script: |
   mkdir -p $INSTDIR/Data/Tor/
   mkdir -p $OUTDIR/
   #
+  # Set the timestamp on every .pyc file in a zip file, and re-dzip the zip file.
+  function py2exe_zip_timestomp {
+    ZIPFILE="$1"
+    local tmpdir="$(mktemp -d)"
+    local tmpzip="$(mktemp -u)"
+    unzip -d "$tmpdir" "$ZIPFILE"
+    cd "$tmpdir"
+    find . -name '*.pyc' -print0 | xargs -0 ~/build/pyc-timestamp.sh "$REFERENCE_DATETIME"
+    ~/build/dzip.sh "$tmpzip" .
+    cd -
+    mv -f "$tmpzip" "$ZIPFILE"
+    rm -rf "$tmpdir"
+  }
+  #
   # Install a Wine new enough to have a fix for http://bugs.winehq.org/show_bug.cgi?id=29764;
   # otherwise Python run under Wine constantly crashes in _PyVerify_fd, which is
   # called by such common operations as io.open and os.fstat (anything involving
@@ -142,6 +157,7 @@ script: |
   cd obfsproxy
   find -type f | xargs touch --date="$REFERENCE_DATETIME"
   LD_PRELOAD= $INSTPYTHON setup_py2exe.py py2exe
+  py2exe_zip_timestomp py2exe_bundle/dist/obfsproxy.zip
   cp -an py2exe_bundle/dist/{*.pyd,*.exe,*.zip} $PTDIR/
   mkdir -p $INSTDIR/Docs/Obfsproxy
   cp {LICENSE,README} $INSTDIR/Docs/Obfsproxy
@@ -166,6 +182,7 @@ script: |
   cd flashproxy
   find -type f | xargs touch --date="$REFERENCE_DATETIME"
   make dist-exe DISTNAME=flashproxy-client PYTHON="LD_PRELOAD= $INSTPYTHON"
+  py2exe_zip_timestomp dist/flashproxy-client/py2exe-flashproxy.zip
   cp -an dist/flashproxy-client/{*.pyd,*.exe,*.zip} $PTDIR/
   mkdir -p $INSTDIR/Docs/FlashProxy
   cp {doc/*,README,LICENSE,ChangeLog} $INSTDIR/Docs/FlashProxy





More information about the tor-commits mailing list