Files
rpi-buildroot/package/cracklib/cracklib.mk
Fabrice Fontaine 42eae73ef1 package/cracklib: python needs autoreconf
Set CRACKLIB_AUTORECONF when building python to regenerate py-compile
and avoid the following build failure with python 3.12 (which removed
imp module) raised since commit
36e635d2d5:

Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'imp'
make[3]: *** [Makefile:485: install-pythonPYTHON] Error 1

Indeed, after autoreconf, py-compile will contain:

if test "$python_major" -le 2; then
  import_lib=imp
  import_test="hasattr(imp, 'get_tag')"
  import_call=imp.cache_from_source
  import_arg2=', False' # needed in one call and not the other
else
  import_lib=importlib
  import_test="hasattr(sys.implementation, 'cache_tag')"
  import_call=importlib.util.cache_from_source
  import_arg2=
fi

$PYTHON -c "
import sys, os, py_compile, $import_lib

instead of:

import sys, os, py_compile, imp

Fixes: 36e635d2d5
 - http://autobuild.buildroot.org/results/aec4c19fdf8087c76c1d5f472e855e0f84fcf7fd

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-07-13 15:00:17 +02:00

61 lines
1.9 KiB
Makefile

################################################################################
#
# cracklib
#
################################################################################
CRACKLIB_VERSION = 2.9.11
CRACKLIB_SOURCE = cracklib-$(CRACKLIB_VERSION).tar.xz
CRACKLIB_SITE = https://github.com/cracklib/cracklib/releases/download/v$(CRACKLIB_VERSION)
CRACKLIB_LICENSE = LGPL-2.1
CRACKLIB_LICENSE_FILES = COPYING.LIB
CRACKLIB_CPE_ID_VALID = YES
CRACKLIB_INSTALL_STAGING = YES
CRACKLIB_DEPENDENCIES = host-cracklib $(TARGET_NLS_DEPENDENCIES)
CRACKLIB_CONF_ENV = LIBS=$(TARGET_NLS_LIBS)
ifeq ($(BR2_PACKAGE_ZLIB),y)
CRACKLIB_CONF_OPTS += --with-zlib
CRACKLIB_DEPENDENCIES += zlib
else
CRACKLIB_CONF_OPTS += --without-zlib
endif
ifeq ($(BR2_PACKAGE_PYTHON3),y)
# py-compile must be rebuilt because python 3.12 removed imp module
CRACKLIB_AUTORECONF = YES
CRACKLIB_CONF_OPTS += --with-python
CRACKLIB_CONF_ENV += \
ac_cv_path_PYTHON=$(HOST_DIR)/bin/python3 \
am_cv_python_version=$(PYTHON3_VERSION_MAJOR)
CRACKLIB_DEPENDENCIES += python3
else
CRACKLIB_CONF_OPTS += --without-python
endif
HOST_CRACKLIB_CONF_OPTS += --without-python --without-zlib
ifeq ($(BR2_PACKAGE_CRACKLIB_FULL_DICT),y)
CRACKLIB_EXTRA_DOWNLOADS = cracklib-words-$(CRACKLIB_VERSION).xz
CRACKLIB_DICT_SOURCE = $(CRACKLIB_DL_DIR)/cracklib-words-$(CRACKLIB_VERSION).xz
else
CRACKLIB_DICT_SOURCE = $(@D)/dicts/cracklib-small
endif
ifeq ($(BR2_PACKAGE_CRACKLIB_TOOLS),)
define CRACKLIB_REMOVE_TOOLS
rm -f $(TARGET_DIR)/usr/sbin/*cracklib*
endef
CRACKLIB_POST_INSTALL_TARGET_HOOKS += CRACKLIB_REMOVE_TOOLS
endif
define CRACKLIB_BUILD_DICT
$(HOST_MAKE_ENV) cracklib-format $(CRACKLIB_DICT_SOURCE) | \
$(HOST_MAKE_ENV) cracklib-packer $(TARGET_DIR)/usr/share/cracklib/pw_dict
rm $(TARGET_DIR)/usr/share/cracklib/cracklib-small
endef
CRACKLIB_POST_INSTALL_TARGET_HOOKS += CRACKLIB_BUILD_DICT
$(eval $(autotools-package))
$(eval $(host-autotools-package))