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>
Merges are common. `git cherry-pick` can't cherry-pick merge commit and
requires specifying which of the parents should be cherry-picked, so
it's a pain. But merges are also commonly empty, so it's safe to skip them.
This change goes through all merges touching libbpf files, checks that
they don't have any conflict resolution diffs. If there are any, abort,
if not, proceed as usual, ignoring merges.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
With xsk.{o,h} changes we started including Linux UAPI's if_xdp.h
header. We need to sync it along the other UAPI headers.
Also updated README to reflect this.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Previous version of script relied on squashing baseline commit and
rebasing rest of commits on top of it. This doesn't work well with git
histories containing merges. This patch changes approach by cherry-picking
commits that have libbpf-related changes and then rewriting history since
last checkpoint.
This still might fail if there were manually resolved merge conflicts for
libbpf, but it's the best we can get as far as I can tell.
Script now also verifies that state of libbpf in Linux's repository exactly
matches the state of libbpf in github repo.
If everything goes smoothing (including verification step), we clean up after
ourselves and only leave libbpf-sync-XXX branch in github's libbpf repo to
push to remote.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
This script automates the process of applying libbpf-relevant changes
from kernel repository on top of current state of libbpf repository.
It uses CHECKPOINT-COMMIT file to keep track of last commit in kernel
repo up to which libbpf is in sync with. If there are any new libbpf
changes in kernel repository, script extracts them, preserving original
commit metadata. It also creates a "sync commit" using cover letter as
a template, which nicely summarizes changes since last sync with kernel.
Usage: ./scripts/sync-kernel.sh <linux-repo> <libbpf-repo>
If it succeeds, script will create a bunch of local commits in
<libbpf-repo> in separate branch, which can be easily pushed into github
to create a pull request.
Script tries to clean up after itself, except in case of failure. But it
doesn't clean up timestamped branches it creates in both kernel and
libbpf repositories for now. We can add that later.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>