diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
| -rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 38d67e378f..e568ee70ed 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
| @@ -2603,6 +2603,43 @@ if toastermain.settings.MANAGED: | |||
| 2603 | 2603 | ||
| 2604 | 2604 | ||
| 2605 | 2605 | ||
| 2606 | def build_artifact(request, build_id, artifact_type, artifact_id): | ||
| 2607 | try: | ||
| 2608 | b = Build.objects.get(pk=build_id) | ||
| 2609 | if b.buildrequest is None or b.buildrequest.environment is None: | ||
| 2610 | raise Exception("Cannot download file") | ||
| 2611 | |||
| 2612 | file_name = None | ||
| 2613 | fsock = None | ||
| 2614 | content_type='application/force-download' | ||
| 2615 | # Target_Image_File file_name | ||
| 2616 | # Task logfile | ||
| 2617 | if artifact_type == "tasklogfile": | ||
| 2618 | file_name = Task.objects.get(build = b, pk = artifact_id).logfile | ||
| 2619 | |||
| 2620 | # Task path_to_sstate_obj | ||
| 2621 | # Package_File path | ||
| 2622 | # Recipe file_path | ||
| 2623 | # VariableHistory file_name | ||
| 2624 | # LogMessage pathname | ||
| 2625 | if artifact_type == "logmessagefile": | ||
| 2626 | file_name = LogMessage.objects.get(build = b, pk = artifact_id).pathname | ||
| 2627 | |||
| 2628 | if file_name is not None: | ||
| 2629 | content_type = b.buildrequest.environment.get_artifact_type(file_name) | ||
| 2630 | fsock = b.buildrequest.environment.get_artifact(file_name) | ||
| 2631 | file_name = os.path.basename(file_name) | ||
| 2632 | |||
| 2633 | response = HttpResponse(fsock, content_type = content_type) | ||
| 2634 | |||
| 2635 | # returns a file from the environment | ||
| 2636 | response['Content-Disposition'] = 'attachment; filename=' + file_name | ||
| 2637 | return response | ||
| 2638 | except: | ||
| 2639 | raise | ||
| 2640 | |||
| 2641 | |||
| 2642 | |||
| 2606 | def projects(request): | 2643 | def projects(request): |
| 2607 | template="projects.html" | 2644 | template="projects.html" |
| 2608 | 2645 | ||
| @@ -2725,5 +2762,8 @@ else: | |||
| 2725 | def projectbuilds(request): | 2762 | def projectbuilds(request): |
| 2726 | raise Exception("page not available in interactive mode") | 2763 | raise Exception("page not available in interactive mode") |
| 2727 | 2764 | ||
| 2765 | def build_artifact(request, build_id, artifact_type, artifact_id): | ||
| 2766 | raise Exception("page not available in interactive mode") | ||
| 2767 | |||
| 2728 | def projects(request): | 2768 | def projects(request): |
| 2729 | raise Exception("page not available in interactive mode") | 2769 | raise Exception("page not available in interactive mode") |
