aboutsummaryrefslogtreecommitdiff
path: root/infra/base-images/base-builder/detect_repo.py
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-04-02 18:58:42 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-02 18:58:42 +0000
commit235e96b2f8ab4e43316158a2e6fa69e75a219e23 (patch)
tree328e6c9629b196cec1de3a94ee804d9fee3a0524 /infra/base-images/base-builder/detect_repo.py
parentcabb96cd6c37847d08a16b25069f3123261f9e8a (diff)
parent1117028736bb5d25636487a468b225d2b279285b (diff)
downloadoss-fuzz-235e96b2f8ab4e43316158a2e6fa69e75a219e23.tar.gz
Upgrade oss-fuzz to 947169dc86572e121c3e138f366a9f39ac6266ae am: f3764d0712 am: 1117028736
Original change: https://android-review.googlesource.com/c/platform/external/oss-fuzz/+/1662261 Change-Id: I8526ccfaeb10e35f986e2e8cc24c66e965584281
Diffstat (limited to 'infra/base-images/base-builder/detect_repo.py')
-rw-r--r--infra/base-images/base-builder/detect_repo.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/infra/base-images/base-builder/detect_repo.py b/infra/base-images/base-builder/detect_repo.py
index 8969e974f..e677e1023 100644
--- a/infra/base-images/base-builder/detect_repo.py
+++ b/infra/base-images/base-builder/detect_repo.py
@@ -107,20 +107,25 @@ def get_repo(repo_path):
return None
-def check_for_repo_name(repo_path, repo_name):
- """Check to see if the repo_name matches the remote repository repo name.
+def check_for_repo_name(repo_path, expected_repo_name):
+ """Returns True if the repo at |repo_path| repo_name matches
+ |expected_repo_name|.
Args:
- repo_path: The directory of the git repo.
- repo_name: The name of the target git repo.
+ repo_path: The directory of a git repo.
+ expected_repo_name: The name of the target git repo.
"""
if not os.path.exists(os.path.join(repo_path, '.git')):
return False
- out, _ = execute(['git', 'config', '--get', 'remote.origin.url'],
- location=repo_path)
- out = out.split('/')[-1].replace('.git', '').rstrip()
- return out == repo_name
+ repo_url, _ = execute(['git', 'config', '--get', 'remote.origin.url'],
+ location=repo_path)
+ # Handle two common cases:
+ # https://github.com/google/syzkaller/
+ # https://github.com/google/syzkaller.git
+ repo_url = repo_url.replace('.git', '').rstrip().rstrip('/')
+ actual_repo_name = repo_url.split('/')[-1]
+ return actual_repo_name == expected_repo_name
def check_for_commit(repo_path, commit):