-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kernelci/build.py: Add apply_patch_mbox method
Signed-off-by: Nikolay Yurin <[email protected]>
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import tarfile | ||
import time | ||
import urllib.parse | ||
import tempfile | ||
|
||
import requests | ||
from kernelci import shell_cmd, print_flush, __version__ as kernelci_version | ||
|
@@ -321,6 +322,20 @@ def _download_file(url, dest_filename, chunk_size=1024): | |
return False | ||
|
||
|
||
def apply_patch_mbox(path, mbox_url): | ||
with tempfile.NamedTemporaryFile(prefix="kernel-patch-") as tmp_f: | ||
if not _download_file(mbox_url, tmp_f.name): | ||
raise FileNotFoundError(f"Error downloading patch mbox {mbox_url}") | ||
|
||
shell_cmd(""" | ||
set -e | ||
cd {path} | ||
git config user.name "kernelci-tsc" | ||
git config user.email "[email protected]" | ||
git am --3way {mbox_file} | ||
""".format(path=path, mbox_file=tmp_f.name)) | ||
|
||
|
||
def pull_tarball(kdir, url, dest_filename, retries, delete): | ||
if os.path.exists(kdir): | ||
shutil.rmtree(kdir) | ||
|