Re: Issue with PEAR_PackageFileManage2 1.0.2 and package.xml validation
| From: | Helgi Þormar Þorbjörnsson | Date: | Thu, 31 Mar 2011 12:19:01 +0000 |
| Subject: | Re: Issue with PEAR_PackageFileManage2 1.0.2 and package.xml validation | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-54196@lists.php.net to get a copy of this message | ||
I may have a solution for the issue, need to do a bit of work before I can investigate it further.
It is possible that the packagedirectory and related options are not keeping / at the end anymore,
hence it kinda working for you to add / but it looks like it is only related to the install-as
- Helgi
On 31 Mar 2011, at 13:16, Laurent Laville wrote:
> TAKE CARE: it's not a FIX . I've found horrible side effects.
>
> I'll keep continue to investigate.
>
> Sorry
>
>
> Le 31/03/2011 13:52, Laurent Laville a écrit :
>> As there is already a bug report related to this subject (
>> http://pear.php.net/bugs/bug.php?id=15534 ) I don't
>> see any reason to
>> open a new one .
>>
>> Have found a temporary solution to bypass the error validation. There is
>> also a description of issue, and probably a way to fix it.
>>
>> In my package script generator, I have with previous version code below
>>
>> $p2->generateContents();
>> $p2->addRelease();
>> $p2->setOSInstallCondition('windows');
>> $p2->addInstallAs('scripts/phpci.bat', 'phpci.bat');
>> $p2->addInstallAs('scripts/phpci', 'phpci');
>> $p2->addRelease();
>> $p2->addIgnoreToRelease('scripts/phpci.bat');
>> $p2->addInstallAs('scripts/phpci', 'phpci');
>>
>> I've changed it to
>>
>> $p2->generateContents();
>> $p2->addRelease();
>> $p2->setOSInstallCondition('windows');
>> $p2->addInstallAs('/scripts/phpci.bat', 'phpci.bat');
>> $p2->addInstallAs('/scripts/phpci', 'phpci');
>> $p2->addRelease();
>> $p2->addIgnoreToRelease('/scripts/phpci.bat');
>> $p2->addInstallAs('/scripts/phpci', 'phpci');
>>
>> NOTICE the slash in front of each script files
>>
>> While searching where the validation come from, I've seen that in
>>
>> PEAR\PackageFile\v2\Validator.php (rev 308729) lines 1029 to 1031 we
>> check and tag if file exist in contents
>>
>> foreach ($fcontents['dir']['file'] as $file) {
>> $filelist[$file['attribs']['name']] = true;
>> }
>>
>> But this array have as key - file name that all start with / slash
>> .... more ...
>> [/PHP/CompatInfo/Token/String.php] => 1
>> [/scripts/phpci] => 1
>> [/scripts/phpci.bat] => 1
>> [/tests/ClassTest.php] => 1
>> .... more ....
>>
>> But not in the array $list['install']
>>
>> [0] => Array
>> (
>> [attribs] => Array
>> (
>> [as] => phpci.bat
>> [name] => scripts/phpci.bat
>> )
>>
>> )
>>
>> [1] => Array
>> (
>> [attribs] => Array
>> (
>> [as] => phpci
>> [name] => scripts/phpci
>> )
>>
>> )
>>
>> )
>>
>> That is why it tagged it as _notInContents
>>
>> Hope it will help.
>>
>> Laurent
>>
>>
>> Le 31/03/2011 12:36, Helgi Þormar Þorbjörnsson a écrit :
>>> Much appreciated.
>>>
>>> This may be related to
>>> http://pear.php.net/bugs/bug.php?id=13310 and
>>> http://pear.php.net/bugs/bug.php?id=15534 but they are
>>> more likely
>>> than not a bug in the CLI code, the part that manipulates scripts and
>>> install-as tags.
>>>
>>> One thing that comes to mind is that I added 'scripts' =>
>>> 'script',
>>> dir->role mapping at the top; It may be having a bigger knock on
>>> effect than I anticipated.
>>>
>>> - Helgi
>>>
>>> On 31 Mar 2011, at 11:29, Laurent Laville wrote:
>>>
>>>> Ok, no problem.
>>>>
>>>> I'll open a bug report, and try to see if I can find something. I've
>>>> some free time this afternoon.
>>>>
>>>> Later
>>>> Laurent
>>>>
>>>> Le 31/03/2011 12:22, Helgi Þormar Þorbjörnsson a écrit :
>>>>> Hi,
>>>>>
>>>>> Thanks for taking the time writing this up. Could you please file a
>>>>> bug report as that is easier to track.
>>>>>
>>>>> Off the top of my head, I don't know what it is but I am still at
>>>>> work and don't have time to look at it yet.
>>>>>
>>>>> - Helgi
>>>>>
>>>>> On 31 Mar 2011, at 11:17, Laurent Laville wrote:
>>>>>
>>>>>> Hello Helgi,
>>>>>>
>>>>>> I've just installed the new version 1.0.2 (with its plugins
>>>>>> package) of PEAR_PackageFileManager2 on my local windows platform.
>>>>>>
>>>>>> PEAR 1.9.2, PHP 5.2.17, Windows XP
>>>>>>
>>>>>> And I got a Package Validation error, while it was not the cas in
>>>>>> previous version 1.0.1
>>>>>>
>>>>>>
>>>>>> PEAR_PackageFileManager2 Error: Package validation failed:
>>>>>> Error:<ignore name="scripts/phpci.bat"> is invalid, file is
>>>>>> not
>>>>>> in<contents>
>>>>>> Error:<install name="scripts/phpci"> is invalid, file is
>>>>>> not
>>>>>> in<contents>
>>>>>> Error:<install name="scripts/phpci"> is invalid, file is
>>>>>> not
>>>>>> in<contents>
>>>>>> Error:<install name="scripts/phpci.bat"> is invalid, file
>>>>>> is not
>>>>>> in<contents>
>>>>>>
>>>>>> See my package.xml online at [1]
>>>>>>
>>>>>> I used a PHP script that generate the package.xml.
>>>>>> Something standard. Here is a chunk of code ...
>>>>>>
>>>>>> <code>
>>>>>> require_once 'PEAR/PackageFileManager2.php';
>>>>>>
>>>>>> PEAR::setErrorHandling(PEAR_ERROR_DIE);
>>>>>>
>>>>>> $p2 = new PEAR_PackageFileManager2();
>>>>>> $p2->setOptions(
>>>>>> array(
>>>>>> 'packagedirectory' => dirname(__FILE__),
>>>>>> 'baseinstalldir' => 'Bartlett',
>>>>>> 'filelistgenerator' => 'file',
>>>>>> 'simpleoutput' => true,
>>>>>> 'clearcontents' => false,
>>>>>> 'changelogoldtonew' => false,
>>>>>> 'ignore' => array(
>>>>>> basename(__FILE__),
>>>>>> '*.tgz', '*.log',
>>>>>> 'Thumbs.db', 'packageRC*.xml',
>>>>>> 'makephpci.php',
>>>>>> '_extension.php',
>>>>>> 'phpcompatinfo.xml',
>>>>>> ),
>>>>>> 'exceptions' => array(
>>>>>> 'phpcompatinfo.xml.dist' => 'cfg',
>>>>>> 'scripts/phpci' => 'script',
>>>>>> 'scripts/phpci.bat' => 'script',
>>>>>> 'README.markdown' => 'doc',
>>>>>> 'LICENSE' => 'doc',
>>>>>> 'HOWTO.txt' => 'doc',
>>>>>> ),
>>>>>> 'installexceptions' => array(
>>>>>> 'phpcompatinfo.xml.dist' => '',
>>>>>> 'scripts/phpci' => '',
>>>>>> 'scripts/phpci.bat' => '',
>>>>>> ),
>>>>>> )
>>>>>> );
>>>>>> // ... more
>>>>>>
>>>>>> $p2->generateContents();
>>>>>> $p2->addRelease();
>>>>>> $p2->setOSInstallCondition('windows');
>>>>>> $p2->addInstallAs('scripts/phpci.bat', 'phpci.bat');
>>>>>> $p2->addInstallAs('scripts/phpci', 'phpci');
>>>>>> $p2->addRelease();
>>>>>> $p2->addIgnoreToRelease('scripts/phpci.bat');
>>>>>> $p2->addInstallAs('scripts/phpci', 'phpci');
>>>>>>
>>>>>> $p2->writePackageFile();
>>>>>>
>>>>>> </code>
>>>>>>
>>>>>>
>>>>>> If you don't know what it could be, I'll try to investigate
>>>>>> later.
>>>>>>
>>>>>> Laurent
>>>>>>
>>>>>> [1]
>>>>>>
>>>>>> https://github.com/llaville/php-compat-info/blob/master/package.xml
>>>>>
>>>
>>>
>>
>