Return PackageCommitPatchData from OpenSSL commit url.
(url, logger)
| 55 | |
| 56 | |
| 57 | def get_commit_patch(url, logger): |
| 58 | """Return PackageCommitPatchData from OpenSSL commit url.""" |
| 59 | |
| 60 | vcs_url = "https://github.com/openssl/openssl/" |
| 61 | hash = None |
| 62 | |
| 63 | if url.startswith("https://github.openssl.org/"): |
| 64 | # unknow vcs url, these are instead stored as references. |
| 65 | return |
| 66 | |
| 67 | if url.startswith("https://github.com/"): |
| 68 | vcs_url, hash = url.split("/commit/") |
| 69 | elif url.startswith("https://git.openssl.org/"): |
| 70 | parsed = urlparse(url) |
| 71 | params = parse_qs(parsed.query, separator=";") |
| 72 | if "h" in params: |
| 73 | # git.openssl.org has moved to github.com/openssl/openssl |
| 74 | hash = get_item(params, "h", 0) |
| 75 | |
| 76 | if not hash: |
| 77 | logger(f"Unsupported commit url {url}") |
| 78 | return |
| 79 | |
| 80 | return PackageCommitPatchData( |
| 81 | vcs_url=vcs_url, |
| 82 | commit_hash=hash[:40], |
| 83 | ) |
| 84 | |
| 85 | |
| 86 | def get_reference(reference_name, tag, reference_url): |