Skip to content

Repository files navigation

diffoscope-aws-lambda-layer

AWS Lambda layers with diffoscope and some tools it needs.

How to make the layer

Either take a .zip package generated for the current release or build it yourself, e.g.

./make_layer.sh python3.6

and upload with

./upload_layer.sh python3.6 # requires properly configured "aws" command

How to use in Lambda

First, you need to set two environment variables:

MAGIC=/usr/share/misc/magic:/opt/magic
LD_PRELOAD=/opt/lib/libarchive.so

Second, use this snippet to run diffoscope:

fromdiffoscope.loggingimportline_eraser, setup_loggingfromdiffoscope.mainimportcreate_parser, run_diffoscopefromdiffoscope.profilingimportProfileManager, profilefromdiffoscope.progressimportProgressManager, Progressdefhandler(event, context):
# ...args= [files[v1], files[v2], "--html", output_file]
withprofile("main", "parse_args"):
parser, post_parse=create_parser()
parsed_args=parser.parse_args(args)
print(parsed_args)
log_handler=ProgressManager().setup(parsed_args)
withsetup_logging(parsed_args.debug, log_handler) aslogger:
post_parse(parsed_args)
run_diffoscope(parsed_args)
# serve output_file as text/html

About

AWS Lambda layer with diffoscope and everything it needs

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages