[layerindex-web][PATCH] Update git.yoctoproject.org URLs from old cgit paths to new direct paths

Piotr Buliński <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
The old /cgit/cgit.cgi/ URL scheme is no longer used by
git.yoctoproject.org. Update all references to use the new shorter
URLs and switch from http to https. Add a data migration to fix
existing LayerItem records in the database.

Signed-off-by: Piotr Buliński <[email protected]>
---
 README                                        |  2 +-
 .../0051_fix_yoctoproject_cgit_urls.py        | 29 +++++++++++++++++++
 layerindex/models.py                          |  2 +-
 layerindex/tools/import_layer.py              |  8 ++---
 layerindex/tools/import_wiki_layers.py        |  8 ++---
 templates/layerindex/about.html               |  2 +-
 templates/layerindex/editlayer.html           |  8 ++---
 7 files changed, 44 insertions(+), 15 deletions(-)
 create mode 100644 layerindex/migrations/0051_fix_yoctoproject_cgit_urls.py

diff --git a/README b/README
index 1335b7a..9e1e659 100644
--- a/README
+++ b/README
@@ -428,7 +428,7 @@ The code for this application is maintained by the Yocto Project.
 
 The latest version of the code can always be found here:
 
-  http://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/
+  https://git.yoctoproject.org/layerindex-web/
 
 Contributions are welcome. Please send patches / pull requests to
 [email protected] with '[layerindex-web]' in the
diff --git a/layerindex/migrations/0051_fix_yoctoproject_cgit_urls.py b/layerindex/migrations/0051_fix_yoctoproject_cgit_urls.py
new file mode 100644
index 0000000..2303a7f
--- /dev/null
+++ b/layerindex/migrations/0051_fix_yoctoproject_cgit_urls.py
@@ -0,0 +1,29 @@
+# Generated by Django 5.2.12 on 2026-04-09 18:51
+
+from django.db import migrations
+
+
+def fix_yoctoproject_cgit_urls(apps, schema_editor):
+    """Update git.yoctoproject.org URLs from old cgit paths to new direct paths."""
+    LayerItem = apps.get_model('layerindex', 'LayerItem')
+
+    old = 'http://git.yoctoproject.org/cgit/cgit.cgi/'
+    new = 'https://git.yoctoproject.org/'
+
+    for layer in LayerItem.objects.filter(vcs_web_url__contains='git.yoctoproject.org/cgit/cgit.cgi/'):
+        layer.vcs_web_url = layer.vcs_web_url.replace(old, new)
+        layer.vcs_web_tree_base_url = layer.vcs_web_tree_base_url.replace(old, new)
+        layer.vcs_web_file_base_url = layer.vcs_web_file_base_url.replace(old, new)
+        layer.vcs_web_commit_url = layer.vcs_web_commit_url.replace(old, new)
+        layer.save()
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('layerindex', '0050_alter_recipe_inherits_alter_recipe_license'),
+    ]
+
+    operations = [
+        migrations.RunPython(fix_yoctoproject_cgit_urls, migrations.RunPython.noop),
+    ]
diff --git a/layerindex/models.py b/layerindex/models.py
index e43d1df..6e96342 100644
--- a/layerindex/models.py
+++ b/layerindex/models.py
@@ -542,7 +542,7 @@ class Source(models.Model):
         elif self.url.startswith('git://github.com'):
             return drop_dotgit('https' + self.url[3:])
         elif self.url.startswith('git://git.yoctoproject.org'):
-            return drop_dotgit('https://git.yoctoproject.org/cgit/cgit.cgi' + self.url[26:])
+            return drop_dotgit('https://git.yoctoproject.org' + self.url[26:])
         elif self.url.startswith('git://git.kernel.org'):
             return 'https' + self.url[3:]
         return None
diff --git a/layerindex/tools/import_layer.py b/layerindex/tools/import_layer.py
index dfe887c..4af062e 100755
--- a/layerindex/tools/import_layer.py
+++ b/layerindex/tools/import_layer.py
@@ -40,10 +40,10 @@ def set_vcs_fields(layer, repoval):
         layer.vcs_web_commit_url = 'http://cgit.openembedded.org/' + reponame + '/commit/?id=%hash%'
     elif repoval.startswith('git://git.yoctoproject.org/'):
         reponame = re.sub('^.*/', '', repoval)
