Re: PEAR Channels guinea pig

From: Date: Tue, 11 May 2004 14:57:51 +0000
Subject: Re: PEAR Channels guinea pig
References: 1  Groups: php.pear.core 
Request: Send a blank email to pear-core+get-313@lists.php.net to get a copy of this message
Clay Loveless wrote:
I'm interested in setting up a test channel server ... Is there any additional/updated information available regarding PEAR channels other than this? http://www.phparch.com/mailinglists/msg.php?a=762609&s=&p=&g= I'm particularly interested in getting a channel server running, but haven't got the slightest clue of what I'll need to do to set one up. I've looked around in the pearweb CVS to find code for the main PEAR server, and haven't found anything yet. Perhaps I'm looking in the wrong place? In any event, I'd like to help out on this if I can ... -Clay
Hi, A channel server is basically a pearweb server. The server need not know the name of the channel in order to function properly. The functional pearweb code that implements the xmlrpc server is in pear-database.php, signatures.php, and xmlrpc.php in the pearweb/include/ folder. Obviously, this stuff is completely undocumented and also provides no way to verify whether your implementation fits the required API. This is one of the big tasks that will be required to make channels work. The bulk of the work will be in documenting exactly what the installer requires from an xmlrpc call for each instruction. This way, you can implement a subset of the required commands. In addition, there needs to be a standard set of test packages that every channel server must implement that can be used to automatically and remotely verify a channel's functionality. This will be very helpful for setting up a server, as you can test it for functionality before going public. A new xmlrpc command will be implemented that allows easy retrieval of server capabilities, so that there won't be odd error messages at the installer level, instead you'll see "this server can't do what you're asking." I have completed and regression tested the new PEAR_Registry, PEAR_Config, PEAR_ChannelFile (used to parse/handle channel.xml), and the next task is regression testing the PEAR_PackageFile (used to handle package.xml - have to make sure that PEAR_Common::infoFrom*() still works with existing unit tests and some more detailed ones). I started implementing channels in the PEAR_Downloader yesterday on the plane and in the airport, and that's making progress. The basic implementation is like so: apiVersion() is added to PEAR_Registry and PEAR_Config so that other packages will know if there is any change or addition to the method signature without any other verification steps. PEAR_Registry is 100% backwards compatible and passes the existing PEAR_Registry regression test. It implements channels by assuming all existing files were in the pear channel. This means the old directory structure was: PEAR/
     /.registry/
               /pkg1.reg
               /pkg2.reg
where pkg1 and pkg2 are PEAR packages. The new directory structure is: PEAR/
     /.registry/
               /pkg1.reg
               /pkg2.reg
               /.channel.newchannel/
                                   /pkg1.reg
                                   /otherpackage.reg
This represents the addition of newchannel::pkg1 and newchannel::otherpackage. Note that pkg1 is the same package name as PEAR::pkg1. In addition, a new independent channel registry is maintained containing the contents of channel.xml for each channel in a single file PEAR/.registry/.channels Each channel contains a name, a server (and in the future, mirrors), and a summary of what it is. There is support for sub-channels, but the implementation is primarily on the pearweb side, as sub-channels are required to have the same server currently. This is different than what I was suggesting happen before, implementation nightmares force it. The registry relies on a single file map. In other words, there may be no installation conflicts between any packages, regardless of channel origin. The PEAR_Config object adds two new variables, default_channel and channel_path. master_server is instantly obsoleted by channels, and is ignored by the installer, as all pearweb servers should be treated as channels now. Each channel can contain its own configuration. Installation directories may be different, username/password for access, different preferred_state, and so on. There are a few variables that are global and cannot be set for individual channels, such as default_channel. When retrieving a config variable, first the configuration for the default_channel is checked. If the variable is not set, then the configuration variable for the PEAR configuration is retrieved. In other words, the pear configuration is the default configuration for all channels unless you change it specifically for a channel. This could lead to problems, i.e. $ pear config-set default_channel test ....days/months later $ pear config-set php_dir /path/to/something So, when I implement the PEAR_Command side, I will add a warning $ pear config-set php_dir /path/to/something Warning: default channel is "test" - php_dir will only be changed for test channel The details of implementation are that a new hidden configuration variable is added named "__channels." It can be neither retrieved or set. __channels is an array containing configuration arrays indexed by channel name. The allowable channel names must be set with a call to PEAR_Config::setChannels(), as the registry is not connected directly to the configuration. PEAR_Remote is going to need to access the registry in order to retrieve the master_server, a big change from the current model, where it accesses PEAR_Config's master_server variable to determine where to query. Fortunately, it is easy to quickly set up a different master_server, just create a channel.xml file with all the details and pear add-channel it to the registry. The downloader needs a few new regexes, in order to check for channel::package[-version/state] in addition to package[-version/state] and so on. This is pretty easy to do. I'm trying to figure out how to set up a mock object method of testing PEAR_Downloader, so that other people can test it without a fully functional pearweb server. I think that this will be very important for the future stability. One issue that will need to be checked is unofficial packages. I.e., package PEAR::XX is distributed by unofficial channel YY as YY::XX. Once the package is downloaded, it is determined to be PEAR::XX from the package.xml. This will not be allowed, without --force. That's all for now. Greg

« previous php.pear.core (#313) next »