Update to firefox-78.10.0 in svn
[beyond_linux_from_scratch.git] / scripts / summ-blfs-test.php
blob9a1cbf2c802106f4074cac7ef3598e731ec14067
1 #! /usr/bin/php
2 <?php
4 date_default_timezone_set( "GMT" );
5 $date = date( "Y-m-d H:i:s" );
8 # Get ticket info
9 $report = "http://wiki.linuxfromscratch.org/blfs/report/1";
10 $file = "/tmp/report.html";
12 system( "wget $report -q -O $file" );
14 $contents = file_get_contents( $file );
15 $c = strip_tags( $contents );
17 $a = explode( "\n", $c ); // Lines from trac report w/o html
19 $l = 0;
21 $ticket = array();
22 $desc = array();
24 foreach ( $a as $line )
26 if ( preg_match( "/#/", $line ) )
28 $t = preg_replace( "/^.*(#\d+).*$/", "$1", $line );
29 $summary = $a[$l+3];
31 array_push( $ticket, $t );
32 array_push( $desc, trim($summary) );
35 $l++;
38 # Get package info
40 // HTML_DIR environment variable -- where to put html output
41 $d = getenv( 'HTML_DIR' );
42 $HTML_DIR = ($d) ? $d : '.';
44 exec( "grep '\*' $HTML_DIR/chapter*.html", $diff );
45 $d = implode( "\n", $diff );
47 $file = preg_replace( "/<\/td><td>/" , " " , $d );
48 $file = preg_replace( "/chapter(\d)\./", "chapter0$1.", $file );
49 $file = preg_replace( "/\*/" , " *" , $file );
50 $file = preg_replace( "/\.html/" , "" , $file );
51 $file = preg_replace( "/:/" , " " , $file );
52 $file = preg_replace( "/\/home.*chapter/" , "" , $file );
54 $f = strip_tags( $file );
55 $a = explode( "\n", $f ); // Now $a is lines from currency script output
56 sort($a);
58 $msg = " BLFS Package BLFS Version Latest Ticket\n";
60 foreach ( $a as $l )
62 $c = preg_split( "/ /", $l ); // $c is array from a line of currency script
63 if ( $c[0] == "" ) continue;
64 $pkg = $c[1];
66 // Things to skio completely
67 if ( preg_match( "/libreoffice-/", $pkg ) ) continue;
69 if ( $pkg == "baloo" ||
70 $pkg == "baloo-widgets" ||
71 $pkg == "kactivities" ||
72 $pkg == "kfilemetadata" ||
73 $pkg == "kdeplasma-addons" ||
74 $pkg == "konsole" ||
75 $pkg == "kate" ||
76 $pkg == "gwenview" ||
77 $pkg == "oxygen-icons" ||
78 $pkg == "kde-base-artwork" ||
79 $pkg == "kde-baseapps" ||
80 $pkg == "kdepimlibs" ||
81 $pkg == "obconf-qt" ||
82 $pkg == "libdbusmenu-qt" ||
83 $pkg == "juffed"
84 ) continue;
86 // c[0] is chapter
87 // c[1] is pkg name
88 // c[2] is book version
89 // c[3] is current version
91 if ( $c[3] == "0" ) $c[3] .= " ";
92 $x = substr("chapter $c[0]: $c[1] ", 0, 32);
93 $x .= substr("$c[2] ", 0, 25);
94 $x .= substr("$c[3] ", 0, 13);
96 $tick = "";
98 for ( $i=0; $i<count($ticket); $i++ )
100 $pkg = preg_replace( "/\+/", ".", $pkg );
101 if ( preg_match( "/$pkg/i", $desc[$i] ) )
103 // Make sure cmake != cmake-extra-modules
104 if ( $pkg == "cmake" &&
105 preg_match( "/extra/", $desc[$i] )
106 ) continue;
108 $tick = $ticket[$i];
109 break;
113 $x .= "$tick\n";
114 //echo $x;
115 $msg .= $x;
118 echo $msg; // For debugging
119 exit;
121 $from = "bdubbs@linuxfromscratch.org";
122 $subject = "BLFS Package Currency Check - $date GMT";
123 $to = "blfs-book@lists.linuxfromscratch.org";
125 exec ( "echo '$msg' | mailx -r $from -s '$subject' $to" );