简体   繁体   English

从外部目录调用makepkg

[英]Calling makepkg from an outer directory

I realized that when I try to call makepkg command on a PKGBUILD in an inner file, for instance makepkg package_name/PKGBUILD , I get an error saying 我意识到,当我尝试在内部文件中的PKGBUILD上调用makepkg命令时,例如makepkg package_name/PKGBUILD ,我收到一条错误消息:

==> ERROR: PKGBUILD does not exist. ==>错误:PKGBUILD不存在。

But when I change my current directory to the directory of PKGBUILD file, cd package_name , and run makepkg PKGBUILD I face no problems. 但是,当我将当前目录更改为PKGBUILD文件的目录cd package_name并运行makepkg PKGBUILD我不会遇到任何问题。 So, is it true that I have to strictly be in the PKGBUILD file's directory to be able to call makepkg on it? 因此,是否确实必须严格位于PKGBUILD文件的目录中才能调用makepkg

Thanks 谢谢

Seems that way. 好像是这样。 If you are scripting this and want to avoid switching folders back and forth, an option can be to utilize a sub-shell like this 如果您正在编写脚本并希望避免来回切换文件夹,则可以选择使用像这样的子外壳

(cd package_name && makepkg PKGBUILD)

which will then transport you back to current folder after finishing the actions within the parentheses. 完成括号中的操作后,它将把您带回到当前文件夹。

The command makepkg PKGBUILD does not do what you think it does. 命令makepkg PKGBUILD不会执行您认为的操作。 makepkg does not accept the name of a PKGBUILD as a positional parameter, and it completely discards this entirely. makepkg 接受PKGBUILD作为位置参数的名称,它彻底抛弃这个完全。

As per the manpage, if you wish to specify a PKGBUILD to use, you must use the -p <buildscript> option. 根据联机帮助页,如果希望指定要使用的PKGBUILD,则必须使用-p <buildscript>选项。 Also as per the manpage, "The buildscript must be located in the directory makepkg is called from." 同样按照手册页,“构建脚本必须位于调用它的目录makepkg中。”

$ makepkg -p package_name/PKGBUILD
==> ERROR: package_name/PKGBUILD must be in the current working directory.

As you can see, makepkg contains code to ensure you don't try doing something which it does not allow you to do -- but you must correctly use the makepkg command-line options in order for makepkg to recognize what you're trying to do and tell you what you did wrong. 如您所见,makepkg包含代码,以确保您不会尝试做它不允许做的事情-但您必须正确使用makepkg命令行选项,以使makepkg能够识别要尝试的操作并告诉您您做错了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM