patch-waflib_Scripting_py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. --- jack2-1.9.22.orig/waflib/Scripting.py 2023-02-02 12:04:10.000000000 +0100
  2. +++ jack2-1.9.22/waflib/Scripting.py 2026-05-14 18:36:34.596872137 +0200
  3. @@ -216,7 +216,10 @@ def parse_options():
  4. ctx = Context.create_context('options')
  5. ctx.execute()
  6. if not Options.commands:
  7. - Options.commands.append(default_cmd)
  8. + if isinstance(default_cmd, list):
  9. + Options.commands.extend(default_cmd)
  10. + else:
  11. + Options.commands.append(default_cmd)
  12. if Options.options.whelp:
  13. ctx.parser.print_help()
  14. sys.exit(0)
  15. @@ -280,7 +283,7 @@ def distclean_dir(dirname):
  16. pass
  17. try:
  18. - shutil.rmtree('c4che')
  19. + shutil.rmtree(Build.CACHE_DIR)
  20. except OSError:
  21. pass
  22. @@ -303,7 +306,7 @@ def distclean(ctx):
  23. # remove a build folder, if any
  24. cur = '.'
  25. - if ctx.options.no_lock_in_top:
  26. + if os.environ.get('NO_LOCK_IN_TOP') or ctx.options.no_lock_in_top:
  27. cur = ctx.options.out
  28. try:
  29. @@ -329,7 +332,12 @@ def distclean(ctx):
  30. else:
  31. remove_and_log(env.out_dir, shutil.rmtree)
  32. - for k in (env.out_dir, env.top_dir, env.run_dir):
  33. + env_dirs = [env.out_dir]
  34. + if not (os.environ.get('NO_LOCK_IN_TOP') or ctx.options.no_lock_in_top):
  35. + env_dirs.append(env.top_dir)
  36. + if not (os.environ.get('NO_LOCK_IN_RUN') or ctx.options.no_lock_in_run):
  37. + env_dirs.append(env.run_dir)
  38. + for k in env_dirs:
  39. p = os.path.join(k, Options.lockfile)
  40. remove_and_log(p, os.remove)
  41. @@ -380,7 +388,11 @@ class Dist(Context.Context):
  42. for x in files:
  43. archive_name = self.get_base_name() + '/' + x.path_from(self.base_path)
  44. - zip.write(x.abspath(), archive_name, zipfile.ZIP_DEFLATED)
  45. + if os.environ.get('SOURCE_DATE_EPOCH'):
  46. + # TODO: parse that timestamp
  47. + zip.writestr(zipfile.ZipInfo(archive_name), x.read(), zipfile.ZIP_DEFLATED)
  48. + else:
  49. + zip.write(x.abspath(), archive_name, zipfile.ZIP_DEFLATED)
  50. zip.close()
  51. else:
  52. self.fatal('Valid algo types are tar.bz2, tar.gz, tar.xz or zip')
  53. @@ -417,6 +429,8 @@ class Dist(Context.Context):
  54. tinfo.gid = 0
  55. tinfo.uname = 'root'
  56. tinfo.gname = 'root'
  57. + if os.environ.get('SOURCE_DATE_EPOCH'):
  58. + tinfo.mtime = int(os.environ.get('SOURCE_DATE_EPOCH'))
  59. if os.path.isfile(p):
  60. with open(p, 'rb') as f:
  61. @@ -598,12 +612,15 @@ def autoconfigure(execute_method):
  62. cmd = env.config_cmd or 'configure'
  63. if Configure.autoconfig == 'clobber':
  64. tmp = Options.options.__dict__
  65. + launch_dir_tmp = Context.launch_dir
  66. if env.options:
  67. Options.options.__dict__ = env.options
  68. + Context.launch_dir = env.launch_dir
  69. try:
  70. run_command(cmd)
  71. finally:
  72. Options.options.__dict__ = tmp
  73. + Context.launch_dir = launch_dir_tmp
  74. else:
  75. run_command(cmd)
  76. run_command(self.cmd)