eabglobal / juniper

Juniper is a cli based tool used to package lambda functions
Apache License 2.0
67 stars 9 forks source link

Feature: Support binary dependencies #39

Closed pdiazvargas closed 5 years ago

pdiazvargas commented 5 years ago

WHAT When installing a python package that depend on a set of OS specific libraries to be installed in the container, the build process fails. There are two parts to this issue:

For instance if xmlsec package is added to the requirements file of a container. When juniper tries to build the zip artifact you get the following error:

xmlsec-layer_1   |       File "/tmp/pip-install-s8bn_ccf/xmlsec/xmlsec_setupinfo.py", line 164, in load_xmlsec1_config
xmlsec-layer_1   |         config = pkgconfig.parse('xmlsec1')
xmlsec-layer_1   |       File "/tmp/pip-install-s8bn_ccf/xmlsec/.eggs/pkgconfig-1.5.1-py3.6.egg/pkgconfig/pkgconfig.py", line 248, in parse
xmlsec-layer_1   |         _raise_if_not_exists(package)
xmlsec-layer_1   |       File "/tmp/pip-install-s8bn_ccf/xmlsec/.eggs/pkgconfig-1.5.1-py3.6.egg/pkgconfig/pkgconfig.py", line 103, in _raise_if_not_exists
xmlsec-layer_1   |         raise PackageNotFoundError(package)
xmlsec-layer_1   |     pkgconfig.pkgconfig.PackageNotFoundError: xmlsec1 not found

From the documentation, in order to pip install this particular module, the following OS libraries need to be pre-installed:

yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel

That fixes the original build issue, however, for this particular package, once the pip install succeeds, there are two binaries that must be included in the zip, for the lambda

/usr/lib64/libxmlsec1-openssl.so
/usr/lib64/libxmlsec1.so.1

Support the inclusion of these binaries for both regular lambda functions as well as layers.