Huzo
Huzo

Reputation: 1692

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

==> ERROR: PKGBUILD does not exist.

But when I change my current directory to the directory of PKGBUILD file, cd package_name, and run makepkg PKGBUILD I face no problems. So, is it true that I have to strictly be in the PKGBUILD file's directory to be able to call makepkgon it?

Thanks

Upvotes: 0

Views: 2377

Answers (2)

eschwartz
eschwartz

Reputation: 323

The command makepkg PKGBUILD does not do what you think it does. makepkg does not accept the name of a PKGBUILD as a positional parameter, and it completely discards this entirely.

As per the manpage, if you wish to specify a PKGBUILD to use, you must use the -p <buildscript> option. Also as per the manpage, "The buildscript must be located in the directory makepkg is called from."

$ 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.

Upvotes: 1

Harald Nordgren
Harald Nordgren

Reputation: 12381

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.

Upvotes: 1

Related Questions