Page MenuHomePhabricator

CI should validate that the pecl tarball contains all the necessary files to build the extension
Open, Needs TriagePublic

Description

Would've caught https://gerrit.wikimedia.org/r/c/mediawiki/php/luasandbox/+/668257/

Just needs to run pecl install package.xml if that file exists.

Event Timeline

Change 668259 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[integration/config@master] Have php*-compile images test pecl installation

https://gerrit.wikimedia.org/r/668259

Change 668259 merged by jenkins-bot:
[integration/config@master] Have php*-compile images test pecl installation

https://gerrit.wikimedia.org/r/668259

00:52:26 + pecl install package.xml
00:52:26 Cannot install, php_dir for channel "pecl.php.net" is not writeable by the current user

From pecl help install

...
  -R DIR, --installroot=DIR
        root directory used when installing files (ala PHP's INSTALL_ROOT), use packagingroot for RPM
  -P DIR, --packagingroot=DIR
        root directory used when packaging files, like RPM packaging

probably need to set one of those to a writable directory.

There are a few more settings that needed adjustment:

pecl config-set ext_dir /tmp
pecl config-set php_dir /tmp

(note that you need a writable home dir to create a ~/.pearrc)

but even that wasn't sufficient with pecl install -R /tmp LuaSandbox-4.0.1.tgz

...
Installing '/usr/lib/php/20180731/luasandbox.so'
ERROR: failed to write /usr/lib/php/20180731/luasandbox.so (copy(/usr/lib/php/20180731/luasandbox.so): failed to open stream: Permission denied)

Al the php*compile Docker images had to be rebuild due to T291425: Rebuild CI images affected by OpenSSL compat issue with new Let's Encrypt issuance chain.

I haven't updated jobs to the new image since they are using old version of it before https://gerrit.wikimedia.org/r/c/integration/config/+/668259. It added to the entrypoint:

if [ -f "package.xml" ]; then
    pecl install package.xml
fi

Which seems to cause troubles. So maybe that should be feature flagged so we can keep using the latest images?

pecl install [channel/]<package> defaults to pecl.php.net channel and its configuration. For directories:

$ pecl config-show|grep dir
PEAR executables directory     bin_dir          /usr/bin
PEAR documentation directory   doc_dir          /usr/share/php/docs
PHP extension directory        ext_dir          /usr/lib/php/20190902
PEAR directory                 php_dir          /usr/share/php
PEAR Installer cache directory cache_dir        /tmp/pear/cache
PEAR configuration file        cfg_dir          /usr/share/php/cfg
directory
PEAR data directory            data_dir         /usr/share/php/data
PEAR Installer download        download_dir     /tmp/pear/download
directory
Systems manpage files          man_dir          /usr/share/man
directory
PEAR metadata directory        metadata_dir     <not set>
PEAR Installer temp directory  temp_dir         /tmp/pear/temp
PEAR test directory            test_dir         /usr/share/php/tests
PEAR www files directory       www_dir          /usr/share/php/www
Signature Key Directory        sig_keydir       /etc/pear/pearkeys

I went trying to overrides some directories and adding -P (packaging root):

pecl -d php_dir=target/php -d doc_dir=target/docs -d test_dir=target/tests -d ext_dir=target/extension install -P target/root ./package.xml

But that eventually fails:

Notice: Undefined index: user in PEAR/Config.php on line 1628
PHP Notice:  Undefined index: user in /usr/share/php/PEAR/Config.php on line 1628

Notice: Undefined index: user in PEAR/Config.php on line 1628
PHP Notice:  Undefined index: user in /usr/share/php/PEAR/Config.php on line 1628
18 source files, building
ERROR: could not chdir to /tmp/pear/temp/LuaSandbox

Al the php*compile Docker images had to be rebuild due to T291425: Rebuild CI images affected by OpenSSL compat issue with new Let's Encrypt issuance chain.

I haven't updated jobs to the new image since they are using old version of it before https://gerrit.wikimedia.org/r/c/integration/config/+/668259. It added to the entrypoint:

if [ -f "package.xml" ]; then
    pecl install package.xml
fi

Which seems to cause troubles. So maybe that should be feature flagged so we can keep using the latest images?

Sorry, yeah, I should've reverted that after it didn't work.

Change 734395 had a related patch set uploaded (by Jforrester; author: Legoktm):

[integration/config@master] Revert \"Have php*-compile images test pecl installation\"

https://gerrit.wikimedia.org/r/734395

Change 734395 merged by jenkins-bot:

[integration/config@master] Revert \"Have php*-compile images test pecl installation\"

https://gerrit.wikimedia.org/r/734395