X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=check-packagexml.php;fp=check-packagexml.php;h=d53a44efdea40957b9087366c1dcd12289072fc2;hb=772e821e8d7ee8ee7a8b3a4fb2e60e5e67814abe;hp=0000000000000000000000000000000000000000;hpb=9936470ff8103e7671ca78183b06020dc6153a8f;p=m6w6%2Ftravis-pecl diff --git a/check-packagexml.php b/check-packagexml.php new file mode 100755 index 0000000..d53a44e --- /dev/null +++ b/check-packagexml.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +\n", $argv[0]); + exit(1); +} + +require_once "PEAR/Config.php"; +require_once "PEAR/PackageFile.php"; + +define("PACKAGE_XML", $argv[1]); +define("PACKAGE_DIR", dirname(PACKAGE_XML)); + +$factory = new PEAR_PackageFile(PEAR_Config::singleton()); +$pf = $factory->fromPackageFile($argv[1], PEAR_VALIDATE_NORMAL); + +if (PEAR::isError($pf)) { + fprintf(STDERR, "ERROR: %s\n", $pf->getMessage()); + exit(1); +} + +foreach ($pf->getValidationWarnings() as $warning) { + fprintf(STDERR, "%s: %s\n", strtoupper($warning["level"]), $warning["message"]); +} + +$exit = 0; +foreach ($pf->getFilelist() as $file => $attr) { + if (!file_exists(PACKAGE_DIR."/".$file)) { + $exit++; + fprintf(STDERR, "File '%s' with role '%s' not found in '%s'\n", + $file, $attr["role"], PACKAGE_DIR); + } +} + +if ($exit) { + fprintf(STDERR, "%3d failure(s)\n", $exit); + exit(1); +}