# HG changeset patch # User devi # Date 1116928828 -10800 # Node ID 6c1d2b9f45e731fdc43a2b410e8196af2a235aee # Parent 787e9f11de51f302e22f5fbee468597e4aee646b Добавил команду lm report. Строит html-представление журналов для заданного класса. Нужно сделать поддержку опций GetOpt::Long и тогда эту же команду можно будет использовать для построения всех журналов в репозитории. diff -r 787e9f11de51 -r 6c1d2b9f45e7 lm --- a/lm Sun May 22 16:31:54 2005 +0300 +++ b/lm Tue May 24 13:00:28 2005 +0300 @@ -19,12 +19,17 @@ our %Config = ( "show_host" => "no", + # Вспомогательные программы + "l3-report" => "./lm-report", + # Каталоги "path_labmaker" => "/var/labmaker/", "path_classes" => "/var/labmaker/classes/", - "lablogs_path" => "/var/labmaker/lablogs/", + "path_lablogs" => "/var/labmaker/lablogs/", "courses_path" => "/var/labmaker/courses/", "outpath" => "/var/labmaker/out/", + "path_web" => "/var/www/l3", # Путь к web-отчётам + "path_share" => "./share/", # Путь к web-отчётам # Файлы "runfile" => "lm.run", @@ -263,7 +268,7 @@ my %myenv = ( %Config, host => $m, dirs => "/root /home/".$Machines{$m}->{"user"}, - lablogs => $Config{"lablogs_path"}."/". + lablogs => $Config{"path_lablogs"}."/". $XMLClass->{"course"}."/". $XMLClass->{"date"}."/". "$m", @@ -300,83 +305,47 @@ } + +=cut comment + +lm report + +Построить html представление для журналов текущего класса. +Для построения используется скрипт l3-report. + +=cut + sub lm_report { - print "Not implemented yet\n"; - exit(1); + my $webdir = $Config{"path_web"}; + my $course=$XMLClass->{"course"}; + my $date=$XMLClass->{"date"}; + my $encoding=$XMLClass->{"charset"}; -=cut comment + print "date=$date\n"; -Дальше идут скрипты, код которых нужно реализовать здесь. -Как минимум. + for my $student (@{$XMLClass->{"student"}}) { + my $user = $student->{"user"}; + my $hostname = $student->{"host"}; + my $encoding = $student->{"encoding"}; -=cut - - my $lm_script_make_report_web = <<'SCRIPT'; - -#!/bin/sh - -####cd /home/devi/lm -./lm do copy-lablogs -##./lm-report --input /home/murk/.labmaker --output /var/www/lm/murk.html -##exit - -COURSE=ug-h -DATE=2005-04-25 -SUFF=".linux.nt" -#MACHINES="m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 m11 m12 m13 m14 m15" -#MACHINES="m1 m2 m3 m4 m5 m6 m7 f1 f2 f3 f4 f5" -MACHINES="m01 m02 m03 m04 m05 m06 m07 m08" -#MACHINES="m1" -USERS="user root" -WEBDIR=/var/www/lm - -for u in $USERS - do - for m in $MACHINES - do - e=utf-8 - [ "${m##f}" = "$m" ] || e=koi8-r - #e=koi8-r - mkdir -p $WEBDIR/$DATE/$m - cp share/*.ico share/*.css $WEBDIR/$m - #echo Processing Lablogs/$COURSE/$DATE/$m$SUFF/$u/ - ./lm-report\ - --input Lablogs/$COURSE/$DATE/$m$SUFF/$u/ \ - --diffs "Lablogs/$COURSE/$DATE/$m$SUFF/$u/ Lablogs/$COURSE/$DATE/$m$SUFF/root/"\ - --output /var/www/lm/$DATE/$m/$u.html \ - --encoding $e - done - done - - -SCRIPT - - my $lm_script_make_report_all = <<'SCRIPT'; - -#!/bin/sh -WEBDIR=/var/www/lm - -find . -type d -maxdepth 5 -mindepth 5 |\ - while read dir - do - subdir=${dir##Lablogs/} - e=utf-8 - echo $dir | grep -qi bsd && e=koi8-r - echo $dir | grep -qi /f && e=koi8-r - - mkdir -p $WEBDIR/${subdir%/*} - cp share/*.ico share/*.css $WEBDIR/${subdir%/*} - #echo Processing Lablogs/$COURSE/$DATE/$m$SUFF/$u/ - ./lm-report\ - --input $dir \ - --diffs "${dir%/user}/root $dir"\ - --output $WEBDIR/$subdir.html \ - --encoding $e - done - -SCRIPT + system("mkdir -p $webdir/$date/$hostname"); + system("cp ".$Config{"path_share"}."/*.{ico,css} $webdir/$date/$hostname"); + system($Config{"l3-report"}. + " --input ".$Config{"path_lablogs"}."/$course/$date/$hostname/$user". + " --diffs ".$Config{"path_lablogs"}."/$course/$date/$hostname/$user ". + $Config{"path_lablogs"}."/$course/$date/$hostname/root". + " --output $webdir/$date/$hostname/$user.html". + " --encoding $encoding" + ); + system($Config{"l3-report"}. + " --input ".$Config{"path_lablogs"}."/$course/$date/$hostname/root". + " --diffs ".$Config{"path_lablogs"}."/$course/$date/$hostname/root ". + " --output $webdir/$date/$hostname/root.html". + " --encoding $encoding" + ); + } } sub load_run