phive icon indicating copy to clipboard operation
phive copied to clipboard

Symlink gets overwritten when PHAR is installed twice from different sources

Open sebastianheuer opened this issue 9 years ago • 3 comments
trafficstars

$ phive install phpab
(...)
Linking phpab-1.20.0.phar to /Users/sebastian/projects/php/phive/tools/phpab

leads to the following phive.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
  <phar name="phpab" version="*" installed="1.20.0" location="./tools/phpab"/>
</phive>

Installing phpab from GitHub afterwards:

$ phive install theseer/autoload
(...)
Linking phpab-1.22.0.phar to /Users/sebastian/projects/php/phive/tools/phpab

now the original phpab symlink has been overwritten, and phive.xml contains both entries:

<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
  <phar name="phpab" version="*" installed="1.20.0" location="./tools/phpab"/>
  <phar name="theseer/autoload" version="*" installed="1.22.0" location="./tools/phpab"/>
</phive>

sebastianheuer avatar Sep 17 '16 10:09 sebastianheuer

Plan of attack (not complete):

  • refactor phive.xml:
    • add "method" attribute to phar nodes ("github", "alias", "url")
    • add child node to phar nodes containing source information for the method (alias name, repository url, ...)
    • phar name will be determined by the resolver, alias is only used in source information

sebastianheuer avatar Oct 14 '16 19:10 sebastianheuer

Be careful with that. Subnodes in XML should not depend on the value of an attribute in the parent node.

ThomasWeinert avatar Aug 24 '17 20:08 ThomasWeinert

Blocked by #109

sebastianheuer avatar Aug 26 '17 12:08 sebastianheuer