Alexander Pyhalov
2018-11-14 e5ce0bbdf74916ba267eef37e2e37694e8f2b48a
Fix cryptography build after setuptools update

Based on following solaris-userland commit:

From ca77d72dc246de31f961b0e00bce66cb1ad986ff Mon Sep 17 00:00:00 2001
From: Libor Bukata <Libor.Bukata@oracle.com>
Date: Wed, 3 Oct 2018 08:35:53 +0100
Subject: [PATCH] 28732185 Missing support for python ABI3 compliant extensions
6 files modified
140 ■■■■■ changed files
components/python/cryptography/Makefile 5 ●●●● patch | view | raw | blame | history
components/python/cryptography/manifests/sample-manifest.p5m 18 ●●●● patch | view | raw | blame | history
doc/makefile-variables.txt 5 ●●●●● patch | view | raw | blame | history
make-rules/ips.mk 79 ●●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 15 ●●●●● patch | view | raw | blame | history
transforms/python-3-soabi 18 ●●●● patch | view | raw | blame | history
components/python/cryptography/Makefile
@@ -23,11 +23,14 @@
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
#
# Component uses ABI3 naming.
PYTHON3_SOABI=abi3
include ../../../make-rules/shared-macros.mk
COMPONENT_NAME=        cryptography
COMPONENT_VERSION=    2.1.4
COMPONENT_REVISION=    2
COMPONENT_REVISION=    3
COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH=    \
components/python/cryptography/manifests/sample-manifest.p5m
@@ -131,13 +131,13 @@
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/backends/openssl/utils.py
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/backends/openssl/x25519.py
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/backends/openssl/x509.py
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/64/_constant_time.cpython-34m.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/64/_openssl.cpython-34m.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/64/_padding.cpython-34m.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/64/_constant_time.abi3.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/64/_openssl.abi3.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/64/_padding.abi3.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/__init__.py
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/_constant_time.cpython-34m.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/_openssl.cpython-34m.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/_padding.cpython-34m.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/_constant_time.abi3.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/_openssl.abi3.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/_padding.abi3.so
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/openssl/__init__.py
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/openssl/_conditional.py
file path=usr/lib/python3.4/vendor-packages/cryptography/hazmat/bindings/openssl/binding.py
@@ -212,9 +212,9 @@
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/backends/openssl/x25519.py
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/backends/openssl/x509.py
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/__init__.py
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/_constant_time.cpython-35m.so
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/_openssl.cpython-35m.so
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/_padding.cpython-35m.so
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/_constant_time.abi3.so
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/_openssl.abi3.so
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/_padding.abi3.so
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/openssl/__init__.py
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/openssl/_conditional.py
file path=usr/lib/python3.5/vendor-packages/cryptography/hazmat/bindings/openssl/binding.py
doc/makefile-variables.txt
@@ -118,6 +118,11 @@
  studio_OPT.$(MACH).$(BITS) versions of this available if greater specificity
  is needed.
* Variable PYTHON3_SOABI selects between two library naming schemes of
  python3 extensions: *.cpython3Xm.so ("cpython") or *.abi3.so ("abi3").
  Currently, only a few components use ABI3 compliant extensions,
  therefore, the default value is set to "cpython".
If you frequently rebuild the same code, such as when you maintain a build server
or iterate recipes for the same component, you can benefit by caching the build
products with "ccache" - so for repeated input conditions you'd get same output
make-rules/ips.mk
@@ -85,42 +85,46 @@
PUBLISH_TRANSFORMS +=    $(PKGMOGRIFY_TRANSFORMS)
PUBLISH_TRANSFORMS +=    $(WS_TOP)/transforms/publish-cleanup
define add-limiting-variable
PKG_VARS += $(1)
MANIFEST_LIMITING_VARS += -D $(1)="$(subst #,\#,$($(1)))"
endef
# Make all the limiting variables available to manifest processing
$(foreach var, $(filter PY3_%_NAMING,$(.VARIABLES)), \
    $(eval $(call add-limiting-variable,$(var))))