-        layer.vcs_web_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame
-        layer.vcs_web_tree_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
-        layer.vcs_web_file_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
-        layer.vcs_web_commit_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/commit/?id=%hash%'
+        layer.vcs_web_url = 'https://git.yoctoproject.org/' + reponame
+        layer.vcs_web_tree_base_url = 'https://git.yoctoproject.org/' + reponame + '/tree/%path%?h=%branch%'
+        layer.vcs_web_file_base_url = 'https://git.yoctoproject.org/' + reponame + '/tree/%path%?h=%branch%'
+        layer.vcs_web_commit_url = 'https://git.yoctoproject.org/' + reponame + '/commit/?id=%hash%'
     elif repoval.startswith('git://github.com/') or repoval.startswith('http://github.com/') or repoval.startswith('https://github.com/'):
         reponame = re.sub('^.*github.com/', '', repoval)
         reponame = re.sub('.git$', '', reponame)
diff --git a/layerindex/tools/import_wiki_layers.py b/layerindex/tools/import_wiki_layers.py
index 2c82411..a9508de 100755
--- a/layerindex/tools/import_wiki_layers.py
+++ b/layerindex/tools/import_wiki_layers.py
@@ -104,10 +104,10 @@ def main():
                             layer.vcs_web_commit_url = 'http://cgit.openembedded.org/' + reponame + '/commit/?id=%hash%'
                         elif repoval.startswith('git://git.yoctoproject.org/'):
                             reponame = re.sub('^.*/', '', repoval)
-                            layer.vcs_web_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame
-                            layer.vcs_web_tree_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
-                            layer.vcs_web_file_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
-                            layer.vcs_web_commit_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/commit/?id=%hash%'
+                            layer.vcs_web_url = 'https://git.yoctoproject.org/' + reponame
+                            layer.vcs_web_tree_base_url = 'https://git.yoctoproject.org/' + reponame + '/tree/%path%?h=%branch%'
+                            layer.vcs_web_file_base_url = 'https://git.yoctoproject.org/' + reponame + '/tree/%path%?h=%branch%'
+                            layer.vcs_web_commit_url = 'https://git.yoctoproject.org/' + reponame + '/commit/?id=%hash%'
                         elif repoval.startswith('git://github.com/') or repoval.startswith('http://github.com/') or repoval.startswith('https://github.com/'):
                             reponame = re.sub('^.*github.com/', '', repoval)
                             reponame = re.sub('.git$', '', reponame)
diff --git a/templates/layerindex/about.html b/templates/layerindex/about.html
index f79bf22..a2055fb 100644
--- a/templates/layerindex/about.html
+++ b/templates/layerindex/about.html
@@ -55,7 +55,7 @@
 <li>Tim Orling</li>
 </ul>
 
-<p>The code is Open Source and can be found on <a href="http://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/">git.yoctoproject.org</a>. Patches welcome!</p>
+<p>The code is Open Source and can be found on <a href="https://git.yoctoproject.org/layerindex-web/">git.yoctoproject.org</a>. Patches welcome!</p>
 
 {% endautoescape %}
 {% endblock %}
diff --git a/templates/layerindex/editlayer.html b/templates/layerindex/editlayer.html
index e21e649..f6d4967 100644
--- a/templates/layerindex/editlayer.html
+++ b/templates/layerindex/editlayer.html
@@ -206,10 +206,10 @@
         }
         else if( repoval.startsWith('git://git.yoctoproject.org/') ) {
             reponame = repoval.replace(/^.*\//, '')
-            this.vcs_web_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame
-            this.vcs_web_tree_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
-            this.vcs_web_file_base_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/tree/%path%?h=%branch%'
-            this.vcs_web_commit_url = 'http://git.yoctoproject.org/cgit/cgit.cgi/' + reponame + '/commit/?id=%hash%'
+            this.vcs_web_url = 'https://git.yoctoproject.org/' + reponame
+            this.vcs_web_tree_base_url = 'https://git.yoctoproject.org/' + reponame + '/tree/%path%?h=%branch%'
+            this.vcs_web_file_base_url = 'https://git.yoctoproject.org/' + reponame + '/tree/%path%?h=%branch%'
+            this.vcs_web_commit_url = 'https://git.yoctoproject.org/' + reponame + '/commit/?id=%hash%'
             this.vcs_web_type = 'cgit'
         }
         else if( repoval.startsWith('git://github.com/') ) {
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.