4 include 'blfs-include.php';
7 $CHAPTERS = 'Chapters 37-38';
8 $START_PACKAGE = 'libxfce4util';
9 $STOP_PACKAGE = 'lxterminal';
12 $renames[ 'libfm' ] = 'libfm-extra';
13 $renames[ 'libfm1' ] = 'libfm';
16 //$renames[ 'libfm1' ] = '';
19 //$regex[ 'libfm' ] = "/^.*Download libfm-([\d\.]+).tar.*$/";
21 //$current="obconf-qt";
25 array( 'pkg' => 'gpicview',
28 "https://sourceforge.net/projects/lxde/files/GPicView%20%28image%20Viewer%29/0.2.x"),
30 array( 'pkg' => 'xfce4-pulseaudio-plugin',
32 'replace' => "https://gitlab.xfce.org/panel-plugins/xfce4-pulseaudio-plugin/-/tags/"),
34 array( 'pkg' => 'lxappearance',
36 'replace' => "https://sourceforge.net/projects/lxde/files/LXAppearance"),
38 array( 'pkg' => 'lxappearance-obconf',
40 'replace' => "https://sourceforge.net/projects/lxde/files/LXAppearance%20Obconf/"),
42 array( 'pkg' => 'lxde-common',
44 'replace' => "https://sourceforge.net/projects/lxde/files/lxde-common%20%28default%20config%29"),
46 array( 'pkg' => 'lxinput',
48 'replace' => "https://sourceforge.net/projects/lxde/files/LXInput%20%28Kbd%20and%20amp_%20mouse%20config%29"),
50 array( 'pkg' => 'lxrandr',
52 'replace' => "https://sourceforge.net/projects/lxde/files/LXRandR%20%28monitor%20config%20tool%29"),
54 array( 'pkg' => 'lxtask',
57 "https://sourceforge.net/projects/lxde/files/LXTask%20%28task%20manager%29"),
59 array( 'pkg' => 'lxterminal',
62 "https://sourceforge.net/projects/lxde/files/LXTerminal%20%28terminal%20emulator%29"),
64 array( 'pkg' => 'lxsession',
67 "https://sourceforge.net/projects/lxde/files/LXSession%20%28session%20manager%29"),
69 array( 'pkg' => 'lxmenu-data',
72 "https://sourceforge.net/projects/lxde/files/lxmenu-data%20%28desktop%20menu%29"),
74 array( 'pkg' => 'libfm',
76 'replace' => "https://sourceforge.net/projects/pcmanfm/files" ),
78 array( 'pkg' => 'libfm1',
80 'replace' => "https://sourceforge.net/projects/pcmanfm/files" ),
82 array( 'pkg' => 'menu-cache',
84 'replace' => "https://sourceforge.net/projects/lxde/files/menu-cache" ),
86 array( 'pkg' => 'lxpanel',
89 "https://sourceforge.net/projects/lxde/files/LXPanel%20%28desktop%20panel%29" ),
91 array( 'pkg' => 'pcmanfm',
93 'replace' => "https://sourceforge.net/projects/pcmanfm/files/PCManFM%20%2B%20Libfm%20%28tarball%20release%29/PCManFM" ),
95 array( 'pkg' => 'qtermwidget',
97 'replace' => "https://github.com/lxde/qtermwidget/releases" ),
99 array( 'pkg' => 'qterminal',
101 'replace' => "https://github.com/lxde/qterminal/releases" ),
103 array( 'pkg' => 'QupZilla',
105 'replace' => "https://github.com/QupZilla/qupzilla/releases" ),
107 array( 'pkg' => 'xfce4-xkb-plugin',
109 'replace' => "http://archive.xfce.org/src/panel-plugins/xfce4-xkb-plugin/0.7" ),
113 function get_packages( $package, $dirpath )
120 if ( isset( $current ) && $book_index != "$current" ) return 0;
122 // Fix up directory path
123 foreach ( $url_fix as $u )
125 $replace = $u[ 'replace' ];
126 $match = $u[ 'match' ];
128 if ( isset( $u[ 'pkg' ] ) )
130 if ( $package == $u[ 'pkg' ] )
132 $dirpath = preg_replace( "/$match/", "$replace", $dirpath );
138 if ( preg_match( "/$match/", $dirpath ) )
140 $dirpath = preg_replace( "/$match/", "$replace", $dirpath );
147 if ( preg_match( "/^ftp/", $dirpath ) )
149 // All ftp enties for this chapter
150 $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
151 $position = strrpos( $dirpath, "/" );
152 $dirpath = substr ( $dirpath, 0, $position ); // Up 1
153 $dirs = http_get_file( "$dirpath/" );
155 if ( $book_index == "libwnck" ||
156 $book_index == "gtksourceview" )
157 $dir = find_even_max( $dirs, "/ 2\./", "/^.* (2[\d\.]+)$/" );
159 else if ( $book_index == "vte" )
162 else if ( $book_index == "libunique" )
166 $dir = find_even_max( $dirs, "/^\d/", "/^([\d\.]+).*$/" );
168 $dirpath .= "/$dir/";
171 $lines = http_get_file( "$dirpath/" );
173 else if ( $book_index == "menu-cache" )
175 $dirs = http_get_file( "$dirpath/" );
176 $dir = find_max ( $dirs, "/^\s*\d/", "/^\s*(\d\.[\d\.x]+)\s+.*$/" );
178 $lines = http_get_file( "$dirpath/" );
179 $ver = find_max( $lines, "/menu-cache/", "/^.*menu-cache-([\d\.]+).tar.*/" );
182 else if ( $book_index == "libfm1" )
184 $lines = http_get_file( "$dirpath/" );
185 $ver = find_max( $lines, "/libfm/", "/^.*libfm-([\d\.]+).tar.*/" );
188 else if ( $book_index == "pcmanfm" )
190 $lines = http_get_file( "$dirpath/" );
191 $ver = find_max( $lines, "/pcmanfm/", "/^.*pcmanfm-([\d\.]+).tar.*/" );
194 else if ( $book_index == "lxappearance" )
196 $lines = http_get_file( "$dirpath/" );
197 $ver = find_max( $lines, "/lxappearance/", "/^.*lxappearance-([\d\.]+).tar.*$/" );
200 else if ( $book_index == "lxappearance-obconf" )
202 $lines = http_get_file( "$dirpath/" );
203 $ver = find_max( $lines, "/lxappearance/", "/^.*lxappearance-obconf-([\d\.]+).tar.*$/" );
206 else if ( $book_index == "lxpanel" )
208 $dirs = http_get_file( "$dirpath/" );
209 $dir = find_max ( $dirs, "/LXPanel/", "/^.*(LXPanel\s+[\d\.x]+)\s+\d.*$/" );
210 $dir = preg_replace( "/ /", '%20', $dir );
212 $lines = http_get_file( "$dirpath/" );
213 $ver = find_max( $lines, "/lxpanel/", "/^.*lxpanel-([\d\.]+).tar.*$/" );
216 else if ( $book_index == "lxinput" )
218 $dirs = http_get_file( "$dirpath/" );
219 $dir = find_max ( $dirs, "/LXInput/", "/^.*(LXInput\s*[\d\.x]+) .*$/" );
220 $dir = preg_replace( "/ /", '%20', $dir );
222 $lines = http_get_file( "$dirpath/" );
223 $ver = find_max( $lines, "/lxinput/", "/^.*lxinput-([\d\.]+).tar.*$/" );
226 else if ( $book_index == "lxrandr" )
228 $dirs = http_get_file( "$dirpath/" );
229 $dir = find_max ( $dirs, "/LXRandR/", "/^.*(LXRandR\s+[\d\.x]+).*$/" );
230 $dir = preg_replace( "/ /", '%20', $dir );
232 $lines = http_get_file( "$dirpath/" );
233 $ver = find_max( $lines, "/lxrandr/", "/^.*lxrandr-([\d\.]+).tar.*$/" );
236 else if ( $book_index == "lxtask" )
238 $dirs = http_get_file( "$dirpath/" );
239 $dir = find_max ( $dirs, "/LXTask/", "/^\s*(LXTask\s+[\d\.x]+)\s+.*$/" );
240 $dir = preg_replace( "/ /", '%20', $dir );
242 $lines = http_get_file( "$dirpath/" );
243 $ver = find_max( $lines, "/lxtask/", "/^.*lxtask-([\d\.]+).tar.*$/" );
246 else if ( $book_index == "lxterminal" )
248 $dirs = http_get_file( "$dirpath/" );
249 $dir = find_max ( $dirs, "/LXTerminal/", "/^\s*(LXTerminal\s+[\d\.x]+)\s+.*$/" );
250 $dir = preg_replace( "/ /", '%20', $dir );
252 $lines = http_get_file( "$dirpath/" );
253 $ver = find_max( $lines, "/lxterminal/", "/^.*lxterminal-([\d\.]+).tar.*$/" );
256 else if ( $book_index == "lxsession" )
258 $dirs = http_get_file( "$dirpath/" );
259 $dir = find_max ( $dirs, "/LXSession/", "/^.*(LXSession\s+[\d\.x]+)\s+.*$/" );
260 $dir = preg_replace( "/ /", '%20', $dir );
262 $lines = http_get_file( "$dirpath/" );
263 $ver = find_max( $lines, "/lxsession/", "/^.*lxsession-([\d\.]+).tar.*$/" );
266 if ( $book_index == "lxde-common" )
268 $dirs = http_get_file( "$dirpath/" );
269 $dir = find_max( $dirs, "/common/", "/^.*common ([\d\.]+\d).*$/" );
270 $dirpath .= "/lxde-common%20$dir";
271 $lines = http_get_file( "$dirpath/" );
272 $ver = find_max( $lines, "/common/", "/^.*common-([\d\.]+).tar.*$/" );
276 else if ( $book_index == "gpicview" )
278 //$dirs = http_get_file( "$dirpath/" );
279 //$dir = find_max ( $dirs, "/^\s*\d/", "/^\s*(\d\.[\d\.x]+) .*$/" );
280 //$dir = preg_replace( "/ /", '%20', $dir );
281 //$dirpath .= "/$dir";
282 $lines = http_get_file( "$dirpath/" );
283 $ver = find_max( $lines, "/gpicview/", "/^.*gpicview-([\d\.]+).tar.*$/" );
286 else if ( $book_index == "qtermwidget" )
288 $lines = http_get_file( "$dirpath/" );
289 $ver = find_max( $lines, "/qtermwidget/", "/^\s+qtermwidget-([\d\.]+).tar.*$/" );
292 else if ( $book_index == "qterminal" )
294 $lines = http_get_file( "$dirpath/" );
295 $ver = find_max( $lines, "/qterminal/", "/^\s+qterminal-([\d\.]+).tar.*$/" );
298 else if ( $book_index == "QupZilla" )
300 $lines = http_get_file( "$dirpath/" );
301 $ver = find_max( $lines, "/QupZilla/", "/^\s+QupZilla-([\d\.]+).tar.*$/" );
304 else if ( $book_index == "xfce4-pulseaudio-plugin" )
306 $lines = http_get_file( "$dirpath" );
307 $ver = find_max( $lines, "/xfce4-pulseaudio-plugin/",
308 "/^.*xfce4-pulseaudio-plugin-([\d\.]+).*$/" );
311 else if ( $book_index != "lxmenu-data" &&
312 $book_index != "libfm" &&
313 $book_index != "libfm1" &&
314 $book_index != "vte" &&
315 $book_index != "libwnck" &&
316 $book_index != "xfce4-xkb-plugin" ) // http
318 // Most http enties for this chapter
319 $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
320 $position = strrpos( $dirpath, "/" );
321 $dirpath = substr ( $dirpath, 0, $position ); // Up 1
322 $dirs = http_get_file( "$dirpath/" );
324 if ( ( preg_match( "/xf/", $package ) ||
325 preg_match( "/exo/", $package )
327 $book_index != "xfburn"
329 $dir = find_even_max( $dirs, "/^\d/", "/^([\d\.]+)\/.*$/" );
331 $dir = find_max ( $dirs, "/^\d/", "/^([\d\.]+)\/.*$/" );
334 $lines = http_get_file( "$dirpath/" );
336 if ( ! is_array( $lines ) ) return $lines;
342 $lines = http_get_file( "$dirpath/" );
345 if ( isset( $regex[ $package ] ) )
347 // Custom search for latest package name
348 foreach ( $lines as $l )
350 if ( preg_match( '/^\h*$/', $l ) ) continue;
351 $ver = preg_replace( $regex[ $package ], "$1", $l );
353 if ( $ver == $l ) continue;
355 return $ver; // Return first match of regex
358 return 0; // This is an error
361 if ( $book_index == "lxpanel" )
363 $ver = find_max( $lines, "/LXPanel/", "/^.*LXPanel ([\d\.]+\d).*$/" );
367 if ( $book_index == "lxde-icon-theme" )
368 return find_max( $lines, "/$package/", "/^.*$package-([\d\.]*\d).*$/" );
370 if ( $book_index == "xfce4-terminal" ||
371 $book_index == "tumbler" )
372 return find_max( $lines, "/$package/", "/^.*$package-([\d\.]*\d).*$/", TRUE );
374 // Most packages are in the form $package-n.n.n
375 // Occasionally there are dashes (e.g. 201-1)
376 return find_max( $lines, "/$package/", "/^.*$package-([\d\.]*\d)\.tar.*$/" );
379 function get_pattern( $line )
381 // Set up specific patter matches for extracting book versions
383 array( 'pkg' => '.*xfce',
384 'regex' => "/^.*xfce.*-(\d[\d\.]+).*$/" ),
386 array( 'pkg' => 'xfwm',
387 'regex' => "/^.*xfwm4-(\d[\d\.]+).*$/" ),
390 foreach( $match as $m )
393 if ( preg_match( "/$pkg/", $line ) )
394 return $m[ 'regex' ];
397 return "/\D*(\d.*\d)\D*$/";
400 get_current(); // Get what is in the book
402 // Get latest version for each package
403 foreach ( $book as $pkg => $data )
407 $base = $data[ 'basename' ];
408 $url = $data[ 'url' ];
409 $bver = $data[ 'version' ];
411 echo "book index: $book_index $bver $url\n";
413 $v = get_packages( $book_index, $url );
414 $vers[ $book_index ] = $v;
417 html(); // Write html output