Commit a282d24
kernel: check for remote url instead of .git existence
Current implementation of .git checking have some issues:
- If a kernel source being cloned using git-repo tool, especially
newer version, it will clone .git in .repo inside of the submodule
source.
- Newer kernel source changed how $(src) & $(srctree) output. In
the case of kernel 6.11 as I tested $(src) show the relative path
of the symlink in drivers/ instead of KernelSU main directory.
Which makes checking for ../.git existence comletely useless.
One idea I would like to propose is to check for the remote URL in
$(src). If the remote is correct then we can assume this is
KSU repo and then count the version (also unshallow the repo).
Here's what I did:
- Check if kernel is 6.9+ and then change $(src) accordingly.
- Print $(src) remote in verbose and check for the correct
URL (both ssh & https).
- If correct, check if the repo is shallow by using
git rev-parse --is-shallow-repository. Unshallow if it's return true.
- Calculate version as usual.
The only drawback I can see so far is that forks will have to edit
the url in the Makefile, which I don't think it's much of an issue.
* Unmerged PR:
tiann#2102
Signed-off-by: hmtheboy154 <[email protected]>
Signed-off-by: Faris <[email protected]>1 parent dd8389d commit a282d24
1 file changed
+26
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
24 | 45 | | |
25 | 46 | | |
26 | 47 | | |
27 | 48 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
36 | | - | |
37 | 53 | | |
38 | 54 | | |
39 | 55 | | |
| |||
0 commit comments