Skip to content
This repository was archived by the owner on Aug 6, 2023. It is now read-only.
This repository was archived by the owner on Aug 6, 2023. It is now read-only.

install pecl/apc: constraint failed #60

Open

Description

@cweiske
$ ../inst/bin/pyrus-5.3.7 install pecl/apc
Pyrus version 2.0.0a3 SHA-1: BE7EA9D171AE3873F1BBAF692EEE9165BB14BD5D
Using PEAR installation found at /home/cweiske/php/phpfarm/inst/php-5.3.7/pear
Downloading pecl.php.net/APC

Connected...
Mime-type: application/octet-stream

PEAR2\Pyrus\Registry\Exception: Error: package pecl.php.net/APC could not be installed in registry: Unable to execute statement: constraint failed
 Exception: Unable to execute statement: constraint failed

Activity

  1. cweiske commented on Aug 19, 2011

    @cweiske
    ContributorAuthor

    I added some debug statements (pull please):

    Preparing SQL: 
                INSERT INTO configureoptions
                  (packages_name, packages_channel, name, prompt, defaultValue)
                VALUES(:name, :channel, :oname, :prompt, :default)
    Binding SQL parameter :name: apc
    Binding SQL parameter :channel: pecl.php.net
    Binding SQL parameter :oname: 
    Binding SQL parameter :prompt: 
    Binding SQL parameter :default: NULL
    
  2. cweiske commented on Aug 19, 2011

    @cweiske
    ContributorAuthor

    Prompt is NULL, but the SQL creation statement says it may not be null:

    Found matching configuration snapshot configsnapshot-2011-08-19 10-51-45.xml
    Preparing SQL: 
                INSERT INTO configureoptions
                  (packages_name, packages_channel, name, prompt, defaultValue)
                VALUES(:name, :channel, :oname, :prompt, :default)
    Binding SQL parameter :name: 'apc'
    Binding SQL parameter :channel: 'pecl.php.net'
    Binding SQL parameter :oname: NULL
    Binding SQL parameter :prompt: NULL
    Binding SQL parameter :default: NULL
    exception 'Exception' with message 'Unable to execute statement: constraint failed' in /home/cweiske/php/PEAR2_Pyrus/src/Pyrus/Registry/Sqlite3.php:223
    
  3. till commented on Nov 13, 2011

    @till
    Member

    I just ran into this too.

    What does 'prompt' refer to?

  4. fpoirotte commented on Nov 16, 2011

    @fpoirotte
    Member

    oname, prompt & default refer to the (PECL-specific) <configureoption> tag in package.xml.

    Eg. for APC, package.xml contains:

     <extsrcrelease>
      <configureoption default="no" name="enable-apc-debug" prompt="Enable internal debugging in APC" />
      <configureoption default="no" name="enable-apc-filehits" prompt="Enable per request file info about files used from the APC cache" />
      <configureoption default="no" name="enable-apc-spinlocks" prompt="Enable spin locks (EXPERIMENTAL)" />
      <configureoption default="no" name="enable-apc-memprotect" prompt="Enable memory protection (EXPERIMENTAL)" />
      <configureoption default="yes" name="enable-apc-pthreadmutex" prompt="Enable pthread mutexes (default)" />
      <configureoption default="no" name="enable-apc-pthreadrwlocks" prompt="Enable pthread read/write locks (EXPERIMENTAL)" />
     </extsrcrelease>
    

    I think the meaning of each parameter in the SQL query should be pretty clear now.

    AFAICT, I think this is triggered by \Pyrus\PackageFile\v2\Configureoption::current() which sets the name, default & prompt to null explicitely when one of them is missing...

  5. fpoirotte commented on Nov 18, 2011

    @fpoirotte
    Member

    ok, I managed to install APC by doing a few changes in \Pyrus\PackageFile\v2\Release::__get():

    -            if (!isset($this->info['configureoption'])) {
    -                $info = array();
    -            } else {
    -                $info = $this->info['configureoption'];
    -                if (!is_array($info) || !isset($info[0])) {
    -                    $info = array($info);
    +            $info = array();
    +            if (isset($this->info['configureoption']) &&
    +                is_array($this->info['configureoption'])) {
    +                foreach ($this->info['configureoption'] as $configureOption) {
    +                    if (isset($configureOption['attribs']))
    +                        $info[] = $configureOption['attribs'];
    +                    else
    +                        $info[] = $configureOption;
    

    For some reason, $this->info['configureoption'] receives a different structure during install and uninstall.

    During install, the structure is close to a SimpleXML tree, mapped into an array (eg. with an "attribs" key containing an array of XML attribute => XML value). This looks like this:

    $configureoptions = array(
      0 => array(
        "attribs" => array(
          "name" => "...",
          "default" => "...",
          "prompt" => "...",
        )
      ),
      // other options
    );
    

    During uninstall, the structure is simpler, there is no intermediary "attribs" sub-array:

    $configureoptions = array(
      0 => array(
        "name" => "...",
        "default" => "...",
        "prompt" => "...",
      ),
      // other options
    );
    

    Note: even after that change, APC won't build. I still need to investigate that.

  6. cweiske commented on Dec 3, 2013

    @cweiske
    ContributorAuthor

    Happes with pecl/memcache, too.

    Preparing SQL: 
                INSERT INTO configureoptions
                  (packages_name, packages_channel, name, prompt, defaultValue)
                VALUES(:name, :channel, :oname, :prompt, :default)
    Binding SQL parameter :name: 'memcache'
    Binding SQL parameter :channel: 'pecl.php.net'
    Binding SQL parameter :oname: NULL
    Binding SQL parameter :prompt: NULL
    Binding SQL parameter :default: NULL
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions