1<?php 2$peardir = 'C:\devel\pear_with_channels'; 3$xmlrpcdir = 'C:\php5\pear\XML'; 4 5require_once $peardir . DIRECTORY_SEPARATOR . 'go-pear-list.php'; 6foreach ($packages as $package => $ver) { 7 $packages[$package] = "$package-$ver"; 8} 9require_once 'PEAR/PackageFile.php'; 10require_once 'PEAR/Config.php'; 11require_once 'PEAR/Downloader.php'; 12require_once 'PEAR/Installer.php'; 13require_once 'PEAR/Frontend.php'; 14require_once 'PHP/Archive/Creator.php'; 15$config = &PEAR_Config::singleton(); 16$ui = &PEAR_Frontend::singleton('PEAR_Frontend_CLI'); 17 18$dl = &new PEAR_Downloader($ui, array('downloadonly' => true, 'nodeps' => true, 19 'nocompress' => true), $config); 20$dl->setDownloadDir(dirname(__FILE__) . '/go-pear-tarballs'); 21$res = &$dl->download(array_values($packages)); 22 23$pkg = &new PEAR_PackageFile($config); 24$pf = $pkg->fromPackageFile($peardir . DIRECTORY_SEPARATOR . 'package2.xml', PEAR_VALIDATE_NORMAL); 25$pearver = $pf->getVersion(); 26 27$creator = new PHP_Archive_Creator('index.php', true); 28foreach ($packages as $package => $name) { 29 $creator->addFile("$name.tgz", "packages/$name.tgz"); 30 @unlink("$name.tgz"); 31} 32$commandcontents = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pearindex.php'); 33$commandcontents = str_replace('@PEARVER@', $pearver, $commandcontents); 34$creator->addString($commandcontents, 'index.php'); 35 36$commandcontents = file_get_contents($peardir . DIRECTORY_SEPARATOR . 'PEAR' . 37 DIRECTORY_SEPARATOR . 'Command.php'); 38$commandcontents = str_replace( 39 array( 40 "require_once '", 41 "include_once '", 42 ), 43 array( 44 "require_once 'phar://PEAR.phar/", 45 "include_once 'phar://PEAR.phar/", 46 ), 47 $commandcontents); 48$creator->addString($commandcontents, 'PEAR/Command.php'); 49 50$commandcontents = file_get_contents($peardir . DIRECTORY_SEPARATOR . 'PEAR' . 51 DIRECTORY_SEPARATOR . 'PackageFile' . DIRECTORY_SEPARATOR . 'v2.php'); 52$commandcontents = str_replace( 53 array( 54 "require_once '", 55 "include_once '", 56 "include_once \"PEAR/Task/\$task.php", 57 ), 58 array( 59 "require_once 'phar://PEAR.phar/", 60 "include_once 'phar://PEAR.phar/", 61 "include_once \"phar://PEAR.phar/PEAR/Task/\$task.php", 62 ), 63 $commandcontents); 64$creator->addString($commandcontents, 'PEAR/PackageFile/v2.php'); 65 66$commandcontents = file_get_contents($peardir . DIRECTORY_SEPARATOR . 'PEAR' . 67 DIRECTORY_SEPARATOR . 'Frontend.php'); 68$commandcontents = str_replace( 69 array( 70 "include_once ", 71 'PEAR_Frontend::isIncludeable($file)', 72 ), 73 array( 74 "include_once 'phar://PEAR.phar/' . ", 75 'true', 76 ), 77 $commandcontents); 78$creator->addString($commandcontents, 'PEAR/Frontend.php'); 79 80$commandcontents = file_get_contents($peardir . DIRECTORY_SEPARATOR . 'PEAR' . 81 DIRECTORY_SEPARATOR . 'Downloader' . DIRECTORY_SEPARATOR . 'Package.php'); 82$commandcontents = str_replace( 83 array( 84 "require_once '", 85 "include_once '", 86 "@PEAR-VER@", 87 ), 88 array( 89 "require_once 'phar://PEAR.phar/", 90 "include_once 'phar://PEAR.phar/", 91 $pearver, 92 ), 93 $commandcontents); 94$creator->addString($commandcontents, 'PEAR/Downloader/Package.php'); 95 96$commandcontents = file_get_contents($peardir . DIRECTORY_SEPARATOR . 'PEAR' . 97 DIRECTORY_SEPARATOR . 'PackageFile' . DIRECTORY_SEPARATOR . 'Generator' . 98 DIRECTORY_SEPARATOR . 'v1.php'); 99$commandcontents = str_replace( 100 array( 101 "require_once '", 102 "include_once '", 103 "@PEAR-VER@", 104 ), 105 array( 106 "require_once 'phar://PEAR.phar/", 107 "include_once 'phar://PEAR.phar/", 108 $pearver, 109 ), 110 $commandcontents); 111$creator->addString($commandcontents, 'PEAR/PackageFile/Generator/v1.php'); 112 113$commandcontents = file_get_contents($peardir . DIRECTORY_SEPARATOR . 'PEAR' . 114 DIRECTORY_SEPARATOR . 'Dependency2.php'); 115$commandcontents = str_replace( 116 array( 117 "require_once '", 118 "include_once '", 119 "@PEAR-VER@", 120 ), 121 array( 122 "require_once 'phar://PEAR.phar/", 123 "include_once 'phar://PEAR.phar/", 124 $pearver, 125 ), 126 $commandcontents); 127$creator->addString($commandcontents, 'PEAR/Dependency2.php'); 128 129$commandcontents = file_get_contents($peardir . DIRECTORY_SEPARATOR . 'PEAR' . 130 DIRECTORY_SEPARATOR . 'PackageFile.php'); 131$commandcontents = str_replace( 132 array( 133 "require_once '", 134 "include_once '", 135 "@PEAR-VER@", 136 ), 137 array( 138 "require_once 'phar://PEAR.phar/", 139 "include_once 'phar://PEAR.phar/", 140 $pearver, 141 ), 142 $commandcontents); 143$creator->addString($commandcontents, 'PEAR/PackageFile.php'); 144 145$creator->addFile($xmlrpcdir . DIRECTORY_SEPARATOR . 'RPC.php', 'XML/RPC.php', true); 146$creator->addDir($peardir, array('tests/', 147 'scripts/', 148 '*PEAR/Command.php', 149 '*PEAR/Dependency2.php', 150 '*PEAR/PackageFile/Generator/v1.php', 151 '*PEAR/PackageFile/Generator/v2.php', 152 '*PEAR/PackageFile/v2.php', 153 '*PEAR/PackageFile.php', 154 '*PEAR/Downloader/Package.php', 155 '*PEAR/Frontend.php'), 156 array( 157 '*PEAR/ChannelFile/Parser.php', 158 '*PEAR/Command/Install-init.php', 159 '*PEAR/Command/Install.php', 160 '*PEAR/Downloader/Package.php', 161 '*PEAR/Frontend/CLI.php', 162 '*PEAR/Installer/Role.php', 163 '*PEAR/Installer/Role/Common.php', 164 '*PEAR/Installer/Role/Data.php', 165 '*PEAR/Installer/Role/Doc.php', 166 '*PEAR/Installer/Role/Php.php', 167 '*PEAR/Installer/Role/Script.php', 168 '*PEAR/Installer/Role/Test.php', 169 '*PEAR/PackageFile/v1.php', 170 '*PEAR/PackageFile/v2.php', 171 '*PEAR/PackageFile/Parser/v1.php', 172 '*PEAR/PackageFile/Parser/v2.php', 173 '*PEAR/PackageFile/Generator/v1.php', 174 '*PEAR/Task/Common.php', 175 '*PEAR/Task/Replace.php', 176 '*PEAR/Task/Windowseol.php', 177 '*PEAR/Task/Unixeol.php', 178 '*PEAR/Validator/PECL.php', 179 '*PEAR/ChannelFile.php', 180 '*PEAR/Command.php', 181 '*PEAR/Common.php', 182 '*PEAR/Config.php', 183 '*PEAR/Dependency2.php', 184 '*PEAR/DependencyDB.php', 185 '*PEAR/Downloader.php', 186 '*PEAR/ErrorStack.php', 187 '*PEAR/Frontend.php', 188 '*PEAR/Installer.php', 189 '*PEAR/PackageFile.php', 190 '*PEAR/Registry.php', 191 '*PEAR/Remote.php', 192 '*PEAR/Start.php', 193 '*PEAR/Validate.php', 194 '*PEAR/XMLParser.php', 195 'PEAR.php', 196 'go-pear-phar.php', 197 '*OS/Guess.php', 198 '*Archive/Tar.php', 199 '*Console/Getopt.php', 200 'System.php', 201 ), 'PEAR.phar'); 202$creator->savePhar(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'go-pear.phar'); 203?>