ifeq   ($(strip $(COMPONENT_AUTOGEN_MANIFEST)),yes)
AUTOGEN_MANIFEST_TRANSFORMS +=        $(WS_TOP)/transforms/generate-cleanup
else
AUTOGEN_MANIFEST_TRANSFORMS +=        $(WS_TOP)/transforms/drop-all
endif
PKG_MACROS +=        MACH=$(MACH)
PKG_MACROS +=        MACH32=$(MACH32)
PKG_MACROS +=        MACH64=$(MACH64)
PKG_MACROS +=        PUBLISHER=$(PUBLISHER)
PKG_MACROS +=        PUBLISHER_LOCALIZABLE=$(PUBLISHER_LOCALIZABLE)
PKG_MACROS +=        CONSOLIDATION=$(CONSOLIDATION)
PKG_MACROS +=        BUILD_VERSION=$(BUILD_VERSION)
PKG_MACROS +=        SOLARIS_VERSION=$(SOLARIS_VERSION)
PKG_MACROS +=        OS_VERSION=$(OS_VERSION)
PKG_MACROS +=        PKG_SOLARIS_VERSION=$(PKG_SOLARIS_VERSION)
PKG_MACROS +=        HUMAN_VERSION=$(HUMAN_VERSION)
PKG_MACROS +=        IPS_COMPONENT_VERSION=$(IPS_COMPONENT_VERSION)
PKG_MACROS +=        COMPONENT_VERSION=$(COMPONENT_VERSION)
PKG_MACROS +=        COMPONENT_PROJECT_URL=$(COMPONENT_PROJECT_URL)
PKG_MACROS +=        COMPONENT_ARCHIVE_URL=$(COMPONENT_ARCHIVE_URL)
PKG_MACROS +=        COMPONENT_HG_URL=$(COMPONENT_HG_URL)
PKG_MACROS +=        COMPONENT_HG_REV=$(COMPONENT_HG_REV)
PKG_MACROS +=        COMPONENT_NAME=$(COMPONENT_NAME)
PKG_MACROS +=        COMPONENT_FMRI=$(COMPONENT_FMRI)
PKG_MACROS +=        COMPONENT_LICENSE_FILE=$(COMPONENT_LICENSE_FILE)
PKG_MACROS +=        TPNO=$(TPNO)
PKG_MACROS +=        USERLAND_GIT_REMOTE=$(USERLAND_GIT_REMOTE)
PKG_MACROS +=        USERLAND_GIT_BRANCH=$(USERLAND_GIT_BRANCH)
PKG_MACROS +=        USERLAND_GIT_REV=$(USERLAND_GIT_REV)
# For items defined as variables or that may contain whitespace, add
# them to a list to be expanded into PKG_OPTIONS later.
PKG_VARS += ARC_CASE TPNO
PKG_VARS += MACH MACH32 MACH64
PKG_VARS += BUILD_VERSION OS_VERSION PKG_SOLARIS_VERSION
PKG_VARS += CONSOLIDATION
PKG_VARS += COMPONENT_VERSION IPS_COMPONENT_VERSION HUMAN_VERSION
PKG_VARS += COMPONENT_ARCHIVE_URL COMPONENT_PROJECT_URL COMPONENT_NAME
PKG_VARS += COMPONENT_FMRI COMPONENT_LICENSE_FILE
PKG_VARS += COMPONENT_SUMMARY COMPONENT_DESCRIPTION COMPONENT_LICENSE
PKG_VARS += HG_REPO HG_REV HG_URL COMPONENT_HG_URL COMPONENT_HG_REV
PKG_VARS += GIT_COMMIT_ID GIT_REPO GIT_TAG
PKG_VARS += MACH MACH32 MACH64
PKG_VARS += PUBLISHER PUBLISHER_LOCALIZABLE
PKG_VARS += USERLAND_GIT_REMOTE USERLAND_GIT_BRANCH USERLAND_GIT_REV
# For items that need special definition, add them to PKG_MACROS.
# IPS_COMPONENT_VERSION suitable for use in regular expressions.
PKG_MACROS += IPS_COMPONENT_RE_VERSION=$(subst .,\\.,$(IPS_COMPONENT_VERSION))
# COMPONENT_VERSION suitable for use in regular expressions.
PKG_MACROS += COMPONENT_RE_VERSION=$(subst .,\\.,$(COMPONENT_VERSION))
PKG_OPTIONS +=        $(PKG_MACROS:%=-D %) \
                    -D COMPONENT_SUMMARY="$(strip $(COMPONENT_SUMMARY))" \
                    -D COMPONENT_CLASSIFICATION="org.opensolaris.category.2008:$(strip $(COMPONENT_CLASSIFICATION))" \
                    -D COMPONENT_DESCRIPTION="$(strip $(COMPONENT_DESCRIPTION))" \
                    -D COMPONENT_LICENSE="$(strip $(COMPONENT_LICENSE))"
                    -D COMPONENT_CLASSIFICATION="org.opensolaris.category.2008:$(strip $(COMPONENT_CLASSIFICATION))"
