Skip to contentSkip to conversation

layerindex: allow Repository subdir to be 60 chars

PATCH New Tim Orling 1 participant 2 messages Feb 6, 2024

lore
Share & tools
lore

Tim Orling

author
#0 lore raw

PATCH 1/2 layerindex: allow Repository subdir to be 60 chars

https://github.com/webosose/meta-webosose has layers like:
meta-webos-backports/meta-webos-backports-4.1 which is 45 characters.

Allow for up to 60 characters in the vcs_subdir field in the LayerBranch class.

[YOCTO #15374]

---
 .../0049_alter_layerbranch_vcs_subdir.py      | 22 +++++++++++++++++++
 layerindex/models.py                          |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 layerindex/migrations/0049_alter_layerbranch_vcs_subdir.py
layerindex/migrations/0049_alter_layerbranch_vcs_subdir.py new file +22 -0
new file mode 100644
index 0000000..028a481
@@ -0,0 +1,22 @@
+# Generated by Django 4.2.9 on 2024-01-30 03:48
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ("layerindex", "0048_bbclassglobal_bbclassrecipe_bbclass_bbclass_type"),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name="layerbranch",
+            name="vcs_subdir",
+            field=models.CharField(
+                blank=True,
+                help_text="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)",
+                max_length=60,
+                verbose_name="Repository subdirectory",
+            ),
+        ),
+    ]
layerindex/models.py +1 -1
index c52927f..50be60f 100644
@@ -234,7 +234,7 @@ class LayerBranch(models.Model):
     branch = models.ForeignKey(Branch, on_delete=models.CASCADE)
     collection = models.CharField('Layer Collection', max_length=40, null=True, blank=True, help_text='Name of the collection that the layer provides for the purpose of expressing dependencies (as specified in BBFILE_COLLECTIONS). Can only contain letters, numbers and dashes.')
     version = models.CharField('Layer Version', max_length=10, null=True, blank=True, help_text='The layer version for this particular branch.')
-    vcs_subdir = models.CharField('Repository subdirectory', max_length=40, blank=True, help_text='Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)')
+    vcs_subdir = models.CharField('Repository subdirectory', max_length=60, blank=True, help_text='Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)')
     vcs_last_fetch = models.DateTimeField('Last successful fetch', blank=True, null=True)
     vcs_last_rev = models.CharField('Last revision fetched', max_length=80, blank=True)
     vcs_last_commit = models.DateTimeField('Last commit date', blank=True, null=True)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 layerindex: allow periods in layer name

There is nothing preventing a period in a layer name from the BitBake perspective.

For example, https://github.com/webosose/meta-webosose has:
meta-webos-backports/meta-webos-backports-4.1

[YOCTO #15373]

---
 layerindex/forms.py       |  4 ++--
 layerindex/urls.py        | 14 +++++++-------
 layerindex/urls_branch.py |  8 ++++----
 3 files changed, 13 insertions(+), 13 deletions(-)
layerindex/forms.py +2 -2
index a9e7703..2cb9b52 100644
@@ -118,8 +118,8 @@ class EditLayerForm(StyledModelForm):
 
     def clean_name(self):
         name = self.cleaned_data['name'].strip()
-        if re.compile(r'[^a-z0-9-]').search(name):
-            raise forms.ValidationError("Name must only contain alphanumeric characters and dashes")
+        if re.compile(r'[^a-z0-9-\.]').search(name):
+            raise forms.ValidationError("Name must only contain alphanumeric characters, dashes or periods")
         if name.startswith('-'):
             raise forms.ValidationError("Name must not start with a dash")
         if name.endswith('-'):
layerindex/urls.py +7 -7
index 1fcd11d..80ceaa7 100644
@@ -46,7 +46,7 @@ urlpatterns = [
 
     re_path(r'^layers/$',
         RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)), permanent=False)),
