summaryrefslogtreecommitdiffstats
path: root/config/link.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /config/link.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'config/link.py')
-rw-r--r--config/link.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/config/link.py b/config/link.py
new file mode 100644
index 000000000..be63216a0
--- /dev/null
+++ b/config/link.py
@@ -0,0 +1,47 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import expandlibs_exec
+import sys
+import threading
+import time
+
+def periodically_print_status(proc):
+ """
+ Print something to the console every 20 minutes to prevent the build job
+ from getting killed when linking a large binary.
+ Check status of the linker every 0.5 seconds.
+ """
+ idleTime = 0
+ while proc.returncode is None:
+ time.sleep(0.5)
+ idleTime += 0.5
+ if idleTime > 20 * 60:
+ print "Still linking, 20 minutes passed..."
+ sys.stdout.flush()
+ idleTime = 0
+
+def wrap_linker(args):
+ """
+ Execute |args| and pass resulting |proc| object to a second thread that
+ will track the status of the started |proc|.
+ """
+
+ # This needs to be a list in order for the callback to set the
+ # variable properly with python-2's scoping rules.
+ t = [None]
+ def callback(proc):
+ t[0] = threading.Thread(target=periodically_print_status,
+ args=(proc,))
+ t[0].start()
+ exitcode = expandlibs_exec.main(args, proc_callback=callback)
+ # Wait for the background thread to finish.
+ t[0].join()
+ return exitcode
+
+if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ print >>sys.stderr, "Usage: link.py <commandline>"
+ sys.exit(1)
+ sys.exit(wrap_linker(sys.argv[1:]))