build-linux.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #! /bin/bash -vex
  2. set -x -e
  3. echo "running as" $(id)
  4. . /home/worker/scripts/xvfb.sh
  5. ####
  6. # Taskcluster friendly wrapper for performing fx desktop builds via mozharness.
  7. ####
  8. # Inputs, with defaults
  9. : MOZHARNESS_SCRIPT ${MOZHARNESS_SCRIPT}
  10. : MOZHARNESS_CONFIG ${MOZHARNESS_CONFIG}
  11. : MOZHARNESS_ACTIONS ${MOZHARNESS_ACTIONS}
  12. : MOZHARNESS_OPTIONS ${MOZHARNESS_OPTIONS}
  13. : TOOLTOOL_CACHE ${TOOLTOOL_CACHE:=/home/worker/tooltool-cache}
  14. : NEED_XVFB ${NEED_XVFB:=false}
  15. : MH_CUSTOM_BUILD_VARIANT_CFG ${MH_CUSTOM_BUILD_VARIANT_CFG}
  16. : MH_BRANCH ${MH_BRANCH:=mozilla-central}
  17. : MH_BUILD_POOL ${MH_BUILD_POOL:=staging}
  18. : MOZ_SCM_LEVEL ${MOZ_SCM_LEVEL:=1}
  19. : WORKSPACE ${WORKSPACE:=/home/worker/workspace}
  20. set -v
  21. fail() {
  22. echo # make sure error message is on a new line
  23. echo "[build-linux.sh:error]" "${@}"
  24. exit 1
  25. }
  26. export MOZ_OBJDIR=obj-firefox
  27. export TINDERBOX_OUTPUT=1
  28. # use "simple" package names so that they can be hard-coded in the task's
  29. # extras.locations
  30. export MOZ_SIMPLE_PACKAGE_NAME=target
  31. # Do not try to upload symbols (see https://bugzilla.mozilla.org/show_bug.cgi?id=1164615)
  32. export MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
  33. # Ensure that in tree libraries can be found
  34. export LIBRARY_PATH=$LIBRARY_PATH:$WORKSPACE/src/obj-firefox:$WORKSPACE/src/gcc/lib64
  35. # test required parameters are supplied
  36. if [[ -z ${MOZHARNESS_SCRIPT} ]]; then fail "MOZHARNESS_SCRIPT is not set"; fi
  37. if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi
  38. cleanup() {
  39. local rv=$?
  40. cleanup_xvfb
  41. exit $rv
  42. }
  43. trap cleanup EXIT INT
  44. # run XVfb in the background, if necessary
  45. if $NEED_XVFB; then
  46. start_xvfb '1024x768x24' 2
  47. fi
  48. # set up mozharness configuration, via command line, env, etc.
  49. debug_flag=""
  50. if [ 0$DEBUG -ne 0 ]; then
  51. debug_flag='--debug'
  52. fi
  53. custom_build_variant_cfg_flag=""
  54. if [ -n "${MH_CUSTOM_BUILD_VARIANT_CFG}" ]; then
  55. custom_build_variant_cfg_flag="--custom-build-variant-cfg=${MH_CUSTOM_BUILD_VARIANT_CFG}"
  56. fi
  57. # $TOOLTOOL_CACHE bypasses mozharness completely and is read by tooltool_wrapper.sh to set the
  58. # cache. However, only some mozharness scripts use tooltool_wrapper.sh, so this may not be
  59. # entirely effective.
  60. export TOOLTOOL_CACHE
  61. # support multiple, space delimited, config files
  62. config_cmds=""
  63. for cfg in $MOZHARNESS_CONFIG; do
  64. config_cmds="${config_cmds} --config ${cfg}"
  65. done
  66. # if MOZHARNESS_ACTIONS is given, only run those actions (completely overriding default_actions
  67. # in the mozharness configuration)
  68. if [ -n "$MOZHARNESS_ACTIONS" ]; then
  69. actions=""
  70. for action in $MOZHARNESS_ACTIONS; do
  71. actions="$actions --$action"
  72. done
  73. fi
  74. # if MOZHARNESS_OPTIONS is given, append them to mozharness command line run
  75. # e.g. enable-pgo
  76. if [ -n "$MOZHARNESS_OPTIONS" ]; then
  77. options=""
  78. for option in $MOZHARNESS_OPTIONS; do
  79. options="$options --$option"
  80. done
  81. fi
  82. cd /home/worker
  83. python2.7 $WORKSPACE/build/src/testing/${MOZHARNESS_SCRIPT} ${config_cmds} \
  84. $debug_flag \
  85. $custom_build_variant_cfg_flag \
  86. --disable-mock \
  87. $actions \
  88. $options \
  89. --log-level=debug \
  90. --scm-level=$MOZ_SCM_LEVEL \
  91. --work-dir=$WORKSPACE/build \
  92. --branch=${MH_BRANCH} \
  93. --build-pool=${MH_BUILD_POOL}