From: Michael Wallner Date: Fri, 31 Jul 2015 11:51:28 +0000 (+0200) Subject: package.xml checker X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=772e821e8d7ee8ee7a8b3a4fb2e60e5e67814abe;p=m6w6%2Fpecl-ci package.xml checker --- diff --git a/Makefile b/Makefile index 20bcbbc..54ae0bb 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ PECL_SONAME ?= $(if $(shell echo $(PECL) | cut -d: -f2),$(shell echo $(PECL) | c PECL_VERSION ?= $(shell echo $(PECL) | cut -d: -f3 -s) PECL_INI = $(with_config_file_scan_dir)/pecl.ini -PHP_VERSION ?= $(shell test -e $(srcdir)/php-versions.json && cat $(srcdir)/php-versions.json | /usr/bin/php $(srcdir)/php-version.php $(PHP)) +PHP_VERSION ?= $(shell test -e $(srcdir)/php-versions.json && cat $(srcdir)/php-versions.json | $(srcdir)/php-version.php $(PHP)) .PHONY: all php check clean reconf pecl ext test .SUFFIXES: @@ -44,7 +44,7 @@ reconf: check $(srcdir)/php-$(PHP_VERSION)/configure php: check $(bindir)/php $(srcdir)/php-versions.json: $(srcdir)/php-version.php - curl -Sso $@ http://php.net/releases/active.php + curl -Sso $@ "http://php.net/releases/index.php?json&version=5&max=-1" $(srcdir)/php-$(PHP_VERSION)/configure: | $(srcdir)/php-versions.json curl -Ss $(PHP_MIRROR)/php-$(PHP_VERSION).tar.bz2 | tar xj -C $(srcdir) @@ -92,6 +92,7 @@ pecl: pecl-check php $(extdir)/$(PECL_SONAME).so | $(PECL_INI) grep -q extension=$(PECL_SONAME).so $(PECL_INI) || echo extension=$(PECL_SONAME).so >> $(PECL_INI) ext: pecl-check $(srcdir)/pecl-$(PECL_EXTENSION) pecl + $(srcdir)/check-packagexml.php package.xml test: php REPORT_EXIT_STATUS=1 NO_INTERACTION=1 $(bindir)/php run-tests.php -p $(bindir)/php --show-diff tests 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); +} diff --git a/php-version.php b/php-version.php old mode 100644 new mode 100755 index 0df642e..593b579 --- a/php-version.php +++ b/php-version.php @@ -1,3 +1,4 @@ +#!/usr/bin/env php