X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fpharext%2FTask%2FPeclFixup.php;h=33eb889c7900744e5350862a271f83cb26b6df29;hb=10c6f10181e75139992ba92b7185fe9a50b889b2;hp=08a1d942eaa7c7aabb5c078d67f46f81fa6420f1;hpb=861260c111bff72f60665393660b6f5375559510;p=pharext%2Fpharext diff --git a/src/pharext/Task/PeclFixup.php b/src/pharext/Task/PeclFixup.php index 08a1d94..33eb889 100644 --- a/src/pharext/Task/PeclFixup.php +++ b/src/pharext/Task/PeclFixup.php @@ -28,16 +28,25 @@ class PeclFixup implements Task * @throws \pahrext\Exception */ public function run($verbose = false) { + if ($verbose !== false) { + printf("Sanitizing PECL dir ...\n"); + } $dirs = glob("{$this->source}/*", GLOB_ONLYDIR); $files = array_diff(glob("{$this->source}/*"), $dirs); + $check = array_reduce($files, function($r, $v) { + return $v && fnmatch("package*.xml", basename($v)); + }, true); - if (count($dirs) !== 1 || !count($files)) { + if (count($dirs) !== 1 || !$check) { throw new Exception("Does not look like an extracted PECL dir: {$this->source}"); } $dest = current($dirs); foreach ($files as $file) { + if ($verbose) { + printf("Moving %s into %s ...\n", basename($file), basename($dest)); + } if (!rename($file, "$dest/" . basename($file))) { throw new Exception; }