-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsumm-blfs.php
108 lines (78 loc) · 2.28 KB
/
summ-blfs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#! /usr/bin/php
<?php
date_default_timezone_set( "GMT" );
$date = date( "Y-m-d H:i:s" );
# Get ticket info
$report = "http://wiki.linuxfromscratch.org/blfs/report/1";
$file = "/tmp/report.html";
system( "wget $report -q -O $file" );
$contents = file_get_contents( $file );
$c = strip_tags( $contents );
$a = explode( "\n", $c );
$l = 0;
$ticket = array();
$desc = array();
foreach ( $a as $line )
{
if ( preg_match( "/#/", $line ) )
{
$t = preg_replace( "/^.*(#\d+).*$/", "$1", $line );
$summary = $a[$l+3];
array_push( $ticket, $t );
array_push( $desc, trim($summary) );
}
$l++;
}
# Get package info
// HTML_DIR environment variable -- where to put html output
$d = getenv( 'HTML_DIR' );
$HTML_DIR = ($d) ? $d : '.';
exec( "grep '\*' $HTML_DIR/chapter*.html", $diff );
$d = implode( "\n", $diff );
$file = preg_replace( "/<\/td><td>/" , " " , $d );
$file = preg_replace( "/chapter(\d)\./", "chapter0$1.", $file );
$file = preg_replace( "/\*/" , " *" , $file );
$file = preg_replace( "/\.html/" , "" , $file );
$file = preg_replace( "/:/" , " " , $file );
$file = preg_replace( "/\/home.*chapter/" , "" , $file );
$f = strip_tags( $file );
$a = explode( "\n", $f );
sort($a);
$msg = " BLFS Package BLFS Version Latest Ticket\n";
//echo $msg;
foreach ( $a as $l )
{
$c = preg_split( "/ /", $l );
if ( $c[0] == "" ) continue;
$pkg = $c[1];
if ( $pkg == "goffice" )
{
$c[1] .= $c[2];
$c[2] = $c[3];
$c[3] = $c[4];
}
if ( $c[3] == "0" ) $c[3] .= " ";
$x = substr("chapter $c[0]: $c[1] ", 0, 32);
$x .= substr("$c[2] ", 0, 25);
$x .= substr("$c[3] ", 0, 12);
$tick = "";
for ( $i=0; $i<count($ticket); $i++ )
{
$pkg = preg_replace( "/\+/", ".", $pkg );
if ( preg_match( "/$pkg/i", $desc[$i] ) )
{
$tick = $ticket[$i];
break;
}
}
$x .= "$tick\n";
//echo $x;
$msg .= $x;
}
//echo $x;
//exit;
$from = "[email protected]";
$subject = "BLFS Package Currency Check - $date GMT";
$to = "[email protected]";
exec ( "echo '$msg' | mailx -r $from -s '$subject' $to" );
?>