Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 69D58E00AD8; Tue, 2 Feb 2016 02:12:44 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.115 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id E8B1DE0090E for ; Tue, 2 Feb 2016 02:12:40 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 02 Feb 2016 02:12:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,384,1449561600"; d="scan'208";a="906636010" Received: from unknown (HELO lp.ger.corp.intel.com) ([10.252.22.6]) by fmsmga002.fm.intel.com with ESMTP; 02 Feb 2016 02:12:07 -0800 From: Elliot Smith To: toaster@yoctoproject.org Date: Tue, 2 Feb 2016 10:11:52 +0000 Message-Id: <1454407914-26139-1-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [review-request][PATCH] toaster: show suffix for image files and basename for artifact files X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2016 10:12:44 -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 --- bitbake/lib/toaster/orm/models.py | 8 ++++++++ .../toastergui/templates/builddashboard.html | 22 +++++++++++----------- bitbake/lib/toaster/toastergui/views.py | 7 ++++++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index ac2aa9e..bb95b75 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py @@ -522,6 +522,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) @@ -560,6 +562,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 diff --git a/bitbake/lib/toaster/toastergui/templates/builddashboard.html b/bitbake/lib/toaster/toastergui/templates/builddashboard.html index 323bbbb..5dac4db 100644 --- a/bitbake/lib/toaster/toastergui/templates/builddashboard.html +++ b/bitbake/lib/toaster/toastergui/templates/builddashboard.html @@ -111,7 +111,7 @@

- {% else %} + {% else %}
@@ -126,18 +126,18 @@
    - {% for i in target.imageFiles %} - {% if build.project %} -
  • {{i.path}} - {% else %} -
  • {{i.path}} - {% endif %} - ({{i.size|filtered_filesizeformat}})
  • - {% endfor %} + {% for i in target.imageFiles %} +
  • + + {{i.suffix}} + +  ({{i.size|filtered_filesizeformat}}) +
  • + {% endfor %}
- {% endif %} + {% endif %} {% endif %} {% endfor %} @@ -161,7 +161,7 @@
{% for ba in build.buildartifact_set.all|dictsort:"file_name" %} - {{ba.get_local_file_name}} + {{ba.get_basename}} ({{ba.file_size|filtered_filesizeformat}})
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 995937a..4932885 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -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 -- Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- 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.