diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-02 11:34:21 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-15 11:56:17 +0000 |
commit | 9c87e0204bde784cf9f03a5cff6432569edcb276 (patch) | |
tree | c1af6f996ad44620581039f848019043ed356da3 /scripts/contrib | |
parent | 7836a7c4d49bbfdfe4f327b4ec09cc84ce34594f (diff) | |
download | poky-9c87e0204bde784cf9f03a5cff6432569edcb276.tar.gz |
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: fc9209fa892b31b2226008bdaf474750c3b61f38)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e59fe8279b209f67ff79b9d6dbb69389a64db236)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib')
-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) |