4 include 'blfs-include.php';
7 $CHAPTERS = 'Chapters 39-43';
8 $START_PACKAGE = 'lxqt-build-tools';
9 $STOP_PACKAGE = 'qterminal';
12 //$renames[ 'libfm' ] = 'libfm-extra';
16 //$current="lxqt-powermanagement"; // Debug
19 //$regex[ 'libfm' ] = "/^.*Download libfm-(\d[\d\.]+\d).tar.*$/";
22 array( 'pkg' => 'lxqt-build-tools',
24 'replace' => "https://github.com/lxde/lxqt-build-tools/releases" ),
26 array( 'pkg' => 'libsysstat',
28 'replace' => "https://github.com/lxde/libsysstat/releases" ),
30 array( 'pkg' => 'liblxqt',
32 'replace' => "https://github.com/lxde/liblxqt/releases" ),
34 array( 'pkg' => 'libqtxdg',
36 'replace' => "https://github.com/lxde/libqtxdg/releases" ),
38 array( 'pkg' => 'libfm-qt',
40 'replace' => "https://github.com/lxde/libfm-qt/releases" ),
42 array( 'pkg' => 'lxqt-about',
44 'replace' => "https://github.com/lxde/lxqt-about/releases" ),
46 array( 'pkg' => 'lxqt-admin',
48 'replace' => "https://github.com/lxde/lxqt-admin/releases" ),
50 array( 'pkg' => 'lxqt-themes',
52 'replace' => "https://github.com/lxde/lxqt-themes/releases" ),
54 array( 'pkg' => 'lxqt-config',
56 'replace' => "https://github.com/lxde/lxqt-config/releases" ),
58 array( 'pkg' => 'lxqt-globalkeys',
60 'replace' => "https://github.com/lxde/lxqt-globalkeys/releases" ),
62 array( 'pkg' => 'lxqt-notificationd',
64 'replace' => "https://github.com/lxde/lxqt-notificationd/releases" ),
66 array( 'pkg' => 'lxqt-policykit',
68 'replace' => "https://github.com/lxde/lxqt-policykit/releases" ),
70 array( 'pkg' => 'lxqt-powermanagement',
72 'replace' => "https://github.com/lxde/lxqt-powermanagement/releases" ),
74 array( 'pkg' => 'lxqt-session',
76 'replace' => "https://github.com/lxde/lxqt-session/releases" ),
78 array( 'pkg' => 'lxqt-panel',
80 'replace' => "https://github.com/lxde/lxqt-panel/releases" ),
82 array( 'pkg' => 'lxqt-runner',
84 'replace' => "https://github.com/lxde/lxqt-runner/releases" ),
86 array( 'pkg' => 'pcmanfm-qt',
88 'replace' => "https://github.com/lxde/pcmanfm-qt/releases" ),
90 array( 'pkg' => 'lximage-qt',
92 'replace' => "https://github.com/lxde/lximage-qt/releases" ),
94 array( 'pkg' => 'obconf-qt',
96 'replace' => "https://github.com/lxde/obconf-qt/releases" ),
98 array( 'pkg' => 'pavucontrol-qt',
100 'replace' => "https://github.com/lxde/pavucontrol-qt/releases" ),
106 array( 'pkg' => 'qtermwidget',
108 'replace' => "https://github.com/lxde/qtermwidget/releases" ),
110 array( 'pkg' => 'qterminal',
112 'replace' => "https://github.com/lxde/qterminal/releases" ),
114 array( 'pkg' => 'lxqt-l10n',
116 'replace' => "https://github.com/lxde/lxqt-l10n/releases" ),
118 array( 'pkg' => 'lxqt-qtplugin',
120 'replace' => "https://github.com/lxde/lxqt-qtplugin/releases" ),
123 function get_packages( $package, $dirpath )
130 if ( isset( $current ) && $book_index != "$current" ) return 0;
132 // Fix up directory path
133 foreach ( $url_fix as $u )
135 $replace = $u[ 'replace' ];
136 $match = $u[ 'match' ];
138 if ( isset( $u[ 'pkg' ] ) )
140 if ( $package == $u[ 'pkg' ] )
142 $dirpath = preg_replace( "/$match/", "$replace", $dirpath );
148 if ( preg_match( "/$match/", $dirpath ) )
150 $dirpath = preg_replace( "/$match/", "$replace", $dirpath );
157 if ( preg_match( "/^ftp/", $dirpath ) )
159 // All ftp enties for this chapter N/A for this chapter
161 else if ( $book_index != "lxqt-build-tools" &&
162 $book_index != "libsysstat" &&
163 $book_index != "libqtxdg" &&
164 $book_index != "liblxqt" &&
165 $book_index != "libfm-qt" &&
166 $book_index != "lxqt-about" &&
167 $book_index != "lxqt-admin" &&
168 $book_index != "lxqt-themes" &&
169 $book_index != "lxqt-config" &&
170 $book_index != "lxqt-globalkeys" &&
171 $book_index != "lxqt-notificationd" &&
172 $book_index != "lxqt-policykit" &&
173 $book_index != "lxqt-powermanagement" &&
174 $book_index != "lxqt-qtplugin" &&
175 $book_index != "lxqt-session" &&
176 $book_index != "lxqt-l10n" &&
177 $book_index != "lxqt-panel" &&
178 $book_index != "lxqt-runner" &&
179 $book_index != "pcmanfm-qt" &&
181 $book_index != "kwindowsystem" &&
182 $book_index != "kidletime" &&
183 $book_index != "solid" &&
184 $book_index != "kguiaddons" &&
185 $book_index != "kwayland" &&
187 $book_index != "libkscreen" &&
189 $book_index != "lximage-qt" &&
190 $book_index != "obconf-qt" &&
191 $book_index != "pavucontrol-qt" &&
192 $book_index != "qtermwidget" &&
193 $book_index != "qterminal"
196 // Most http enties for this chapter
197 $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
198 $position = strrpos( $dirpath, "/" );
199 $dirpath = substr ( $dirpath, 0, $position ); // Up 1
200 $dirs = http_get_file( "$dirpath/" );
202 if ( preg_match( "/xf/", $package ) )
203 $dir = find_even_max( $dirs, "/^\d/", "/^([\d\.]+)\/.*$/" );
205 $dir = find_max ( $dirs, "/^\d/", "/^([\d\.]+)\/.*$/" );
208 $lines = http_get_file( "$dirpath/" );
210 if ( ! is_array( $lines ) ) return $lines;
215 if ( $book_index == "kguiaddons" ||
216 $book_index == "kwindowsystem" ||
217 $book_index == "kidletime" ||
218 $book_index == "solid" ||
219 $book_index == "libkscreen" )
221 $dirpath = rtrim ( $dirpath, "/" ); // Trim any trailing slash
222 $position = strrpos( $dirpath, "/" );
223 $dirpath = substr ( $dirpath, 0, $position ); // Up 1
226 $lines = http_get_file( "$dirpath" );
229 if ( isset( $regex[ $package ] ) )
231 // Custom search for latest package name
232 foreach ( $lines as $l )
234 if ( preg_match( '/^\h*$/', $l ) ) continue;
235 $ver = preg_replace( $regex[ $package ], "$1", $l );
236 if ( $ver == $l ) continue;
238 return $ver; // Return first match of regex
241 return 0; // This is an error
244 if ( $book_index == "kguiaddons" ||
245 $book_index == "kwindowsystem" ||
246 $book_index == "kidletime" ||
247 $book_index == "solid" ||
248 $book_index == "libkscreen" )
250 $max = find_max( $lines, "/\d.\d/", "/^.*;([\d\.]*\d)\/.*$/" );
252 if ( $book_index == "libkscreen" ) return $max;
253 return $max . ".0"; // Add .0 to version
256 // Most packages are in the form $package-n.n.n
257 // Occasionally there are dashes (e.g. 201-1)
259 return find_max( $lines, "/$package/", "/^.*$package-([\d\.]*\d)\.tar.*$/" );
262 function get_pattern( $line )
265 array( 'pkg' => 'lxqt-l10n',
266 'regex' => "/^.*lxqt-l10n-(\d[\d\.]+).*$/" ),
269 foreach( $match as $m )
272 if ( preg_match( "/$pkg/", $line ) )
273 return $m[ 'regex' ];
276 return "/\D*(\d.*\d)\D*$/";
279 get_current(); // Get what is in the book
281 // Get latest version for each package
282 foreach ( $book as $pkg => $data )
286 $base = $data[ 'basename' ];
287 $url = $data[ 'url' ];
288 $bver = $data[ 'version' ];
290 echo "book index: $book_index $bver $url \n";
292 $v = get_packages( $book_index, $url );
293 $vers[ $book_index ] = $v;
296 html(); // Write html output