Skip to contentSkip to conversation

toaster: Increase maximum length of file path of build artifact

PATCH In review Ed Bartosh 2 participants 2 messages Aug 30, 2016 – Aug 31, 2016

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 toaster: Increase maximum length of file path of build artifact

From: Alexander Egorenkov <[email protected]>

The default maximum length of the file path for a build artifact on Krogoth Toaster is 100 characters (Django default for FilePathField). This value makes it impossible to download build artifacts because default file paths are quite long and therefore are being truncated by Toaster.

Example of a long file path which does not work on my machine:
/var/www/toaster/poky/build-toaster-2/tmp/deploy/sdk/poky-glibc-x86_64-core-image-sato-cortexa8hf-neon-toolchain-2.1.1.sh

To fix this problem i increased the size of 'file_name' column of the corresponding MySQL table to 255 characters.

---
 bitbake/lib/toaster/orm/migrations/0001_initial.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/toaster/orm/migrations/0001_initial.py +1 -1
index 760462f..0c780a9 100644
@@ -52,7 +52,7 @@ class Migration(migrations.Migration):
             name='BuildArtifact',
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('file_name', models.FilePathField()),
+                ('file_name', models.FilePathField(max_length=255)),
                 ('file_size', models.IntegerField()),
                 ('build', models.ForeignKey(to='orm.Build')),
             ],
Signature · 1 line
2.1.4
#1 lore raw
Quoted 25 lines · Ed Bartosh

From: Alexander Egorenkov <[email protected]>

The default maximum length of the file path for a build artifact on Krogoth Toaster is 100 characters (Django default for FilePathField). This value makes it impossible to download build artifacts because default file paths are quite long and therefore are being truncated by Toaster.

Example of a long file path which does not work on my machine:
/var/www/toaster/poky/build-toaster-2/tmp/deploy/sdk/poky-glibc-x86_64-core-image-sato-cortexa8hf-neon-toolchain-2.1.1.sh

To fix this problem i increased the size of 'file_name' column of the corresponding MySQL table to 255 characters.

---
  bitbake/lib/toaster/orm/migrations/0001_initial.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/toaster/orm/migrations/0001_initial.py +0 -0
index 760462f..0c780a9 100644

bitbake/lib/toaster/orm/migrations/0001_initial.py class Migration(migrations.Migration): · line 58

Quoted 8 lines
bitbake/lib/toaster/orm/migrations/0001_initial.py +1 -1
@@ -52,7 +52,7 @@ class Migration(migrations.Migration):
              name='BuildArtifact',
              fields=[
                  ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('file_name', models.FilePathField()),
+                ('file_name', models.FilePathField(max_length=255)),
                  ('file_size', models.IntegerField()),
                  ('build', models.ForeignKey(to='orm.Build')),
              ],

To change this field the model definition needs changing at the source of the definition.

All the migration files in /migrations/ are auto generated by Django itself and will be overwritten the next time the migrations are reset. It is also applied in order; so if someone has an existing database the changes will not be applied as the initial migration has already run.

To make this a permanent change edit the definition in orm/models.py (I think the classes you are looking for would be TargetSDKFile and TargetKernelFile? to add a max_length parameters) once that has be edited you can run "./manage.py makemigrations" and it will create a new migration file in /migrations/ to make that amendment to the schema, add this new file and the changes to models.py and it'll be all good!

More info on migrations here https://docs.djangoproject.com/en/1.8/topics/migrations/

Thanks,

Michael

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.