From fbe706dccdd35bfdfd163b7107ea90f801830321 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 24 Oct 2014 10:02:41 +0200 Subject: controller: autoconfiscate #2 Move 'results_stats' and 'commit_results' binaries into libexec and adjust appropriately. Also html template is now in $pkgdatadir. * .gitignore: Add tags/ChangeLog generated files. * README: Just some random notes. Needs to be rewritten anyway. * controller/.gitignore: Add newly 'make'd files. * controller/Makefile.am: Generate libexec/bin files. * controller/commit_results: Move to controller/libexec as dtf-result-stats.in. * controller/configure.ac: Also substitute resulttemplatedir. * controller/etc/dtf.conf.d/config.sh.template: The DTF_DATABASE was misleading - use rather DTF_DATABASE_DEFAULT. * controller/libexec/dtf-commit-results.in: Moved from controller/commit_results. * controller/result_stats: Moved to controller/libexec/dtf-result-stats.in. * controller/libexec/dtf-result-stats.in: Moved from controller/result_stats. * controller/result_templates/html.tmpl: Moved to controller/share/dtf-controller/results-stats-templates/html.tmpl. --- controller/result_stats | 74 ------------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100755 controller/result_stats (limited to 'controller/result_stats') diff --git a/controller/result_stats b/controller/result_stats deleted file mode 100755 index a92d6d6..0000000 --- a/controller/result_stats +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/perl - -use strict; -use warnings; -use utf8; - -use Data::Dumper; -use File::Basename; -use Cwd; -use Encode 'encode_utf8'; - -# teplates -use Text::Xslate; - -# yaml (quick) parser -use YAML::Syck; - -our $srcdir = dirname(__FILE__); - -sub html_printer -{ - my $results = $_[0]; - my $task_ids = $_[1]; - - my $xslate = Text::Xslate->new(path => ["$srcdir/result_templates"]); - - my $content = $xslate->render("html.tmpl", { - results => $results, - task_ids => $task_ids, - }); - print encode_utf8($content); -} - -my $workdir = $ARGV[0]; - -my $data = []; - -my $task_ids = {}; - -# go through *each* result directory -my $olddir = getcwd; -for (`find "$workdir" -maxdepth 1 -type d -name 'result_*'`) { - chomp; - chdir $_; - - my $run_results = {}; - $run_results->{dirname} = basename($_); - $run_results->{tasks} = {}; - $run_results->{exit_status} = 0; - - # go through each task - for (`find -maxdepth 1 -type f -name '*.result'`) { - chomp; - - (my $task_id = $_) =~ s/\.result$//; - $task_id =~ s/.*\///; - $task_ids->{$task_id} = 1; - - my $yaml_file = $_; - open my $fd, '<', $yaml_file - or die "can't open yaml file '$yaml_file'"; - - my $config = YAML::Syck::LoadFile($fd); - if ($config->{exit_status} != 0) { - $run_results->{exit_status} = 1; - } - $run_results->{tasks}->{$task_id} = $config; - } - - push @{$data}, $run_results; -} -chdir $olddir; - -html_printer $data, $task_ids; -- cgit