1807834-respect-dmg-hfs-env.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # HG changeset patch
  2. # User Mac Tosh <mac198442@yahoo.com>
  3. # Date 1672226897 0
  4. Bug 1807834 - Respect DMG_TOOL, HFS_TOOL and MKFSHFS environment variables.
  5. diff --git a/python/mozbuild/mozbuild/action/make_dmg.py b/python/mozbuild/mozbuild/action/make_dmg.py
  6. --- a/python/mozbuild/mozbuild/action/make_dmg.py
  7. +++ b/python/mozbuild/mozbuild/action/make_dmg.py
  8. @@ -1,15 +1,18 @@
  9. # This Source Code Form is subject to the terms of the Mozilla Public
  10. # License, v. 2.0. If a copy of the MPL was not distributed with this
  11. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  12. import argparse
  13. import platform
  14. import sys
  15. +
  16. +import buildconfig
  17. +
  18. from pathlib import Path
  19. from mozpack import dmg
  20. from mozbuild.bootstrap import bootstrap_toolchain
  21. from mozbuild.repackaging.application_ini import get_application_ini_value
  22. is_linux = platform.system() == "Linux"
  23. @@ -41,19 +44,25 @@ def main(args):
  24. if options.volume_name:
  25. volume_name = options.volume_name
  26. else:
  27. volume_name = get_application_ini_value(
  28. options.inpath, "App", "CodeName", fallback="Name"
  29. )
  30. # Resolve required tools
  31. - dmg_tool = bootstrap_toolchain("dmg/dmg")
  32. - hfs_tool = bootstrap_toolchain("dmg/hfsplus")
  33. - mkfshfs_tool = bootstrap_toolchain("hfsplus/newfs_hfs")
  34. + dmg_tool = buildconfig.substs.get("DMG_TOOL")
  35. + if not dmg_tool:
  36. + dmg_tool = bootstrap_toolchain("dmg/dmg")
  37. + hfs_tool = buildconfig.substs.get("HFS_TOOL")
  38. + if not hfs_tool:
  39. + hfs_tool = bootstrap_toolchain("dmg/hfsplus")
  40. + mkfshfs_tool= buildconfig.substs.get("MKFSHFS")
  41. + if not mkfshfs_tool:
  42. + mkfshfs_tool = bootstrap_toolchain("hfsplus/newfs_hfs")
  43. dmg.create_dmg(
  44. source_directory=Path(options.inpath),
  45. output_dmg=Path(options.dmgfile),
  46. volume_name=volume_name,
  47. extra_files=extra_files,
  48. dmg_tool=dmg_tool,
  49. hfs_tool=hfs_tool,