Commit b014d103 authored by Anthony Mallet's avatar Anthony Mallet
Browse files

[mk] Fail less hard if no alternative is available for a dependency

A package was completely disabled if user preferences for alternative selection
(if any) could not be satisfied. This was useful in particular with python, to
not try building packages with python versions that are by default not
available on a system.

However, completely disabling a package because of this creates nasty side
effects if one just want to extract the package or otherwise check its
requirements. This could also break the "mirror distfiles" bulk builds.

Thus the alternative selection now considers all available alternatives (still
sorted with the user preference first) and two kind of errors can be generated:

 1. The first kind is when no alternative exist at all. This is still a fatal
    error, this indicates something really wrong with the dependencies.

 2. An alternative exists, but is not in the user preferences. This is a "soft"
    error (triggered only for cbbh (aka. build) targets and not cbeh
    (aka. extract) targets).

This solves the "mirror distfiles" issue while preserving the good old
behaviour of not building a package with a user-disabled alternative.
parent 286150ab
# Copyright (c) 2008-2013,2016 LAAS/CNRS
# Copyright (c) 2008-2013,2016,2018 LAAS/CNRS
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
......@@ -138,7 +138,9 @@ $(foreach _,$(filter-out ${_alt_list},${PKG_ALTERNATIVES}),$(eval \
# compute acceptable alternatives, based on PREFER_ALTERNATIVE.<pkg>
$(foreach _,${_alt_list},$(eval \
_alt_select.$_:=$(filter ${PKG_ALTERNATIVES.$_},${PREFER_ALTERNATIVE.$_})))
# choose a version: generate a list of test for each pattern in order of
# preference. Then pass this to 'or', so that the first match wins. This
......@@ -152,12 +154,17 @@ $(foreach _,${_alt_list},$(eval \
$(foreach _,${_alt_list},$(eval \
override PKG_ALTERNATIVE.$_:=$$(strip $$(or $(value _alt_test.$_)))))
# check empty PKG_ALTERNATIVE.<pkg>
# check if PKG_ALTERNATIVE.<pkg> is acceptable
override define _alt_error
ifeq (,${PKG_ALTERNATIVE.$1})
"$${bf}No acceptable $1 alternatives could be found among$${rm}" \
else ifeq (,$(filter ${PREFER_ALTERNATIVE.$1},${PKG_ALTERNATIVE.$1}))
"$${bf}No acceptable $1 alternatives could be found$${rm}" \
" Suggested value: ${PKG_ALTERNATIVE.$1}" ""
$(foreach _,${PKG_ALTERNATIVES},$(eval $(call _alt_error,$_)))
# Copyright (c) 2011,2013-2014 LAAS/CNRS
# Copyright (c) 2011,2013-2014,2018 LAAS/CNRS
# All rights reserved.
# Permission to use, copy, modify, and distribute this software for any purpose
......@@ -147,7 +147,8 @@ ifdef PKG_ALTERNATIVES
"(PREFER_ALTERNATIVE.$_):$${rm}"; \
$(foreach 1,${PKG_ALTERNATIVES.$_}, \
$(if $(strip ${PKG_ALTERNATIVE_SELECT.$1}), \
$(eval 0=$(if $(filter ${PKG_ALTERNATIVE.$_},$1),*)) \
$(eval 0=$(if $(filter ${PKG_ALTERNATIVE.$_},$1),$(if \
$(filter ${PREFER_ALTERNATIVE.$_},$1),*,-))) \
$(eval n=$(or $(call wordn,$1,${PREFER_ALTERNATIVE.$_}))), \
$(eval 0=) \
$(eval n=n/a)) \
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment