comparison third_party/mercurial/runtime.bzl @ 249:c5129452493e

[deploy] Bundle Mercurial with hg-web Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Tue, 04 Aug 2026 04:16:45 -0700
parents
children
comparison
equal deleted inserted replaced
248:b8b6e726964a 249:c5129452493e
1 def _mercurial_runtime_impl(ctx):
2 output = ctx.actions.declare_directory(ctx.label.name)
3 ctx.actions.run_shell(
4 inputs = [ctx.file.archive, ctx.file.launcher],
5 outputs = [output],
6 command = """
7 set -e
8 mkdir -p {output}/bin
9 unzip -q {archive} -d {output}
10 cp {output}/mercurial-7.2.3.dist-info/licenses/COPYING {output}/COPYING
11 cp {launcher} {output}/bin/hg
12 chmod 0555 {output}/bin/hg
13 chmod -R a-w {output}/hgdemandimport {output}/hgext {output}/mercurial
14 """.format(
15 archive = ctx.file.archive.path,
16 launcher = ctx.file.launcher.path,
17 output = output.path,
18 ),
19 progress_message = "Assembling pure-Python Mercurial runtime",
20 )
21 return [
22 DefaultInfo(
23 files = depset([output]),
24 runfiles = ctx.runfiles(files = [output]),
25 ),
26 ]
27
28 mercurial_runtime = rule(
29 implementation = _mercurial_runtime_impl,
30 attrs = {
31 "archive": attr.label(allow_single_file = True, mandatory = True),
32 "launcher": attr.label(allow_single_file = True, mandatory = True),
33 },
34 )