如何通过文件标签删除 package.xml 中的路径?
我正在尝试简化我的 package.xml
文件,因为它包含许多内容
<phprelease>
<filelist>
<install as="path/to/my/Class.php" name="classes/path/to/my/Class.php" />
<!-- Many more of this -->
</filelist>
</phprelease>
根据手动,应该可以通过使用 baseinstalldir
属性来去除相对路径,但它要么(一种)被忽略,要么导致奇怪的路径名。例如,
<dir name="/">
<dir name="classes">
<file baseinstalldir="/path/to/my" name="path/to/my/Class.php" role="php" />
</dir>
</dir>
将文件安装到path/to/my/classes/path/to/my/Class.php中,这显然是垃圾。
有谁知道一种从路径中删除一个文件夹的解决方案,不需要一大堆 install-as
元素?
更新:
看起来,pear 打包程序在将其放入包之前重写了 package.xml
。它执行的步骤之一是展平 contents
部分。
<dir name="/">
<dir name="classes">
<file baseinstalldir="/path/to/my" name="path/to/my/Class.php" role="php" />
</dir>
</dir>
安装程序将
<dir name="/">
<file baseinstalldir="/path/to/my" name="classses/path/to/my/Class.php" role="php" />
</dir>
其解析为 path/to/my/classes/path/to/my/Class.php
当然...
Im trying to simplify my package.xml
file, because it contains many of this
<phprelease>
<filelist>
<install as="path/to/my/Class.php" name="classes/path/to/my/Class.php" />
<!-- Many more of this -->
</filelist>
</phprelease>
According the Manual, it should be possible, to strip relative paths by using the baseinstalldir
-attribute, but its either (a kind of) ignored, or leads to curious pathnames. For example
<dir name="/">
<dir name="classes">
<file baseinstalldir="/path/to/my" name="path/to/my/Class.php" role="php" />
</dir>
</dir>
installs the file into path/to/my/classes/path/to/my/Class.php
, that is obvious crap.
Does anyone knows a solution to strip one folder from the path, that does not require a big bunch of install-as
-elements?
Update:
It seems, that the pear packager rewrites package.xml
, before it puts it into the package. One of the steps it performs is, that it flattens the contents
-section.
<dir name="/">
<dir name="classes">
<file baseinstalldir="/path/to/my" name="path/to/my/Class.php" role="php" />
</dir>
</dir>
becomes
<dir name="/">
<file baseinstalldir="/path/to/my" name="classses/path/to/my/Class.php" role="php" />
</dir>
The installer resolve this to path/to/my/classes/path/to/my/Class.php
of course...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PEAR 不支持您想要的内容(即
package.xml
v2.0)。Pyrus 支持
package.xml
v2.1行为完全符合您的预期。PEAR does not support what you want (that is,
package.xml
v2.0).Pyrus supports
package.xml
v2.1 which behaves exactly as you expect it.