mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-21 00:39:07 +08:00
sync-kernel.sh: detect synced commits, interactively resolve conflicts
1. There is one commit ("libbpf: fix btf_dedup equivalence check
handling of different kinds"), which was originally committed into bpf
tree and manually synced into libbpf (it was a critical bug fix). Now
that bpf and bpf-next trees were merged, this causes duplicate commits in
libbpf. To address this, check is added to see if libbpf repo already has
a commit with the same subject and allow to skip it.
2. Just checking by subject is not good enough, as we currently have few
different commits with the same subject "bpf: Sync bpf.h to tools/".
To address this, script now will ask user whether to skip or cherry-pick
commit. This allows for human to double-check the commit and make
informed devision.
3. There is a commit ('bfb35c27c65f bpf: fix whitespace for ENCAP_L2
defines in bpf.h'), which modifies both include/uapi/linux/bpf.h and
tools/include/uapi/linux/bpf.h in the same commit. This break the
sync script, as it doesn't cherry-pick commits that hasn't modified
libbpf files. So at the time that commit bfb35c27c65f is applied, linux
repo is missing some preceding changes to include/uapi/linux/bpf.h. They
would normally be ignored later during repo filtering, but to do
cherry-pick they are necessary. It's hard to fix it automatically, so
script will wait for user to resolve the issue and continue.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
This commit is contained in:
committed by
yonghong-song
parent
2d1959ff60
commit
61419aae26
@@ -77,9 +77,31 @@ for LIBBPF_NEW_MERGE in ${LIBBPF_NEW_MERGES}; do
|
||||
fi
|
||||
done
|
||||
|
||||
cd ${WORKDIR} && cd ${LIBBPF_REPO}
|
||||
git log --oneline -n500 > ${TMP_DIR}/libbpf_commits.txt
|
||||
cd ${WORKDIR} && cd ${LINUX_REPO}
|
||||
|
||||
LIBBPF_NEW_COMMITS=$(git rev-list --no-merges --topo-order --reverse ${BASELINE_TAG}..${TIP_TAG} ${LIBBPF_PATHS[@]})
|
||||
for LIBBPF_NEW_COMMIT in ${LIBBPF_NEW_COMMITS}; do
|
||||
git cherry-pick ${LIBBPF_NEW_COMMIT}
|
||||
echo "Checking commit '${LIBBPF_NEW_COMMIT}'"
|
||||
SYNCED_COMMITS=$(grep -F "$(git log -n1 --pretty=format:%s ${LIBBPF_NEW_COMMIT})" ${TMP_DIR}/libbpf_commits.txt || echo "")
|
||||
if [ -n "${SYNCED_COMMITS}" ]; then
|
||||
# commit with the same subject is already in libbpf, but it's not 100% the same commit, so check with user
|
||||
echo "Commit '$(git log -n1 --oneline ${LIBBPF_NEW_COMMIT})' appears to be already synced into libbpf..."
|
||||
echo "Corresponding libbpf commit(s):"
|
||||
echo "${SYNCED_COMMITS}"
|
||||
read -p "Do you want to skip it? [y/N]: " SHOULD_SKIP
|
||||
case "${SHOULD_SKIP}" in
|
||||
"y" | "Y")
|
||||
echo "Skipping '$(git log -n1 --oneline ${LIBBPF_NEW_COMMIT})'..."
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# commit hasn't been synced into libbpf yet
|
||||
if ! git cherry-pick ${LIBBPF_NEW_COMMIT}; then
|
||||
read -p "Cherry-picking '$(git log --oneline -n1 ${LIBBPF_NEW_COMMIT})' failed, please fix manually and press <return> to proceed..."
|
||||
fi
|
||||
done
|
||||
|
||||
LIBBPF_TREE_FILTER=' \
|
||||
|
||||
Reference in New Issue
Block a user