diff options
Diffstat (limited to 'scripts/contrib/convert-srcuri.py')
| -rwxr-xr-x | scripts/contrib/convert-srcuri.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/contrib/convert-srcuri.py b/scripts/contrib/convert-srcuri.py index 4bf9e3013d..5b362ea2e8 100755 --- a/scripts/contrib/convert-srcuri.py +++ b/scripts/contrib/convert-srcuri.py | |||
| @@ -19,19 +19,33 @@ if len(sys.argv) < 2: | |||
| 19 | sys.exit(1) | 19 | sys.exit(1) |
| 20 | 20 | ||
| 21 | def processfile(fn): | 21 | def processfile(fn): |
| 22 | def matchline(line): | ||
| 23 | if "MIRROR" in line or ".*" in line or "GNOME_GIT" in line: | ||
| 24 | return False | ||
| 25 | return True | ||
| 22 | print("processing file '%s'" % fn) | 26 | print("processing file '%s'" % fn) |
| 23 | try: | 27 | try: |
| 28 | if "distro_alias.inc" in fn or "linux-yocto-custom.bb" in fn: | ||
| 29 | return | ||
| 24 | fh, abs_path = tempfile.mkstemp() | 30 | fh, abs_path = tempfile.mkstemp() |
| 25 | modified = False | 31 | modified = False |
| 26 | with os.fdopen(fh, 'w') as new_file: | 32 | with os.fdopen(fh, 'w') as new_file: |
| 27 | with open(fn, "r") as old_file: | 33 | with open(fn, "r") as old_file: |
| 28 | for line in old_file: | 34 | for line in old_file: |
| 29 | if ("git://" in line or "gitsm://" in line) and "branch=" not in line and "MIRROR" not in line and ".*" not in line: | 35 | if ("git://" in line or "gitsm://" in line) and "branch=" not in line and matchline(line): |
| 30 | if line.endswith('"\n'): | 36 | if line.endswith('"\n'): |
| 31 | line = line.replace('"\n', ';branch=master"\n') | 37 | line = line.replace('"\n', ';branch=master"\n') |
| 32 | elif line.endswith(" \\\n"): | 38 | elif line.endswith(" \\\n"): |
| 33 | line = line.replace(' \\\n', ';branch=master \\\n') | 39 | line = line.replace(' \\\n', ';branch=master \\\n') |
| 34 | modified = True | 40 | modified = True |
| 41 | if ("git://" in line or "gitsm://" in line) and "github.com" in line and "protocol=https" not in line and matchline(line): | ||
| 42 | if "protocol=git" in line: | ||
| 43 | line = line.replace('protocol=git', 'protocol=https') | ||
| 44 | elif line.endswith('"\n'): | ||
| 45 | line = line.replace('"\n', ';protocol=https"\n') | ||
| 46 | elif line.endswith(" \\\n"): | ||
| 47 | line = line.replace(' \\\n', ';protocol=https \\\n') | ||
| 48 | modified = True | ||
| 35 | new_file.write(line) | 49 | new_file.write(line) |
| 36 | if modified: | 50 | if modified: |
| 37 | shutil.copymode(fn, abs_path) | 51 | shutil.copymode(fn, abs_path) |
