Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions scripts/git-import-srpm
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,18 @@ 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
;;
c)
CODE_REPO_PATH="$(realpath "${OPTARG}")"
;;
s)
SRPM_REPO_PATH="$(realpath "${OPTARG}")"
;;
d)
OOT_DRIVER_IMPORT=true
;;
Expand All @@ -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
;;
Expand Down Expand Up @@ -184,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
Expand Down Expand Up @@ -597,7 +601,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
Expand Down
Loading