aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Limonciello <superm1@gmail.com>2023-11-13 22:01:03 -0600
committerMario Limonciello <superm1@gmail.com>2023-11-13 22:01:03 -0600
commit1f8f61d5cd6f4cad42bf89ceadd654d82dea4472 (patch)
treee9a8aa1bfa3fbe1be359a0a65357db9828641b57
parent398b4605a30792685e7e3b7ae82a22a916916499 (diff)
downloadlinux-firmware-1f8f61d5cd6f4cad42bf89ceadd654d82dea4472.tar.gz
Process pull requets directly from mbox
Rather than letting b4 fetch a second time use the same one that was already downloaded. Signed-off-by: Mario Limonciello <superm1@gmail.com>
-rwxr-xr-xcontrib/process_linux_firmware.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/process_linux_firmware.py b/contrib/process_linux_firmware.py
index 7d867a8d..b1d98222 100755
--- a/contrib/process_linux_firmware.py
+++ b/contrib/process_linux_firmware.py
@@ -142,14 +142,15 @@ def delete_branch(branch):
quiet_cmd(["git", "branch", "-D", branch])
-def process_pr(url, num, remote):
+def process_pr(mbox, num, remote):
branch = "robot/pr-{}-{}".format(num, int(time.time()))
- cmd = ["b4", "pr", "-b", branch, url]
- try:
- quiet_cmd(cmd)
- except subprocess.CalledProcessError:
- logging.warning("Failed to apply PR")
- return None
+
+ cmd = ["b4", "--debug", "pr", "-b", branch, "-"]
+ logging.debug("Running {}".format(cmd))
+ p = subprocess.Popen(
+ cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ )
+ stdout, stderr = p.communicate(mbox.encode("utf-8"))
# determine if it worked (we can't tell unfortunately by return code)
cmd = ["git", "branch", "--list", branch]
@@ -244,7 +245,6 @@ def process_database(conn, remote):
# loop over all unprocessed urls
for row in rows:
-
branch = None
msg = "Processing ({}%)".format(round(num / len(rows) * 100))
print(msg, end="\r", flush=True)
@@ -260,7 +260,7 @@ def process_database(conn, remote):
if classification == ContentType.PULL_REQUEST:
logging.debug("Processing PR ({})".format(row[0]))
- branch = process_pr(row[0], num, remote)
+ branch = process_pr(mbox, num, remote)
if classification == ContentType.SPAM:
logging.debug("Marking spam ({})".format(row[0]))