From 4d552e92bfec0a3b0963b5be7c044c26058c30e7 Mon Sep 17 00:00:00 2001 From: Quentin Casasnovas Date: Fri, 7 Aug 2026 10:22:07 +0200 Subject: [PATCH 1/2] git-import-srpm: add option to skip applying the patches manually. This is useful to only run the `rpmbuild -bp` without trying to reconstruct a full git log, especially when `rpmbuild -bp` fails but when patch application succeeds, to get much faster test iterations. While modifying the options, add the recently added to the usage string and order them alphabetically. Signed-off-by: Quentin Casasnovas --- scripts/git-import-srpm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/git-import-srpm b/scripts/git-import-srpm index 6bd3cf3..f364ce9 100755 --- a/scripts/git-import-srpm +++ b/scripts/git-import-srpm @@ -35,11 +35,11 @@ set -o pipefail THIS_SCRIPT="$(readlink -f "$0")" function usage() { - echo "Usage: $(basename "${THIS_SCRIPT}") [-c CODE_REPO_PATH] [-s SRPM_REPO_PATH] [-f] REVISION" + echo "Usage: $(basename "${THIS_SCRIPT}") [-c CODE_REPO_PATH] [-s SRPM_REPO_PATH] [-f] [-d] [-D] [-N] -a|REVISION" exit "${1}" } -while getopts ":ac:s:dDfh" opt; do +while getopts ":ac:dDfhNs:" opt; do case "${opt}" in a) IMPORT_ALL=true @@ -47,9 +47,6 @@ while getopts ":ac:s:dDfh" opt; do c) CODE_REPO_PATH="$(realpath "${OPTARG}")" ;; - s) - SRPM_REPO_PATH="$(realpath "${OPTARG}")" - ;; d) OOT_DRIVER_IMPORT=true ;; @@ -59,6 +56,12 @@ while getopts ":ac:s:dDfh" opt; do f) FORCE_IMPORT=1 ;; + N) + NO_MANUAL_PATCHES=1 + ;; + s) + SRPM_REPO_PATH="$(realpath "${OPTARG}")" + ;; h|*) if [ "${opt}" = "h" ]; then usage 0; else usage 1; fi ;; @@ -597,7 +600,7 @@ rpmbuild --nodeps \ -bp "${SRPM_REPO_WORKTREE}/${SPEC_FILE}" |& sed 's/^/(rpmbuild)/' >> "${COMMAND_LOGS}" & RPMBUILD_PID=$! -if [[ -z "${OOT_DRIVER_IMPORT}" ]]; then +if [[ -z "${OOT_DRIVER_IMPORT}" ]] && [[ -z "${NO_MANUAL_PATCHES:-}" ]]; then cd "${SRPM_REPO_WORKTREE}" while IFS= read -r l; do From 97459a1af9226e0b696384f7f0503072feb3aa43 Mon Sep 17 00:00:00 2001 From: Quentin Casasnovas Date: Fri, 7 Aug 2026 10:23:00 +0200 Subject: [PATCH 2/2] git-import-srpm: genericize gathering base version from package_srccommit. The edk2 is not the only package explicitly giving the source sha1 onto which the patches need to be applied, this is also true for example for the linux kernel. Prefer using this information over infering the valid remote tag, as it should be more reliable and in fact is for the CIP kernels. Signed-off-by: Quentin Casasnovas --- scripts/git-import-srpm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/git-import-srpm b/scripts/git-import-srpm index f364ce9..6be714d 100755 --- a/scripts/git-import-srpm +++ b/scripts/git-import-srpm @@ -187,19 +187,20 @@ function get_base_version() { function get_source_commit() { local worktree="$1" local revision="$2" + local source_commit check_spec_file "${worktree}" "${revision}" - if [[ ${PRODUCT} = "edk2" ]]; then - local source_commit + + if git -C "${worktree}" show "${revision}:${SPEC_FILE}" | awk '/package_srccommit/{found=1} END{exit !found}'; then + source_commit=$(git -C "${worktree}" show "${revision}:${SPEC_FILE}" | \ + awk '$1 == "%global" && $2 == "package_srccommit" { print $3; exit }' + ) + echo "${source_commit}" + elif [[ ${PRODUCT} = "edk2" ]]; then source_commit=$(git -C "${worktree}" show "${revision}:${SPEC_FILE}" | \ - awk '$1 == "%global" && $2 == "package_srccommit" { print $3; exit }' - ) - if [[ -z ${source_commit} ]]; then - source_commit=$(git -C "${worktree}" show "${revision}:${SPEC_FILE}" | \ - awk '$1 == "%global" && $2 == "edk2_githash" { print $3; exit }' - ) - fi + awk '$1 == "%global" && $2 == "edk2_githash" { print $3; exit }' + ) if [[ -z ${source_commit} ]]; then echo "${SPEC_FILE} does not define package_srccommit" 1>&2 exit 1