From 20a042faa91acf8db78684de9f38c4e628d61dd6 Mon Sep 17 00:00:00 2001 From: vladmos Date: Fri, 1 Jun 2018 04:51:21 -0700 Subject: Format all bzl files with buildifier This CL aslo enables a presubmit check for correct formatting of all bzl files in //third_party/bazel. PiperOrigin-RevId: 198857055 --- scripts/packages/self_extract_binary.bzl | 81 +++++++++++++++++--------------- 1 file changed, 42 insertions(+), 39 deletions(-) (limited to 'scripts/packages') diff --git a/scripts/packages/self_extract_binary.bzl b/scripts/packages/self_extract_binary.bzl index 75f19279c3..24e3ddf2b5 100644 --- a/scripts/packages/self_extract_binary.bzl +++ b/scripts/packages/self_extract_binary.bzl @@ -33,45 +33,48 @@ and a ZIP footer with the following entries: """ def _self_extract_binary(ctx): - """Implementation for the self_extract_binary rule.""" - # This is a bit complex for stripping out timestamps - zip_artifact = ctx.new_file(ctx.label.name + ".zip") - touch_empty_files = [ - "mkdir -p $(dirname ${tmpdir}/%s); touch ${tmpdir}/%s" % (f, f) - for f in ctx.attr.empty_files - ] - cp_resources = [ - ("mkdir -p $(dirname ${tmpdir}/%s)\n" % r.short_path + - "cp %s ${tmpdir}/%s" % (r.path, r.short_path)) - for r in ctx.files.resources - ] - cp_flatten_resources = [ - "cp %s ${tmpdir}/%s" % (r.path, r.basename) - for r in ctx.files.flatten_resources - ] - ctx.action( - inputs = ctx.files.resources + ctx.files.flatten_resources, - outputs = [zip_artifact], - command = "\n".join([ - "tmpdir=$(mktemp -d ${TMPDIR:-/tmp}/tmp.XXXXXXXX)", - "trap \"rm -fr ${tmpdir}\" EXIT" - ] + touch_empty_files + cp_resources + cp_flatten_resources + [ - "find ${tmpdir} -exec touch -t 198001010000.00 '{}' ';'", - "(d=${PWD}; cd ${tmpdir}; zip -rq ${d}/%s *)" % zip_artifact.path, - ]), - mnemonic = "ZipBin", - ) - ctx.action( - inputs = [ctx.file.launcher, zip_artifact], - outputs = [ctx.outputs.executable], - command = "\n".join([ - "cat %s %s > %s" % (ctx.file.launcher.path, - zip_artifact.path, - ctx.outputs.executable.path), - "zip -qA %s" % ctx.outputs.executable.path - ]), - mnemonic = "BuildSelfExtractable", - ) + """Implementation for the self_extract_binary rule.""" + + # This is a bit complex for stripping out timestamps + zip_artifact = ctx.new_file(ctx.label.name + ".zip") + touch_empty_files = [ + "mkdir -p $(dirname ${tmpdir}/%s); touch ${tmpdir}/%s" % (f, f) + for f in ctx.attr.empty_files + ] + cp_resources = [ + ("mkdir -p $(dirname ${tmpdir}/%s)\n" % r.short_path + + "cp %s ${tmpdir}/%s" % (r.path, r.short_path)) + for r in ctx.files.resources + ] + cp_flatten_resources = [ + "cp %s ${tmpdir}/%s" % (r.path, r.basename) + for r in ctx.files.flatten_resources + ] + ctx.action( + inputs = ctx.files.resources + ctx.files.flatten_resources, + outputs = [zip_artifact], + command = "\n".join([ + "tmpdir=$(mktemp -d ${TMPDIR:-/tmp}/tmp.XXXXXXXX)", + "trap \"rm -fr ${tmpdir}\" EXIT", + ] + touch_empty_files + cp_resources + cp_flatten_resources + [ + "find ${tmpdir} -exec touch -t 198001010000.00 '{}' ';'", + "(d=${PWD}; cd ${tmpdir}; zip -rq ${d}/%s *)" % zip_artifact.path, + ]), + mnemonic = "ZipBin", + ) + ctx.action( + inputs = [ctx.file.launcher, zip_artifact], + outputs = [ctx.outputs.executable], + command = "\n".join([ + "cat %s %s > %s" % ( + ctx.file.launcher.path, + zip_artifact.path, + ctx.outputs.executable.path, + ), + "zip -qA %s" % ctx.outputs.executable.path, + ]), + mnemonic = "BuildSelfExtractable", + ) self_extract_binary = rule( _self_extract_binary, -- cgit v1.2.3