1 | #! /usr/bin/php
|
---|
2 | <?php
|
---|
3 | $dirs = array();
|
---|
4 | $vers = array();
|
---|
5 |
|
---|
6 | date_default_timezone_set( "GMT" );
|
---|
7 | $date = date( "Y-m-d H:i:s" );
|
---|
8 |
|
---|
9 | // Special cases
|
---|
10 | $exceptions = array();
|
---|
11 | //$exceptions[ 'gmp' ] = "UPDIR=/.*(gmp-\d[\d\.-]*\d).*/:DOWNDIR=";
|
---|
12 |
|
---|
13 | $regex = array();
|
---|
14 | //$regex[ 'bzip2' ] = "/^.*current version is ([\d\.]+).*$/";
|
---|
15 | $regex[ 'intltool' ] = "/^.*Latest version is (\d[\d\.]+\d).*$/";
|
---|
16 | $regex[ 'less' ] = "/^.*current released version is less-(\d+).*$/";
|
---|
17 | $regex[ 'mpfr' ] = "/^mpfr-([\d\.]+)\.tar.*$/";
|
---|
18 | //$regex[ 'Python' ] = "/^.*Latest Python 3.*Python (3[\d\.]+\d).*$/";
|
---|
19 | //$regex[ 'sysvinit' ] = "/^.*sysvinit-([\d\.]+)dsf\.tar.*$/";
|
---|
20 | $regex[ 'tzdata' ] = "/^.*tzdata([\d]+[a-z]).*$/";
|
---|
21 | $regex[ 'xz' ] = "/^.*xz-([\d\.]*\d).*$/";
|
---|
22 | $regex[ 'zlib' ] = "/^.*zlib ([\d\.]*\d).*$/";
|
---|
23 |
|
---|
24 | function find_max( $lines, $regex_match, $regex_replace )
|
---|
25 | {
|
---|
26 | $a = array();
|
---|
27 | if ( ! is_array( $lines ) ) return -1;
|
---|
28 |
|
---|
29 | foreach ( $lines as $line )
|
---|
30 | {
|
---|
31 | if ( ! preg_match( $regex_match, $line ) ) continue;
|
---|
32 |
|
---|
33 | // Isolate the version and put in an array
|
---|
34 | $slice = preg_replace( $regex_replace, "$1", $line );
|
---|
35 | if ( strcmp( $slice, $line ) == 0 ) continue;
|
---|
36 |
|
---|
37 | array_push( $a, $slice );
|
---|
38 | }
|
---|
39 |
|
---|
40 | // SORT_NATURAL requires php-5.4.0 or later
|
---|
41 | rsort( $a, SORT_NATURAL ); // Max version is at the top
|
---|
42 | return ( isset( $a[0] ) ) ? $a[0] : -2;
|
---|
43 | }
|
---|
44 |
|
---|
45 | function find_even_max( $lines, $regex_match, $regex_replace )
|
---|
46 | {
|
---|
47 | $a = array();
|
---|
48 | foreach ( $lines as $line )
|
---|
49 | {
|
---|
50 | if ( ! preg_match( $regex_match, $line ) ) continue;
|
---|
51 |
|
---|
52 | // Isolate the version and put in an array
|
---|
53 | $slice = preg_replace( $regex_replace, "$1", $line );
|
---|
54 |
|
---|
55 | if ( "x$slice" == "x$line" ) continue;
|
---|
56 |
|
---|
57 | // Skip odd numbered minor versions and minors > 80
|
---|
58 | list( $major, $minor, $rest ) = explode( ".", $slice . ".0" );
|
---|
59 | if ( $minor % 2 == 1 ) continue;
|
---|
60 | if ( $minor > 80 ) continue;
|
---|
61 | array_push( $a, $slice );
|
---|
62 | }
|
---|
63 |
|
---|
64 | rsort( $a, SORT_NATURAL ); // Max version is at the top
|
---|
65 | return ( isset( $a[0] ) ) ? $a[0] : -2;
|
---|
66 | }
|
---|
67 |
|
---|
68 | function http_get_file( $url )
|
---|
69 | {
|
---|
70 | if ( preg_match( "/mpfr/", $url ) )
|
---|
71 | {
|
---|
72 | # There seems to be a problem with the mpfs certificate
|
---|
73 | exec( "curl --location --silent --insecure --max-time 30 $url", $dir );
|
---|
74 | $s = implode( "\n", $dir );
|
---|
75 | $dir = strip_tags( $s );
|
---|
76 | return explode( "\n", $dir );
|
---|
77 | }
|
---|
78 |
|
---|
79 | if ( preg_match( "/sourceforge/", $url ) ||
|
---|
80 | preg_match( "/python/", $url ) ||
|
---|
81 | preg_match( "/psmisc/", $url ) )
|
---|
82 | {
|
---|
83 | exec( "lynx -dump $url 2>/dev/null", $lines );
|
---|
84 | return $lines;
|
---|
85 | }
|
---|
86 |
|
---|
87 | exec( "curl --location --silent --max-time 30 $url", $dir );
|
---|
88 |
|
---|
89 | $dir = implode( "\n", $dir );
|
---|
90 | if ( !preg_match( "/api.github.com/", $url) )
|
---|
91 | $dir = strip_tags( $dir );
|
---|
92 | return explode( "\n", $dir );
|
---|
93 | }
|
---|
94 |
|
---|
95 | function max_parent( $dirpath, $prefix )
|
---|
96 | {
|
---|
97 | // First, remove a directory
|
---|
98 | $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
|
---|
99 | $position = strrpos( $dirpath, "/" );
|
---|
100 | $dirpath = substr ( $dirpath, 0, $position );
|
---|
101 |
|
---|
102 | $lines = http_get_file( $dirpath );
|
---|
103 |
|
---|
104 | $regex_match = "#{$prefix}[\d\.]+/#";
|
---|
105 | $regex_replace = "#^.*({$prefix}[\d\.]+)/.*$#";
|
---|
106 | $max = find_max( $lines, $regex_match, $regex_replace );
|
---|
107 |
|
---|
108 | return "$dirpath/$max";
|
---|
109 | }
|
---|
110 |
|
---|
111 | function github( $path )
|
---|
112 | {
|
---|
113 | return "https://api.github.com/repos/$path/releases/latest";
|
---|
114 | }
|
---|
115 |
|
---|
116 | function get_packages( $package, $dirpath )
|
---|
117 | {
|
---|
118 | global $exceptions;
|
---|
119 | global $regex;
|
---|
120 |
|
---|
121 | //if ( $package != "psmisc" ) return 0; // debug
|
---|
122 |
|
---|
123 | if ( $package == "bc" ) $dirpath = github("gavinhoward/bc");
|
---|
124 | if ( $package == "check" ) $dirpath = github("libcheck/check");
|
---|
125 | if ( $package == "e2fsprogs" ) $dirpath = "https://sourceforge.net/projects/e2fsprogs/files/e2fsprogs";
|
---|
126 | if ( $package == "expat" ) $dirpath = "https://sourceforge.net/projects/expat/files";
|
---|
127 | if ( $package == "elfutils" ) $dirpath = "https://sourceware.org/ftp/elfutils";
|
---|
128 | if ( $package == "expect" ) $dirpath = "https://sourceforge.net/projects/expect/files";
|
---|
129 | if ( $package == "file" ) $dirpath = "https://github.com/file/file/tags";
|
---|
130 | if ( $package == "flex" ) $dirpath = github("westes/flex");
|
---|
131 | if ( $package == "flit_core" ) $dirpath = "https://pypi.org/project/flit-core/";
|
---|
132 | if ( $package == "setuptools" ) $dirpath = "https://pypi.org/project/setuptools/";
|
---|
133 | if ( $package == "gcc" ) $dirpath = max_parent( $dirpath, "gcc-" );
|
---|
134 | if ( $package == "iana-etc" ) $dirpath = github("Mic92/iana-etc");
|
---|
135 | if ( $package == "intltool" ) $dirpath = "https://launchpad.net/intltool/trunk";
|
---|
136 | if ( $package == "libffi" ) $dirpath = github("libffi/libffi");
|
---|
137 | if ( $package == "libxcrypt" ) $dirpath = github("besser82/libxcrypt");
|
---|
138 | if ( $package == "lz4" ) $dirpath = github("lz4/lz4");
|
---|
139 | if ( $package == "meson" ) $dirpath = github("mesonbuild/meson");
|
---|
140 | if ( $package == "mpc" ) $dirpath = "https://ftp.gnu.org/gnu/mpc";
|
---|
141 | if ( $package == "mpfr" ) $dirpath = "https://mpfr.loria.fr/mpfr-current";
|
---|
142 | if ( $package == "ncurses" ) $dirpath = "https://invisible-mirror.net/archives/ncurses";
|
---|
143 | if ( $package == "ninja" ) $dirpath = github("ninja-build/ninja");
|
---|
144 | if ( $package == "openssl" ) $dirpath = github("openssl/openssl");
|
---|
145 | if ( $package == "procps-ng" ) $dirpath = "https://gitlab.com/procps-ng/procps/-/tags";
|
---|
146 | if ( $package == "psmisc" ) $dirpath = "https://gitlab.com/psmisc/psmisc/-/tags";
|
---|
147 | if ( $package == "Python" ) $dirpath = "https://www.python.org/downloads/source/";
|
---|
148 | if ( $package == "shadow" ) $dirpath = github("shadow-maint/shadow");
|
---|
149 | if ( $package == "sysvinit" ) $dirpath = github("slicer69/sysvinit");
|
---|
150 | if ( $package == "MarkupSafe" ) $dirpath = "https://pypi.python.org/pypi/MarkupSafe/";
|
---|
151 | if ( $package == "jinja" ) $dirpath = "https://pypi.python.org/pypi/Jinja2/";
|
---|
152 | if ( $package == "sysklogd" ) $dirpath = github("troglobit/sysklogd");
|
---|
153 | if ( $package == "systemd" ) $dirpath = github("systemd/systemd");
|
---|
154 | //if ( $package == "tcl" ) $dirpath = "https://sourceforge.net/projects/tcl/files";
|
---|
155 | if ( $package == "tcl" ) $dirpath = "https://www.tcl.tk/software/tcltk/download.html";
|
---|
156 | if ( $package == "util-linux" ) $dirpath = max_parent( $dirpath, "v." );
|
---|
157 | if ( $package == "vim" ) $dirpath = "https://github.com/vim/vim/tags";
|
---|
158 | if ( $package == "wheel" ) $dirpath = "https://pypi.org/project/wheel/#files";
|
---|
159 | if ( $package == "xz" ) $dirpath = github("tukaani-project/xz");
|
---|
160 | if ( $package == "zlib" ) $dirpath = "https://www.zlib.net";
|
---|
161 | if ( $package == "zstd" ) $dirpath = github("facebook/zstd");
|
---|
162 |
|
---|
163 | // Check for ftp
|
---|
164 | if ( preg_match( "/^ftp/", $dirpath ) )
|
---|
165 | {
|
---|
166 | echo "ftp should not occur\n";
|
---|
167 | }
|
---|
168 | else // http(s)
|
---|
169 | {
|
---|
170 | // Customize http directories as needed
|
---|
171 | if ( $package == "tzdata" )
|
---|
172 | {
|
---|
173 | // Remove two directories
|
---|
174 | $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
|
---|
175 | $position = strrpos( $dirpath, "/" );
|
---|
176 | $dirpath = substr ( $dirpath, 0, $position );
|
---|
177 | $position = strrpos( $dirpath, "/" );
|
---|
178 | $dirpath = substr ( $dirpath, 0, $position );
|
---|
179 | }
|
---|
180 |
|
---|
181 | $lines = http_get_file( $dirpath );
|
---|
182 | if ( ! is_array( $lines ) ) return -6;
|
---|
183 | } // End fetch
|
---|
184 |
|
---|
185 | if ( isset( $regex[ $package ] ) )
|
---|
186 | {
|
---|
187 | // Custom search for latest package name
|
---|
188 | foreach ( $lines as $l )
|
---|
189 | {
|
---|
190 | $ver = preg_replace( $regex[ $package ], "$1", $l );
|
---|
191 | if ( $ver == $l ) continue;
|
---|
192 | return $ver; // Return first match of regex
|
---|
193 | }
|
---|
194 |
|
---|
195 | return -7; // This is an error
|
---|
196 | }
|
---|
197 |
|
---|
198 | if ( $package == "perl" ) // Custom for perl
|
---|
199 | {
|
---|
200 | $tmp = array();
|
---|
201 |
|
---|
202 | foreach ( $lines as $l )
|
---|
203 | {
|
---|
204 | if ( preg_match( "/sperl/", $l ) ) continue; // Don't want this
|
---|
205 | $ver = preg_replace( "/^.*perl-([\d\.]+\d)\.tar.*$/", "$1", $l );
|
---|
206 | if ( $ver == $l ) continue;
|
---|
207 | list( $s1, $s2, $rest ) = explode( ".", $ver );
|
---|
208 | if ( $s2 % 2 == 1 ) continue; // Remove odd minor versions
|
---|
209 | array_push( $tmp, $l );
|
---|
210 | }
|
---|
211 |
|
---|
212 | $lines = $tmp;
|
---|
213 | }
|
---|
214 |
|
---|
215 | if ( $package == "attr" ||
|
---|
216 | $package == "acl" )
|
---|
217 | {
|
---|
218 | return find_max( $lines, "/$package/", "/^.*$package-([\d\.-]*\d).tar.*$/" );
|
---|
219 | }
|
---|
220 |
|
---|
221 | if ( $package == "e2fsprogs" )
|
---|
222 | return find_max( $lines, "/v\d/", "/^.*v(\d[\d\.]+\d).*$/" );
|
---|
223 |
|
---|
224 | if ( $package == "expect" )
|
---|
225 | return find_max( $lines, "/expect/", "/^.*expect(\d[\d\.]+\d).tar.*$/" );
|
---|
226 |
|
---|
227 | if ( $package == "elfutils" )
|
---|
228 | return find_max( $lines, "/^\d/", "/^(\d[\d\.]+\d)\/.*$/" );
|
---|
229 |
|
---|
230 | if ( $package == "XML-Parser" )
|
---|
231 | {
|
---|
232 | $max = find_max( $lines, "/$package/", "/^.*$package-([\d\._]*\d).tar.*$/" );
|
---|
233 | # 2.44_01 is a developer release
|
---|
234 | if ( $max == "2.44_01" ) { return "2.44"; }
|
---|
235 | return $max;
|
---|
236 | }
|
---|
237 |
|
---|
238 | if ( $package == "tcl" )
|
---|
239 | return find_max( $lines, "/tcl\d/", "/^.*tcl(\d\.[\d\.]*\d)-src.*$/" );
|
---|
240 |
|
---|
241 | if ( $package == "gmp" )
|
---|
242 | return find_max( $lines, "/$package/", "/^.*$package-([\d\._]*\d[a-z]?).tar.*$/" );
|
---|
243 |
|
---|
244 | if ( $package == "dbus" )
|
---|
245 | return find_even_max( $lines, "/$package/", "/^.*$package-([\d\.]+).tar.*$/" );
|
---|
246 |
|
---|
247 | if ( $package == "file" )
|
---|
248 | {
|
---|
249 | $max = find_max( $lines, "/FILE5/", "/^.*FILE(5_\d+)*$/" );
|
---|
250 | return str_replace( "_", ".", $max );
|
---|
251 | }
|
---|
252 |
|
---|
253 | if ( $package == "flit_core" )
|
---|
254 | return find_max( $lines, "/flit-core /", "/^.*flit-core ([\d\.]+)$/" );
|
---|
255 |
|
---|
256 | if ( $package == "setuptools" )
|
---|
257 | return find_max( $lines, "/setuptools /", "/^.*setuptools ([\d\.]+)$/" );
|
---|
258 |
|
---|
259 | if ( $package == "procps-ng" )
|
---|
260 | return find_max( $lines, "/v\d/", "/^.*v([\d\.]+)$/" );
|
---|
261 |
|
---|
262 | if ( $package == "psmisc" )
|
---|
263 | return find_max( $lines, "/v\d/", "/^.*v([\d\.]+)$/" );
|
---|
264 |
|
---|
265 | if ( $package == "grub" )
|
---|
266 | return find_max( $lines, "/grub/", "/^.*grub-([\d\.]+).tar.xz.*$/" );
|
---|
267 |
|
---|
268 | if ( $package == "jinja" )
|
---|
269 | return find_max( $lines, "/Jinja/", "/^.*Jinja2 ([\d\.]+).*$/" );
|
---|
270 |
|
---|
271 | if ( $package == "lz4" )
|
---|
272 | return find_max( $lines, "/tag_name/", '/^.*v([\d\.]+).*$/' );
|
---|
273 |
|
---|
274 | if ( $package == "openssl" )
|
---|
275 | return find_max( $lines, "/name.:/", "/^.*OpenSSL ([\d\.]+\d).*$/" );
|
---|
276 |
|
---|
277 | if ( $package == "Python" )
|
---|
278 | return find_max( $lines, "/Python 3/", "/^.*Python (3[\d\.]*\d) .*$/" );
|
---|
279 |
|
---|
280 | if ( $package == "vim" )
|
---|
281 | return find_max( $lines, "/v\d\./", "/^.*v([\d\.]+).*$/" );
|
---|
282 |
|
---|
283 | if ( preg_match( "/api.github.com/", $dirpath) )
|
---|
284 | return ltrim(json_decode(join("", $lines))->tag_name, "v");
|
---|
285 |
|
---|
286 | // Most packages are in the form $package-n.n.n
|
---|
287 | // Occasionally there are dashes (e.g. 201-1)
|
---|
288 | return find_max( $lines, "/$package/", "/^.*$package-([\d\.-]*\d)\.tar.*$/" );
|
---|
289 | }
|
---|
290 |
|
---|
291 | function get_current()
|
---|
292 | {
|
---|
293 | global $dirs;
|
---|
294 | global $vers;
|
---|
295 |
|
---|
296 | // Fetech from git and get wget-list
|
---|
297 | $current = array();
|
---|
298 | $lfsgit = "https://git.linuxfromscratch.org/lfs.git";
|
---|
299 |
|
---|
300 | $tmpdir = exec( "mktemp -d /tmp/lfscheck.XXXXXX" );
|
---|
301 | $cdir = getcwd();
|
---|
302 | chdir( $tmpdir );
|
---|
303 |
|
---|
304 | # git-version.sh needs the history since the rx.y tag.
|
---|
305 | exec ( "git clone $lfsgit LFS --depth 1 --branch r11.2" );
|
---|
306 | exec ( "git -C LFS pull origin trunk" );
|
---|
307 |
|
---|
308 | # Make version.ent
|
---|
309 | chdir( "$tmpdir/LFS" );
|
---|
310 | exec ( "./git-version.sh systemd" );
|
---|
311 |
|
---|
312 | chdir( $cdir );
|
---|
313 |
|
---|
314 | $PAGE = "$tmpdir/LFS/chapter03/chapter03.xml";
|
---|
315 | $STYLESHEET = "$tmpdir/LFS/stylesheets/wget-list.xsl";
|
---|
316 |
|
---|
317 | exec( "xsltproc --xinclude --nonet $STYLESHEET $PAGE", $current );
|
---|
318 | exec( "rm -rf $tmpdir" );
|
---|
319 |
|
---|
320 | foreach ( $current as $line )
|
---|
321 | {
|
---|
322 | $file = basename( $line ) . "\n";
|
---|
323 | if ( preg_match( "/patch$/", $file ) ) { continue; } // Skip patches
|
---|
324 |
|
---|
325 | $file = preg_replace( "/bz2/", '', $file ); // The 2 confuses the regex
|
---|
326 |
|
---|
327 | $file = rtrim( $file );
|
---|
328 | $pkg_pattern = "/(\D*).*/";
|
---|
329 | $pattern = "/\D*(\d.*\d)\D*/";
|
---|
330 |
|
---|
331 | if ( preg_match( "/e2fsprogs/", $file ) )
|
---|
332 | {
|
---|
333 | $pattern = "/e2\D*(\d.*\d)\D*/";
|
---|
334 | $pkg_pattern = "/(e2\D*).*/";
|
---|
335 | }
|
---|
336 |
|
---|
337 | else if ( preg_match( "/tzdata/", $file ) )
|
---|
338 | {
|
---|
339 | $pattern = "/\D*(\d.*[a-z])\.tar\D*/";
|
---|
340 | }
|
---|
341 |
|
---|
342 | else if ( preg_match( "/openssl/", $file ) )
|
---|
343 | {
|
---|
344 | $pattern = "/\D*(\d.*\d.*).tar.*$/";
|
---|
345 | }
|
---|
346 |
|
---|
347 | else if ( preg_match( "/gmp/", $file ) )
|
---|
348 | {
|
---|
349 | $pattern = "/\D*(\d.*[a-z]*)\.tar\D*/";
|
---|
350 | }
|
---|
351 |
|
---|
352 | else if ( preg_match( "/lz4/", $file ) )
|
---|
353 | {
|
---|
354 | $pkg_pattern= "/(\D*4).*/";
|
---|
355 | }
|
---|
356 |
|
---|
357 | else if ( preg_match( "/systemd-man-pages/", $file ) ) continue;
|
---|
358 | else if ( preg_match( "/python/" , $file ) ) continue;
|
---|
359 |
|
---|
360 | $version = preg_replace( $pattern, "$1", $file ); // Isolate version
|
---|
361 | $version = preg_replace( "/^\d-/", "", $version ); // Remove leading #-
|
---|
362 |
|
---|
363 | // Touch up package names
|
---|
364 | $pkg_name = preg_replace( $pkg_pattern, "$1", $file );
|
---|
365 | $pkg_name = trim( $pkg_name, "-" );
|
---|
366 |
|
---|
367 | if ( preg_match( "/bzip|iproute/", $pkg_name ) ) { $pkg_name .= "2"; }
|
---|
368 | if ( preg_match( "/^m$/" , $pkg_name ) ) { $pkg_name .= "4"; }
|
---|
369 | if ( preg_match( "/shadow/" , $pkg_name ) ) { $pkg_name = "shadow"; }
|
---|
370 |
|
---|
371 | $dirs[ $pkg_name ] = dirname( $line );
|
---|
372 | $vers[ $pkg_name ] = $version;
|
---|
373 | }
|
---|
374 | }
|
---|
375 |
|
---|
376 | function mail_to_lfs()
|
---|
377 | {
|
---|
378 | global $date;
|
---|
379 | global $vers;
|
---|
380 | global $dirs;
|
---|
381 |
|
---|
382 | $to = "lfs-book@lists.linuxfromscratch.org";
|
---|
383 | $from = "bdubbs@linuxfromscratch.org";
|
---|
384 | $subject = "LFS Package Currency Check - $date GMT";
|
---|
385 | $headers = "From: bdubbs@linuxfromscratch.org";
|
---|
386 |
|
---|
387 | $message = "Package LFS Upstream Flag\n\n";
|
---|
388 |
|
---|
389 | foreach ( $dirs as $pkg => $dir )
|
---|
390 | {
|
---|
391 | //if ( $pkg != "gmp" ) continue; //debug
|
---|
392 | $v = get_packages( $pkg, $dir );
|
---|
393 |
|
---|
394 | $flag = ( $vers[ $pkg ] != $v ) ? "*" : "";
|
---|
395 |
|
---|
396 | // Pad for output
|
---|
397 | $pad = " ";
|
---|
398 | $p = substr( $pkg . $pad, 0, 15 );
|
---|
399 | $l = substr( $vers[ $pkg ] . $pad, 0, 10 );
|
---|
400 | $c = substr( $v . $pad, 0, 10 );
|
---|
401 |
|
---|
402 | $message .= "$p $l $c $flag\n";
|
---|
403 | }
|
---|
404 |
|
---|
405 | exec ( "echo '$message' | mailx -r $from -s '$subject' $to" );
|
---|
406 | }
|
---|
407 |
|
---|
408 | function html()
|
---|
409 | {
|
---|
410 |
|
---|
411 | global $date;
|
---|
412 | global $vers;
|
---|
413 | global $dirs;
|
---|
414 |
|
---|
415 | echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
---|
416 | 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
---|
417 | <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
---|
418 | <head>
|
---|
419 | <title>LFS Package Currency Check - $date</title>
|
---|
420 | <style type='text/css'>
|
---|
421 | h1, h2 {
|
---|
422 | text-align : center;
|
---|
423 | }
|
---|
424 |
|
---|
425 | table {
|
---|
426 | border-width : 1px;
|
---|
427 | border-spacing : 0px;
|
---|
428 | border-style : outset;
|
---|
429 | border-color : gray;
|
---|
430 | border-collapse : separate;
|
---|
431 | background-color: white;
|
---|
432 | margin : 0px auto;
|
---|
433 | }
|
---|
434 |
|
---|
435 | table th {
|
---|
436 | border-width : 1px;
|
---|
437 | padding : 2px;
|
---|
438 | border-style : inset;
|
---|
439 | border-color : gray;
|
---|
440 | background-color: white;
|
---|
441 | }
|
---|
442 |
|
---|
443 | table td {
|
---|
444 | border-width : 1px;
|
---|
445 | padding : 2px;
|
---|
446 | border-style : inset;
|
---|
447 | border-color : gray;
|
---|
448 | background-color: white;
|
---|
449 | }
|
---|
450 | </style>
|
---|
451 |
|
---|
452 | </head>
|
---|
453 | <body>
|
---|
454 | <h1>LFS Package Currency Check</h1>
|
---|
455 | <h2>As of $date GMT</h1>
|
---|
456 |
|
---|
457 | <table>
|
---|
458 | <tr><th>LFS Package</th> <th>LFS Version</th> <th>Latest</th> <th>Flag</th></tr>\n";
|
---|
459 |
|
---|
460 | // Get the latest version of each package
|
---|
461 | foreach ( $dirs as $pkg => $dir )
|
---|
462 | {
|
---|
463 | $v = get_packages( $pkg, $dir );
|
---|
464 | $flag = ( $vers[ $pkg ] != $v ) ? "*" : "";
|
---|
465 | echo "<tr><td>$pkg</td> <td>{$vers[ $pkg ]}</td> <td>$v</td> <td>$flag</td></tr>\n";
|
---|
466 | }
|
---|
467 |
|
---|
468 | echo "</table>
|
---|
469 | </body>
|
---|
470 | </html>\n";
|
---|
471 |
|
---|
472 | }
|
---|
473 |
|
---|
474 | function write_to_stdout()
|
---|
475 | {
|
---|
476 |
|
---|
477 | global $date;
|
---|
478 | global $vers;
|
---|
479 | global $dirs;
|
---|
480 |
|
---|
481 | echo "
|
---|
482 | LFS Package Currency Check
|
---|
483 | As of $date GMT
|
---|
484 |
|
---|
485 | LFS Package LFS Version Latest Flag\n";
|
---|
486 |
|
---|
487 | // Get the latest version of each package
|
---|
488 | foreach ( $dirs as $pkg => $dir )
|
---|
489 | {
|
---|
490 | $p_name = sprintf( "%-15s", $pkg ); // package name formatted
|
---|
491 |
|
---|
492 | $b_version = $vers[ $pkg ]; // book version
|
---|
493 | $b_string = sprintf( "%-11s", $b_version ); // book version formatted
|
---|
494 |
|
---|
495 | $latest = get_packages( $pkg, $dir ); // latest version
|
---|
496 | $l_string = sprintf( "%-6s", $latest ); // latest version formatted
|
---|
497 |
|
---|
498 | $flag = ( $b_version != $latest ) ? "*" : "";
|
---|
499 | echo "$p_name $b_string $l_string $flag\n";
|
---|
500 | }
|
---|
501 | }
|
---|
502 |
|
---|
503 | get_current(); // Get what is in the book
|
---|
504 | mail_to_lfs();
|
---|
505 | //html(); // Write html output
|
---|
506 | //write_to_stdout(); // For debugging
|
---|
507 | ?>
|
---|