• [gentoo-dev] [PATCH] linux-info.eclass : Support valid Make files

    From Mike Pagano@21:1/5 to All on Thu Sep 2 21:50:02 2021
    Support the possibility that the Makefile could be
    one of the following and should be checked in
    the order described here:

    https://www.gnu.org/software/make/manual/make.html

    Order of checking and valid Makefiles names:
    GNUMakefile, makefile, Makefile

    Bug: https://bugs.gentoo.org/663368

    Signed-off-by: Mike Pagano <mpagano@gentoo.org>
    ---
    eclass/linux-info.eclass | 33 +++++++++++++++++++++++++++++----
    1 file changed, 29 insertions(+), 4 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 0b6df1bf5..2dfc8979f 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
    # There are also a couple of variables which are set by this, and shouldn't be
    # set by hand. These are as follows:

    +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
    +# @INTERNAL
    +# @DESCRIPTION:
    +# According to upstream documentation, by default, when make looks for the makefile, it tries
    +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
    +# proper Makefile name or the eclass will search in this order for it.
    +# See https://www.gnu.org/software/make/manual/make.html
    +: ${KERNEL_MAKEFILE:=""}
    +
    # @ECLASS-VARIABLE: KV_FULL
    # @OUTPUT_VARIABLE
    # @DESCRIPTION:
    @@ -510,7 +519,9 @@ get_version() {
  • From Sam James@21:1/5 to All on Fri Sep 3 00:20:01 2021
    On 2 Sep 2021, at 20:42, Mike Pagano <mpagano@gentoo.org> wrote:

    Support the possibility that the Makefile could be
    one of the following and should be checked in
    the order described here:

    https://www.gnu.org/software/make/manual/make.html

    Order of checking and valid Makefiles names:
    GNUMakefile, makefile, Makefile

    Bug: https://bugs.gentoo.org/663368

    Signed-off-by: Mike Pagano <mpagano@gentoo.org>
    ---
    eclass/linux-info.eclass | 33 +++++++++++++++++++++++++++++----
    1 file changed, 29 insertions(+), 4 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 0b6df1bf5..2dfc8979f 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
    # There are also a couple of variables which are set by this, and shouldn't be
    # set by hand. These are as follows:
    +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
    +# @INTERNAL
    +# @DESCRIPTION:
    +# According to upstream documentation, by default, when make looks for the makefile, it tries
    +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
    +# proper Makefile name or the eclass will search in this order for it.
    +# See https://www.gnu.org/software/make/manual/make.html
    +: ${KERNEL_MAKEFILE:=""}

    Thanks for adding the reference! I'm often an advocate for adding _more_ links and explanation
    because while it's sometimes a bit dull to add, it makes life a lot easier later on when researching.

    +
    # @ECLASS-VARIABLE: KV_FULL
    # @OUTPUT_VARIABLE
    # @DESCRIPTION:
    @@ -510,7 +519,9 @@ get_version() {
    qeinfo " ${KV_DIR}"
    fi
    - if [ ! -s "${KV_DIR}/Makefile" ]
    + get_makefile
    +
    + if [ ! -s "${KERNEL_MAKEFILE}" ]
    then

    Can you use Bash tests instead?

    (https://devmanual.gentoo.org/tools-reference/bash/#single-versus-double-brackets-in-bash)

    Best,
    sam


    -----BEGIN PGP SIGNATURE-----

    iQGTBAEBCgB9FiEEYOpPv/uDUzOcqtTy9JIoEO6gSDsFAmExS/NfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDYw RUE0RkJGRkI4MzUzMzM5Q0FBRDRGMkY0OTIyODEwRUVBMDQ4M0IACgkQ9JIoEO6g SDsX5wf/amS1I72kqKF9pi0l8+7xVMZ3qUdkrAYgbN8AECrJeqQiqKcd4KKXw29c zwvvp1v6OoR7MT3AyNIuOmLyjoBEV+lK+WQ1gJFFJj6aq6C9Q/PYLzW6dElgWDeu 4WLmN7T5KYKMg+7KXXFYtCwBsgKvcMPFlTTiOJTmWCjf6c/T5gMGTdAiRoDyA1b6 0nco+HWHaXfTGltLAWXwGOw5DFUxJ7zbskd/5+xgcW/C+hdA73ZRUm0y9MWJPg5R sMucQFKz1JZ52M1lfxFluFDR3KCVeAQx1AP9PDoFEXeOkA0BDrqWgSAXojOo2ufa 8D+PmFGa+Tt/zh/iLX78f3uXHkEIVg==
    =r1Ll
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike@21:1/5 to All on Fri Sep 3 01:00:01 2021
    Support the possibility that the Makefile could be
    one of the following and should be checked in the order described here:

    https://www.gnu.org/software/make/manual/make.html

    Order of checking and valid Makefiles names:
    GNUMakefile, makefile, Makefile

    Bug: https://bugs.gentoo.org/663368

    Signed-off-by: Mike Pagano <mpagano@gentoo.org>
    ---
    eclass/linux-info.eclass | 30 ++++++++++++++++++++++++++----
    1 file changed, 26 insertions(+), 4 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 0b6df1bf5..7e225236f 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
    # There are also a couple of variables which are set by this, and shouldn't be
    # set by hand. These are as follows:

    +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
    +# @INTERNAL
    +# @DESCRIPTION:
    +# According to upstream documentation, by default, when make looks for the makefile, it tries
    +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
    +# proper Makefile name or the eclass will search in this order for it.
    +# See https://www.gnu.org/software/make/manual/make.html
    +: ${KERNEL_MAKEFILE:=""}
    +
    # @ECLASS-VARIABLE: KV_FULL
    # @OUTPUT_VARIABLE
    # @DESCRIPTION:
    @@ -510,7 +519,9 @@ get_version() {
    qeinfo "
  • From Mike@21:1/5 to All on Fri Sep 3 01:30:01 2021
    Support the possibility that the Makefile could be
    one of the following and should be checked in the order described here:

    https://www.gnu.org/software/make/manual/make.html

    Order of checking and valid Makefiles names:
    GNUMakefile, makefile, Makefile

    Bug: https://bugs.gentoo.org/663368

    Signed-off-by: Mike Pagano <mpagano@gentoo.org>
    ---
    eclass/linux-info.eclass | 30 ++++++++++++++++++++++++++----
    1 file changed, 26 insertions(+), 4 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 0b6df1bf5..a6159eac2 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
    # There are also a couple of variables which are set by this, and shouldn't be
    # set by hand. These are as follows:

    +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
    +# @INTERNAL
    +# @DESCRIPTION:
    +# According to upstream documentation, by default, when make looks for the makefile, it tries
    +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
    +# proper Makefile name or the eclass will search in this order for it.
    +# See https://www.gnu.org/software/make/manual/make.html
    +: ${KERNEL_MAKEFILE:=""}
    +
    # @ECLASS-VARIABLE: KV_FULL
    # @OUTPUT_VARIABLE
    # @DESCRIPTION:
    @@ -510,7 +519,9 @@ get_version() {
    qeinfo "
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Mike on Fri Sep 3 09:20:02 2021
    On Thu, 2021-09-02 at 19:28 -0400, Mike wrote:
    Support the possibility that the Makefile could be
    one of the following and should be checked in the order described here:

    https://www.gnu.org/software/make/manual/make.html

    Order of checking and valid Makefiles names:
    GNUMakefile, makefile, Makefile

    Bug: https://bugs.gentoo.org/663368

    Signed-off-by: Mike Pagano <mpagano@gentoo.org>
    ---
    eclass/linux-info.eclass | 30 ++++++++++++++++++++++++++----
    1 file changed, 26 insertions(+), 4 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 0b6df1bf5..a6159eac2 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
    # There are also a couple of variables which are set by this, and shouldn't be
    # set by hand. These are as follows:

    +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
    +# @INTERNAL
    +# @DESCRIPTION:
    +# According to upstream documentation, by default, when make looks for the makefile, it tries
    +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
    +# proper Makefile name or the eclass will search in this order for it.
    +# See https://www.gnu.org/software/make/manual/make.html
    +: ${KERNEL_MAKEFILE:=""}
    +
    # @ECLASS-VARIABLE: KV_FULL
    # @OUTPUT_VARIABLE
    # @DESCRIPTION:
    @@ -510,7 +519,9 @@ get_version() {
    qeinfo " ${KV_DIR}"
    fi

    - if [ ! -s "${KV_DIR}/Makefile" ]
    + get_makefile
    +
    + if [[ ! -s "${KERNEL_MAKEFILE}" ]]
    then
    if [ -z "${get_version_warning_done}" ]; then
    get_version_warning_done=1
    @@ -526,9 +537,6 @@ get_version() {
    # do we pass KBUILD_OUTPUT on the CLI?
    local OUTPUT_DIR=${KBUILD_OUTPUT}

    - # keep track of it
    - KERNEL_MAKEFILE="${KV_DIR}/Makefile"
    -
    if [[ -z ${OUTPUT_DIR} ]]; then
    # Decide the function used to extract makefile variables.
    local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}")
    @@ -971,3 +979,17 @@ linux-info_pkg_setup() {

    [ -n "${CONFIG_CHECK}" ] && check_extra_config;
    }
    +
    +# @FUNCTION: get_makefile

    Please prefix it so it doesn't pollute the global namespace.

    +# @DESCRIPTION:
    +# Support the possibility that the Makefile could be one of the following and should
    +# be checked in the order described here:
    +# https://www.gnu.org/software/make/manual/make.html
    +# Order of checking and valid Makefiles names: GNUMakefile, makefile, Makefile
    +get_makefile() {
    +
    + [[ -s "${KV_DIR}"/GNUMakefile ]] && KERNEL_MAKEFILE="${KV_DIR}/GNUMakefile"
    + [[ -s "${KV_DIR}"/makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/makefile"
    + [[ -s "${KV_DIR}"/Makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/Makefile"
    +
    +}

    --
    Best regards,
    Michał Górny

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ulrich Mueller@21:1/5 to All on Fri Sep 3 11:10:01 2021
    On Fri, 03 Sep 2021, Mike wrote:

    - if [ ! -s "${KV_DIR}/Makefile" ]
    + get_makefile
    +
    + if [[ ! -s "${KERNEL_MAKEFILE}" ]]

    <nitpick>
    No quotation marks needed in [[ ]].
    </nitpick

    + [[ -s "${KV_DIR}"/GNUMakefile ]] && KERNEL_MAKEFILE="${KV_DIR}/GNUMakefile"
    + [[ -s "${KV_DIR}"/makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/makefile"
    + [[ -s "${KV_DIR}"/Makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/Makefile"

    Ditto.

    Ulrich

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmEx5aAPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4ufiQIAKkMvCDzqR5iJMYV7udDBp7fCmfzfEKfHbtd q02fvNPQYkZ9uxmDPlH3/j6L3fwHwA3CG741NCS/h/sm/TjyZsFY9oY3pN8daA3I Lvzw/OUm4HzMmdPt9Xxrqe7b5jSUlR8qoa3yz0Qa5J1fYoQDXBrfZSvEBSjr/9wo V7ize5oSnVlmBowWgIEeod1w9ZaU+8nTEbOB4X1mZIKNU/56RQSq9EPD6FFFmup9 KOwNd10k4GeigSusFkxHxWFGQitysS6EQOExdm4Qm/okFzfNLtSBykTJU55bvLBM WU7o25mD6XGpHMGsdsDKMUSPWR1N0xyX13Nx/cmTI6+zhJob6NM=
    =zETv
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Pagano@21:1/5 to All on Fri Sep 3 16:30:02 2021
    Thanks to Sam, mgorny and Ulm for the review.

    Incorporated all requested changes

    Support the possibility that the Makefile could be
    one of the following and should be checked in
    the order described here:

    https://www.gnu.org/software/make/manual/make.html

    Order of checking and valid Makefiles names:
    GNUMakefile, makefile, Makefile

    Bug: https://bugs.gentoo.org/663368

    Signed-off-by: Mike Pagano <mpagano@gentoo.org>
    ---
    eclass/linux-info.eclass | 30 ++++++++++++++++++++++++++----
    1 file changed, 26 insertions(+), 4 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 0b6df1bf5..1379b6008 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -80,6 +80,15 @@ KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
    # There are also a couple of variables which are set by this, and shouldn't be
    # set by hand. These are as follows:

    +# @ECLASS-VARIABLE: KERNEL_MAKEFILE
    +# @INTERNAL
    +# @DESCRIPTION:
    +# According to upstream documentation, by default, when make looks for the makefile, it tries
    +# the following names, in order: GNUmakefile, makefile and Makefile. Set this variable to the
    +# proper Makefile name or the eclass will search in this order for it.
    +# See https://www.gnu.org/software/make/manual/make.html
    +: ${KERNEL_MAKEFILE:=""}
    +
    # @ECLASS-VARIABLE: KV_FULL
    # @OUTPUT_VARIABLE
    # @DESCRIPTION:
    @@ -510,7 +519,9 @@ get_version() {
    qei
  • From Mike Pagano@21:1/5 to Mike Pagano on Sat Sep 4 19:50:01 2021
    On 9/3/21 10:25 AM, Mike Pagano wrote:
    Thanks to Sam, mgorny and Ulm for the review.


    Committed

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)