]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: show suffix for image files and basename for artifact files
authorElliot Smith <elliot.smith@intel.com>
Tue, 23 Feb 2016 12:17:04 +0000 (12:17 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 26 Feb 2016 17:17:24 +0000 (17:17 +0000)
The build dashboard doesn't show image and artifact files correctly,
as it shows the full filename for images and the filename plus
path relative to DEPLOY_DIR for artifacts.

Instead, show just the suffix for image files, and the basename
for artifact files.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/orm/models.py
lib/toaster/toastergui/templates/builddashboard.html
lib/toaster/toastergui/views.py

index ab6940feafc3573062f861a8e9005971146de44b..93b5df3d4ec74f11ae8c3d8b7449de7acfb44a20 100644 (file)
@@ -550,6 +550,8 @@ class BuildArtifact(models.Model):
 
         return self.file_name
 
+    def get_basename(self):
+        return os.path.basename(self.file_name)
 
     def is_available(self):
         return self.build.buildrequest.environment.has_artifact(self.file_name)
@@ -588,6 +590,12 @@ class Target_Image_File(models.Model):
     file_name = models.FilePathField(max_length=254)
     file_size = models.IntegerField()
 
+    @property
+    def suffix(self):
+        filename, suffix = os.path.splitext(self.file_name)
+        suffix = suffix.lstrip('.')
+        return suffix
+
 class Target_File(models.Model):
     ITYPE_REGULAR = 1
     ITYPE_DIRECTORY = 2
index 7857abaaac7f5a0490aa791d5743338adb8b62f0..a0da71ea4c0f0d5195c29c6efbcac3c36dd4d466 100644 (file)
                                   </p>
                     </div>
                 </div>
-                        {% else %}
+        {% else %}
             <dt>
                 <i class="icon-question-sign get-help" title="The location in disk of the license manifest, a document listing all packages installed in your image and their licenses"></i>
 
             </dt>
             <dd>
                 <ul>
-                                  {% for i in target.imageFiles %}
-            {% if build.project %}
-                    <li><a href="{% url 'build_artifact' build.pk 'imagefile' i.id %}">{{i.path}}</a>
-            {% else %}
-                    <li>{{i.path}}
-            {% endif %}
-                    ({{i.size|filtered_filesizeformat}})</li>
-                                  {% endfor %}
+                    {% for i in target.imageFiles %}
+                        <li>
+                            <a href="{% url 'build_artifact' build.pk 'imagefile' i.id %}">
+                                {{i.suffix}}
+                            </a>
+                            &nbsp;({{i.size|filtered_filesizeformat}})
+                        </li>
+                    {% endfor %}
                 </ul>
             </dd>
         </dl>
-                        {% endif %}
+        {% endif %}
     </div>
         {% endif %}
     {% endfor %}
             <dd><div>
               {% for ba in build.buildartifact_set.all|dictsort:"file_name" %}
                 <a href="{%url 'build_artifact' build.id 'buildartifact' ba.id %}">
-                    {{ba.get_local_file_name}}
+                    {{ba.get_basename}}
                 </a>
 
                 ({{ba.file_size|filtered_filesizeformat}}) <br/>
index 13489af6fda39df3a5b277801d766aee7b2e4d14..28b03d30b295c84b665fa18ca79361a77fbacb3a 100755 (executable)
@@ -480,7 +480,12 @@ def builddashboard( request, build_id ):
             if ( ndx < 0 ):
                 ndx = 0;
             f = i.file_name[ ndx + 1: ]
-            imageFiles.append({ 'id': i.id, 'path': f, 'size' : i.file_size })
+            imageFiles.append({
+                'id': i.id,
+                'path': f,
+                'size': i.file_size,
+                'suffix': i.suffix
+            })
         if t.is_image and (len(imageFiles) <= 0 or len(t.license_manifest_path) <= 0):
             targetHasNoImages = True
         elem[ 'imageFiles' ] = imageFiles