fix signing
[pharext/replicator.pharext.org] / bin / pecl+sig
index 4ce3e2feaa353ac18c3b7fcd04cf65170fa1cf32..7c6b9af7ec5acb99b86aee0e3332d4a28aff458c 100755 (executable)
@@ -24,9 +24,19 @@ function fail($pkg, $ver, $skp, $fmt) {
 }
 
 function sign($pkg, $ext) {
-       $fmt = "%s/%s-sign %s %s";
+       $fmt = "%s/%s-sign %s %s%s";
        foreach (["rsa", "gpg"] as $sig) {
-               passthru(sprintf($fmt, __DIR__, $sig, $pkg, $ext));
+               foreach (["", ".gz", ".bz2"] as $typ) {
+                       passthru(sprintf($fmt, __DIR__, $sig, $pkg, $ext, $typ));
+               }
+       }
+}
+
+function info($pkg, $dir) {
+       $pkg = strtolower($pkg);
+       $inf = file_get_contents("https://pecl.php.net/rest/p/$pkg/info.xml");
+       if ($inf) {
+               file_put_contents("$dir/info.xml", $inf);
        }
 }
 
@@ -70,11 +80,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 +94,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");