-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce a new patching system with complex version range support, a…
…nd use it to fix idm support in 5.10
- Loading branch information
Showing
10 changed files
with
523 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ -z "${1}" ] | ||
then | ||
echo "Usage: cdn-url.sh <KERNEL_VERSION>" >&2 | ||
exit 1 | ||
fi | ||
|
||
KERNEL_VERSION="${1}" | ||
MAJOR_VERSION="$(echo "${KERNEL_VERSION}" | awk -F '.' '{print $1}')" | ||
MINOR_VERSION="$(echo "${KERNEL_VERSION}" | awk -F '.' '{print $2}')" | ||
PATCH_VERSION="$(echo "${KERNEL_VERSION}" | awk -F '.' '{print $3}')" | ||
|
||
if [ "${PATCH_VERSION}" = "0" ] | ||
then | ||
KERNEL_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}" | ||
fi | ||
|
||
echo "https://cdn.kernel.org/pub/linux/kernel/v${MAJOR_VERSION}.x/linux-${KERNEL_VERSION}.tar.gz" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import json | ||
import os | ||
import sys | ||
from packaging.version import parse | ||
from pathlib import Path | ||
|
||
if len(sys.argv) != 3: | ||
print("Usage: patchlist <KERNEL_VERSION> <KERNEL_FLAVOR>") | ||
exit(1) | ||
|
||
target_version = parse(sys.argv[1]) | ||
kernel_flavor = sys.argv[2] | ||
series = "%s.%s" % (target_version.major, target_version.minor) | ||
|
||
common_patches = [] | ||
with open("patches/common/patches.json") as f: | ||
common_patches = json.load(f) | ||
|
||
apply_patches = [] | ||
|
||
def maybe(m, k): | ||
if k in m: | ||
return m[k] | ||
else: | ||
return None | ||
|
||
for patch in common_patches: | ||
file_name = patch["patch"] | ||
order = patch["order"] | ||
lower = maybe(patch, "lower") | ||
only_series = maybe(patch, "series") | ||
upper = maybe(patch, "upper") | ||
if lower is not None: | ||
lower = parse(lower) | ||
if upper is not None: | ||
upper = parse(upper) | ||
|
||
apply = False | ||
|
||
if lower is None and upper is not None: | ||
if target_version <= upper: | ||
apply = True | ||
|
||
if lower is not None and upper is None: | ||
if target_version >= lower: | ||
apply = True | ||
|
||
if lower is not None and upper is not None: | ||
if target_version >= lower and target_version <= upper: | ||
apply = True | ||
|
||
if only_series is not None and only_series != series: | ||
apply = False | ||
|
||
if apply: | ||
apply_patches.append({ | ||
"patch": "patches/common/%s" % file_name, | ||
"order": order, | ||
}) | ||
|
||
base_series_path = Path("patches/%s/base/series" % series) | ||
if base_series_path.is_file(): | ||
with base_series_path.open() as base_series_file: | ||
lines = base_series_file.readlines() | ||
for i, line in enumerate(lines): | ||
line = line.strip() | ||
if len(line) == 0: | ||
continue | ||
apply_patches.append({ | ||
"patch": "patches/%s/base/%s" % (series, line), | ||
"order": i + 1, | ||
}) | ||
|
||
flavor_series_path = Path("patches/%s/%s/series" % (series, kernel_flavor)) | ||
if flavor_series_path.is_file(): | ||
with flavor_series_path.open() as flavor_series_file: | ||
lines = flavor_series_file.readlines() | ||
for i, line in enumerate(lines): | ||
line = line.strip() | ||
if len(line) == 0: | ||
continue | ||
apply_patches.append({ | ||
"patch": "patches/%s/%s/%s" % (series, kernel_flavor, line), | ||
"order": i + 1, | ||
}) | ||
|
||
apply_patches.sort(key=lambda patch: patch["order"]) | ||
|
||
for patch in apply_patches: | ||
print(patch["patch"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
REAL_SCRIPT="$(realpath "${0}")" | ||
cd "$(dirname "${REAL_SCRIPT}")/.." | ||
KERNEL_DIR="$(realpath "${PWD}")" | ||
|
||
# shellcheck source-path=SCRIPTDIR source=common.sh | ||
. "${KERNEL_DIR}/hack/common.sh" |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.