-    re_path(r'^layer/(?P<slug>[-\w]+)/$',
+    re_path(r'^layer/(?P<slug>[-\.\w]+)/$',
         RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_item', 'branch': 'master'}),
     re_path(r'^recipes/$',
         RedirectView.as_view(url=reverse_lazy('recipe_search', args=('master',)), permanent=False)),
@@ -65,23 +65,23 @@ urlpatterns = [
         LayerReviewListView.as_view(
             template_name='layerindex/reviewlist.html'),
         name='layer_list_review'),
-    re_path(r'^review/(?P<slug>[-\w]+)/$',
+    re_path(r'^review/(?P<slug>[-\.\w]+)/$',
         LayerReviewDetailView.as_view(
             template_name='layerindex/reviewdetail.html'),
         name='layer_review'),
-    re_path(r'^layer/(?P<slug>[-\w]+)/addnote/$',
+    re_path(r'^layer/(?P<slug>[-\.\w]+)/addnote/$',
         edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="add_layernote"),
-    re_path(r'^layer/(?P<slug>[-\w]+)/editnote/(?P<pk>[-\w]+)/$',
+    re_path(r'^layer/(?P<slug>[-\.\w]+)/editnote/(?P<pk>[-\w]+)/$',
         edit_layernote_view, {'template_name': 'layerindex/editlayernote.html'}, name="edit_layernote"),
-    re_path(r'^layer/(?P<slug>[-\w]+)/deletenote/(?P<pk>[-\w]+)/$',
+    re_path(r'^layer/(?P<slug>[-\.\w]+)/deletenote/(?P<pk>[-\w]+)/$',
         delete_layernote_view, {'template_name': 'layerindex/deleteconfirm.html'}, name="delete_layernote"),
-    re_path(r'^layer/(?P<slug>[-\w]+)/delete/$',
+    re_path(r'^layer/(?P<slug>[-\.\w]+)/delete/$',
         delete_layer_view, {'template_name': 'layerindex/deleteconfirm.html'}, name="delete_layer"),
     re_path(r'^recipe/(?P<pk>[-\w]+)/$',
         RecipeDetailView.as_view(
             template_name='layerindex/recipedetail.html'),
         name='recipe'),
-    re_path(r'^layer/(?P<name>[-\w]+)/publish/$', publish_view, name="publish"),
+    re_path(r'^layer/(?P<name>[-\.\w]+)/publish/$', publish_view, name="publish"),
     re_path(r'^layerupdate/(?P<pk>[-\w]+)/$',
         LayerUpdateDetailView.as_view(
             template_name='layerindex/layerupdate.html'),
layerindex/urls_branch.py +4 -4
index 40cd915..a9a4018 100644
@@ -17,11 +17,11 @@ urlpatterns = [
         LayerListView.as_view(
             template_name='layerindex/layers.html'),
             name='layer_list'),
-    re_path(r'^layer/(?P<slug>[-\w]+)/$',
+    re_path(r'^layer/(?P<slug>[-\.\w]+)/$',
         LayerDetailView.as_view(
             template_name='layerindex/detail.html'),
             name='layer_item'),
-    re_path(r'^layer/(?P<slug>[-\w]+)/recipes/csv/$',
+    re_path(r'^layer/(?P<slug>[-\.\w]+)/recipes/csv/$',
         layer_export_recipes_csv_view,
         name='layer_export_recipes_csv'),
     re_path(r'^recipes/$',
@@ -40,8 +40,8 @@ urlpatterns = [
         ClassSearchView.as_view(
             template_name='layerindex/classes.html'),
             name='class_search'),
-    re_path(r'^edit/(?P<slug>[-\w]+)/$', edit_layer_view, {'template_name': 'layerindex/editlayer.html'}, name="edit_layer"),
-    re_path(r'^update/(?P<slug>[-\w]+)/$', update_layer_view, {'template_name': 'layerindex/updatelayer.html'}, name="update_layer"),
+    re_path(r'^edit/(?P<slug>[-\.\w]+)/$', edit_layer_view, {'template_name': 'layerindex/editlayer.html'}, name="edit_layer"),
+    re_path(r'^update/(?P<slug>[-\.\w]+)/$', update_layer_view, {'template_name': 'layerindex/updatelayer.html'}, name="update_layer"),
     re_path(r'^duplicates/$',
         DuplicatesView.as_view(
             template_name='layerindex/duplicates.html'),
Signature · 1 line
2.34.1