fix for bug #64343
[pharext/pharext] / src / pharext / Packager.php
index f5ccfb80848667d63c38e98a323f94a28dfe5d48..53fbca23bc498d67661a797f95cc3232d1ac84b3 100644 (file)
@@ -165,8 +165,15 @@ class Packager implements Command
         * @return string extracted directory
         */
        private function extract($source) {
-               $task = new Task\Extract($source);
-               $dest = $task->run($this->verbosity());
+               try {
+                       $task = new Task\Extract($source);
+                       $dest = $task->run($this->verbosity());
+               } catch (\Exception $e) {
+                       if (false === strpos($e->getMessage(), "checksum mismatch")) {
+                               throw $e;
+                       }
+                       $dest = (new Task\PaxFixup($source))->run($this->verbosity());
+               }
                
                $this->cleanup[] = new Task\Cleanup($dest);
                return $dest;
@@ -187,7 +194,7 @@ class Packager implements Command
                        $source = $this->extract($source);
                        $this->cleanup[] = new Task\Cleanup($source);
                        
-                       if ($this->args->pecl) {
+                       if (!$this->args->git) {
                                $source = (new Task\PeclFixup($source))->run($this->verbosity());
                        }
                }
@@ -208,6 +215,8 @@ class Packager implements Command
                                $this->source = new SourceDir\Git($source);
                        } elseif (is_file("$source/parext_package.php")) {
                                $this->source = include "$source/pharext_package.php";
+                       } else {
+                               $this->source = new SourceDir\Basic($source);
                        }
 
                        if (!$this->source instanceof SourceDir) {