From bba2a364dd6744fd6f1c7ac3b98cc176dba08413 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 11 Nov 2025 11:27:27 +0100 Subject: [PATCH] tools/check-git-repo-availability.py: only rewrite when Repo: clearly fails --- tools/check-git-repo-availability.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/check-git-repo-availability.py b/tools/check-git-repo-availability.py index a6e2b88093..fd3e120b54 100755 --- a/tools/check-git-repo-availability.py +++ b/tools/check-git-repo-availability.py @@ -3,6 +3,7 @@ import glob import os import re +import requests import subprocess import sys @@ -54,6 +55,8 @@ for f in files: 'core.sshCommand=/bin/false', '-c', 'url.https://.insteadOf=ssh://', + '-c', + 'http.lowSpeedTime=5', ] for domain in ('bitbucket.org', 'github.com', 'gitlab.com'): git_config.append('-c') @@ -88,6 +91,18 @@ for f in files: print('%s%s%s' % (Fore.RED, p.stderr.decode(), Style.RESET_ALL)) errors[f] = p.stderr + # only rewrite files with a clear 404 Not Found, e.g. not 302, 500, etc. + if url.startswith('https://'): + try: + weburl = url[:-4] if url.endswith('.git') else url + r = requests.head(weburl, timeout=10) + except requests.exceptions.RequestException as e: + print('%s%s%s' % (Fore.RED, str(e), Style.RESET_ALL)) + continue + if r.status_code != 404: + print('%s%d: %s%s' % (Fore.RED, r.status_code, r.reason, Style.RESET_ALL)) + continue + if not f.startswith('metadata/'): continue # this rewriting only works with metadata files, not srclibs