mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 12:49:34 +02:00
scripts/convert-srcuri: Update SRC_URI conversion script to handle github url changes
Github are dropping support for git:// protocol fetching. Update the script to learn about corner cases found in the previous conversion and support remapping the github urls as needed too. (From OE-Core rev: e59fe8279b209f67ff79b9d6dbb69389a64db236) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -19,19 +19,33 @@ if len(sys.argv) < 2:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def processfile(fn):
|
def processfile(fn):
|
||||||
|
def matchline(line):
|
||||||
|
if "MIRROR" in line or ".*" in line or "GNOME_GIT" in line:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
print("processing file '%s'" % fn)
|
print("processing file '%s'" % fn)
|
||||||
try:
|
try:
|
||||||
|
if "distro_alias.inc" in fn or "linux-yocto-custom.bb" in fn:
|
||||||
|
return
|
||||||
fh, abs_path = tempfile.mkstemp()
|
fh, abs_path = tempfile.mkstemp()
|
||||||
modified = False
|
modified = False
|
||||||
with os.fdopen(fh, 'w') as new_file:
|
with os.fdopen(fh, 'w') as new_file:
|
||||||
with open(fn, "r") as old_file:
|
with open(fn, "r") as old_file:
|
||||||
for line in old_file:
|
for line in old_file:
|
||||||
if ("git://" in line or "gitsm://" in line) and "branch=" not in line and "MIRROR" not in line and ".*" not in line:
|
if ("git://" in line or "gitsm://" in line) and "branch=" not in line and matchline(line):
|
||||||
if line.endswith('"\n'):
|
if line.endswith('"\n'):
|
||||||
line = line.replace('"\n', ';branch=master"\n')
|
line = line.replace('"\n', ';branch=master"\n')
|
||||||
elif line.endswith(" \\\n"):
|
elif line.endswith(" \\\n"):
|
||||||
line = line.replace(' \\\n', ';branch=master \\\n')
|
line = line.replace(' \\\n', ';branch=master \\\n')
|
||||||
modified = True
|
modified = True
|
||||||
|
if ("git://" in line or "gitsm://" in line) and "github.com" in line and "protocol=https" not in line and matchline(line):
|
||||||
|
if "protocol=git" in line:
|
||||||
|
line = line.replace('protocol=git', 'protocol=https')
|
||||||
|
elif line.endswith('"\n'):
|
||||||
|
line = line.replace('"\n', ';protocol=https"\n')
|
||||||
|
elif line.endswith(" \\\n"):
|
||||||
|
line = line.replace(' \\\n', ';protocol=https \\\n')
|
||||||
|
modified = True
|
||||||
new_file.write(line)
|
new_file.write(line)
|
||||||
if modified:
|
if modified:
|
||||||
shutil.copymode(fn, abs_path)
|
shutil.copymode(fn, abs_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user