PKG_MACROS +=           PYTHON_2.7_ONLY=\#
PKG_MACROS +=           PYTHON_3.4_ONLY=\#
@@ -270,16 +274,16 @@
# Define and execute a macro that generates a rule to create a manifest for a
# python module specific to a particular version of the python runtime.
define python-manifest-rule
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY=
$(MANIFEST_BASE)-%-$(2).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY=
ifneq ($(filter $(1),$(PYTHON_64_ONLY_VERSIONS)),)
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_32_ONLY=\#
$(MANIFEST_BASE)-%-$(2).mogrified: PKG_MACROS += PYTHON_32_ONLY=\#
endif
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m
    $(PKGMOGRIFY) -D PYVER=$(1) -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@
$(MANIFEST_BASE)-%-$(2).p5m: %-PYVER.p5m
    $(PKGMOGRIFY) -D PYVER=$(1) $(MANIFEST_LIMITING_VARS) -D PYV=$(2)  $$< > $$@
endef
$(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver))))
$(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver),$(shell echo $(ver)|tr -d .))))
# A rule to create a helper transform package for python, that will insert the
# appropriate conditional dependencies into a python library's
@@ -524,6 +528,15 @@
    $(error Missing canonical manifest(s))
endif
# Component variables are expanded directly to PKG_OPTIONS instead of via
# PKG_MACROS since the values may contain whitespace.
mkdefine = -D $(1)="$(2)"
# Expand PKG_VARS into defines via PKG_OPTIONS.
$(foreach var, $(PKG_VARS), \
    $(eval PKG_OPTIONS += $(call mkdefine,$(var),$$($(var)))) \
)
# This converts required paths to containing package names for be able to
# properly setup the build environment for a component.
required-pkgs.mk:    Makefile
make-rules/shared-macros.mk
@@ -151,6 +151,21 @@
PYTHON_64_ONLY_VERSIONS = 3.5
# PYTHON3_SOABI variable defines the naming scheme
# of python3 extension libraries: cpython or abi3.
# Currently, most of the components use cpython naming scheme by default,
# only python/xattr and python/cryptography require abi3 naming.
PYTHON3_SOABI ?= cpython
ifeq ($(PYTHON3_SOABI),cpython)
PY3_CYTHON_NAMING=
PY3_ABI3_NAMING=\#
else ifeq ($(PYTHON3_SOABI),abi3)
PY3_CYTHON_NAMING=\#
PY3_ABI3_NAMING=
else
$(error "Invalid python naming scheme '$(PYTHON3_SOABI)' selected!")
endif
BASS_O_MATIC =    $(WS_TOOLS)/bass-o-matic
CLONEY =    $(WS_TOOLS)/cloney
transforms/python-3-soabi
@@ -20,7 +20,7 @@
#
#
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
#
# Python 2's ABI for .so files is to simply append ".so".  But for Python
@@ -28,6 +28,16 @@
# "d" is added if built --with-pydebug (we don't), "m" is added if built
# --with-pymalloc (we do) and "u" is added if built --with-wide-unicode
# (we don't).  See http://legacy.python.org/dev/peps/pep-3149/ for details.
<transform file -> edit path \
    (usr/lib/python3.)([4-9])(/vendor-packages/(.*/)?(64/)?.*)\.so$ \
    \\1\\2\\3.cpython-3\\2m.so >
$(PY3_CYTHON_NAMING)<transform file -> edit path \
$(PY3_CYTHON_NAMING)      (usr/lib/python3.)([4-9])(/vendor-packages/(.*/)?(64/)?.*)\.so$ \
$(PY3_CYTHON_NAMING)      \\1\\2\\3.cpython-3\\2m.so >
# A newer version of python setup tools enables to create ABI3 compliant
# extensions that should support all python3.X versions where X >= 2.
# The compiled shared libraries have ".abi3.so" suffix to indicate the
# usage of the limited API. Currently, only the components that depend on
# library/python/cffi are forced to generate ABI3 compliant extensions.
# See https://www.python.org/dev/peps/pep-0384/ for more information.
$(PY3_ABI3_NAMING)<transform file -> edit path \
$(PY3_ABI3_NAMING)      (usr/lib/python3.)([4-9])(/vendor-packages/(.*/)?(64/)?.*)\.so$ \
$(PY3_ABI3_NAMING)      \\1\\2\\3.abi3.so >