Comment 2 for bug 1958411

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kernel (master)

Reviewed: https://review.opendev.org/c/starlingx/kernel/+/825333
Committed: https://opendev.org/starlingx/kernel/commit/98156ab9116d98d0e10ad618f6586476d3da5dc1
Submitter: "Zuul (22348)"
Branch: master

commit 98156ab9116d98d0e10ad618f6586476d3da5dc1
Author: M. Vefa Bicakci <email address hidden>
Date: Thu Jan 13 19:02:53 2022 -0500

    kernel-modules: Fix 'build-pkgs --edit'

    Since commit f438b8b5f6fb ("Support out of tree modules in kernel
    5.10.", 2021-06-30), the use of 'build-pkgs --edit' has resulted in the
    following errors:

      ===
      raw_create_tarballs_extract_script ...
      EXTRACT_TO_DIR=.../std/srpm_work/i40e-kmod/gits/i40e-kmod.spec
      ++ umask 022
      ++ cd .../std/srpm_work/i40e-kmod/gits/i40e-kmod.spec
      ++ source scl_source enable devtoolset-8
      +++ _scl_source_help='Usage: source scl_source <action> [<collection> ...]

      Don'\''t use this script outside of SCL scriptlets!

      Options:
          -h, --help display this help and exit'
      +++ '[' 2 -eq 0 -o enable = -h -o enable = --help ']'
      +++ '[' -z '' ']'
      +++ _recursion=false
      +++ '[' -z '' ']'
      +++ _scl_scriptlet_name=enable
      +++ shift 1
      +++ '[' -z '' ']'
      +++ _scl_dir=/etc/scl/conf
      +++ '[' '!' -e /etc/scl/conf ']'
      +++ for arg in '"$@"'
      +++ _scl_prefix_file=/etc/scl/conf/devtoolset-8
      ++++ cat /etc/scl/conf/devtoolset-8
      +++ _scl_prefix=
      ERROR: Failed in script '.../std/srpm_work/i40e-kmod/extract_script'
      ERROR: tar_and_spec_extract_to_git (2361): tarball_extract failed ...
      ===

    This is caused by the use of 'source scl_source enable ...' in the
    %prep sections of the out-of-tree kernel modules' spec files. In
    summary, the build procedure is executed with a shell that has 'xtrace'
    (i.e., 'set -x') enabled, and the 'source' statement to pull in the
    software collections for updated toolchains causes debugging lines to be
    printed out. These lines are in turn attempted to be parsed by the
    cgcs-root/build-tools/srpm-utils shell script to generate a source code
    extraction script for the '--edit' mode. However, the unexpected shell
    debugging output confuses srpm-utils, which causes 'build-pkgs --edit'
    to fail.

    All of this can be avoided by removing the 'source scl_source enable'
    lines from the %prep sections, which are only expected to unpack the
    source code, and hence are not involved in compilation, and hence do not
    need to be aware of updated toolchains. This commit takes this approach
    instead of attempting to modify the srpm-utils shell script, given the
    author's lack of familiarity with the script in question.

    This commit also removes unnecessary use of the 'llvm-toolset-7.0'
    software collection from the kernel modules for two reasons:
    - The modified kernel modules do not use the LLVM/clang toolchain.
    - The attempt to use the llvm-toolset-7.0 toolchain was likely broken
      from day 1, because the kernel modules do not actually depend on the
      llvm-toolset-7.0 toolchain via a 'Requires:' line in their spec files.
      No errors were encountered because of the ' || :' at the end of the
      line, which causes errors to be ignored.

    Testing:
    - An ISO image was successfully built using a monolithic build
      procedure.

    Change-Id: Ie0772efa0f98963186f36d993b02d28ac0e4575d
    Fixes: f438b8b5f6fb ("Support out of tree modules in kernel 5.10.")
    Closes-Bug: 1958411
    Signed-off-by: M. Vefa Bicakci <email address hidden>