show package info
[pharext/replicator.pharext.org] / bin / pecl+sig
index 33e44d20ced6d1ae3f966425006a72b1ae8807cc..dd3de50e7ef534598c06798e1e26d0e0524ba911 100755 (executable)
@@ -24,12 +24,19 @@ function fail($pkg, $ver, $skp, $fmt) {
 }
 
 function sign($pkg, $ext) {
-       $fmt = "%s/bin/%s-sign %s %s";
+       $fmt = "%s/%s-sign %s %s";
        foreach (["rsa", "gpg"] as $sig) {
                passthru(sprintf($fmt, __DIR__, $sig, $pkg, $ext));
        }
 }
 
+function info($pkg, $dir) {
+       $inf = file_get_contents("https://pecl.php.net/rest/p/$pkg/info.xml");
+       if ($inf) {
+               file_put_contents("$dir/info.xml", $inf);
+       }
+}
+
 function wait(&$pids) {
        $status = null;
        switch ($pid = pcntl_wait($status)) {
@@ -70,11 +77,10 @@ function work($url, $dir) {
        ]);
 };
 
-if (($sxe = simplexml_load_file("http://pecl.php.net/feeds/$what.rss"))) {
+if (($sxe = simplexml_load_file("https://pecl.php.net/feeds/$what.rss"))) {
        foreach ($sxe->item as $item) {
-               $url = (string) $item->link;
-               $pkg = basename(dirname($url));
-               $ver = basename($url);
+               list($pkg, $ver) = explode(" ", (string) $item->title);
+               $url = sprintf("https://pecl.php.net/get/%s/%s", $pkg, $ver);
                $skp = sprintf("%s/../skip/%s/%s", __DIR__, $pkg, $ver);
                $ext = sprintf("%s/../public/phars/%s/%s-%s.ext.phar", __DIR__, $pkg, $pkg, $ver);
                $dir = dirname($ext);
@@ -85,6 +91,7 @@ if (($sxe = simplexml_load_file("http://pecl.php.net/feeds/$what.rss"))) {
                                        exit;
                                case 0:
                                        work($url, $dir);
+                                       info($pkg, $dir);
                                        exit;
                                default:
                                        $pids[$pid] = compact("url", "pkg", "ver", "skp", "ext", "dir");