Line 1... |
Line 1... |
1 |
<?php /*
|
1 |
<?php /*
|
2 |
|
2 |
|
3 |
SvarDOS repo index builder
|
3 |
SvarDOS repo index builder
|
4 |
Copyright (C) Mateusz Viste 2012-2023
|
4 |
Copyright (C) Mateusz Viste 2012-2024
|
5 |
|
5 |
|
6 |
buildidx computes an index json file for the SvarDOS repository.
|
6 |
buildidx computes an index json file for the SvarDOS repository.
|
7 |
it must be executed pointing to a directory that stores packages (*.svp)
|
7 |
it must be executed pointing to a directory that stores packages (*.svp)
|
8 |
files. buildidx will generate the index file and save it into the package
|
8 |
files. buildidx will generate the index file and save it into the package
|
9 |
repository.
|
9 |
repository.
|
10 |
|
10 |
|
11 |
requires php-zip
|
11 |
requires php-zip
|
12 |
|
12 |
|
- |
|
13 |
01 feb 2024: computes the "latest" collection of symlinks
|
13 |
24 nov 2023: SVED included in the MS-DOS compat list instead of EDIT + support for "release xyz" versions
|
14 |
24 nov 2023: SVED included in the MS-DOS compat list instead of EDIT + support for "release xyz" versions
|
14 |
25 aug 2023: validation of the hwreq section in LSM files
|
15 |
25 aug 2023: validation of the hwreq section in LSM files
|
15 |
24 aug 2023: load hwreq data from LSM and store them in the json index + skip the '.svn' dir
|
16 |
24 aug 2023: load hwreq data from LSM and store them in the json index + skip the '.svn' dir
|
16 |
30 jun 2023: adapted for new CORE packages location (../packages-core)
|
17 |
30 jun 2023: adapted for new CORE packages location (../packages-core)
|
17 |
28 feb 2022: svarcom allowed to have a COMMAND.COM file without subdirectory
|
18 |
28 feb 2022: svarcom allowed to have a COMMAND.COM file without subdirectory
|
Line 418... |
Line 419... |
418 |
if ($f === 'devel/') continue;
|
419 |
if ($f === 'devel/') continue;
|
419 |
if (str_head_is($f, "games/{$pkgdir}/")) continue;
|
420 |
if (str_head_is($f, "games/{$pkgdir}/")) continue;
|
420 |
if ($f === 'games/') continue;
|
421 |
if ($f === 'games/') continue;
|
421 |
if (str_head_is($f, "drivers/{$pkgdir}/")) continue;
|
422 |
if (str_head_is($f, "drivers/{$pkgdir}/")) continue;
|
422 |
if ($f === 'drivers/') continue;
|
423 |
if ($f === 'drivers/') continue;
|
- |
|
424 |
if (str_head_is($f, "kernels/{$pkgdir}/")) continue;
|
423 |
echo "WARNING: {$fname} contains a file in an illegal location: {$f}\n";
|
425 |
echo "WARNING: {$fname} contains a file in an illegal location: {$f}\n";
|
424 |
}
|
426 |
}
|
425 |
|
427 |
|
426 |
// do I understand the version string?
|
428 |
// do I understand the version string?
|
427 |
if (vertoarr($lsmarray['version']) === false) echo "WARNING: {$fname} parsing of version string failed ('{$lsmarray['version']}')\n";
|
429 |
if (vertoarr($lsmarray['version']) === false) echo "WARNING: {$fname} parsing of version string failed ('{$lsmarray['version']}')\n";
|
Line 508... |
Line 510... |
508 |
file_put_contents($repodir . '/_index.json', $json_blob);
|
510 |
file_put_contents($repodir . '/_index.json', $json_blob);
|
509 |
|
511 |
|
510 |
$cats_json = json_encode($cats);
|
512 |
$cats_json = json_encode($cats);
|
511 |
file_put_contents($repodir . '/_cats.json', $cats_json);
|
513 |
file_put_contents($repodir . '/_cats.json', $cats_json);
|
512 |
|
514 |
|
- |
|
515 |
|
- |
|
516 |
// populate the 'latest' dir with symlinks to latest version of every svp
|
- |
|
517 |
mkdir($repodir . '/latest');
|
- |
|
518 |
foreach ($db as $pkg => $props) {
|
- |
|
519 |
$fname = array_key_first($props['versions']);
|
- |
|
520 |
$cat = array_values($props['cats'])[0];
|
- |
|
521 |
//echo "pkg = '{$pkg}' ; fname = '{$fname}' ; cat = '{$cat}'\n";
|
- |
|
522 |
if (!file_exists($repodir . '/latest/' . $cat)) mkdir($repodir . '/latest/' . $cat);
|
- |
|
523 |
symlink('../../' . $fname, $repodir . '/latest/' . $cat . '/' . $pkg . '.svp');
|
- |
|
524 |
}
|
- |
|
525 |
|
- |
|
526 |
|
513 |
exit(0);
|
527 |
exit(0);
|
514 |
|
528 |
|
515 |
?>
|
529 |
?>
|