FS#18709 - makepkg -q parameter

Attached to Project: Pacman
Opened by Albert Vaca Cintora (elvaka) - Tuesday, 16 March 2010, 15:53 GMT
Last edited by Allan McRae (Allan) - Tuesday, 16 March 2010, 21:50 GMT
Task Type Feature Request
Category makepkg
Status Assigned
Assigned To Allan McRae (Allan)
Eli Schwartz (eschwartz)
Architecture All
Severity Low
Priority Normal
Reported Version 3.3.3
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

I needed an option for makepkg similar to the make -q parameter, so I just added it.

-q or --question definition from make manual:
``Question mode''. Do not run any commands, or print anything; just return an exit status that is zero if the specified targets are already up to date, nonzero otherwise.

It's very useful for scripts!

Patch attached.
This task depends upon

Comment by Allan McRae (Allan) - Tuesday, 16 March 2010, 22:34 GMT
Any chance of a git patch on the current master branch?
Comment by Albert Vaca Cintora (elvaka) - Wednesday, 17 March 2010, 00:10 GMT
Where I can find the git repo URL?
Comment by Allan McRae (Allan) - Wednesday, 17 March 2010, 00:54 GMT Comment by Albert Vaca Cintora (elvaka) - Wednesday, 17 March 2010, 01:48 GMT
That should work.
Comment by Eli Schwartz (eschwartz) - Tuesday, 26 November 2019, 04:38 GMT
Current versions of makepkg already know how to exit 13 if some or all of the packages have been built. Admittedly, this does produce some output in the process. It will also try to run source extraction + prepare + pkgver, if there is a pkgver() function to run, since you cannot really robustly handle this otherwise.

Is there anything wrong with using this?

makepkg
if [ $? -eq 13 ]; then
echo "the package was already built"
fi

Failing that, makepkg --packagelist now lets you print a list of expected outputs, and is guaranteed to not run pkgver() and to produce no other output. You could iterate over these to see if they exist, and it's slightly more logic but actually fewer lines of bash:

while IFS= read -r line; do
[[ -f $line ]] || echo "not fully built"
done < <(makepkg --packagelist)
Comment by Eli Schwartz (eschwartz) - Tuesday, 26 November 2019, 04:42 GMT
That being said, it was easy so I've implemented this as a git-formatted patch on current master. No doc updates yet.

I'm not convinced we need to apply it, thereby depleting us of the -q short option if we ever wanted to use it for something else. Nine years later, it seems like there are better ways to accomplish the underlying goal.
Comment by Albert Vaca Cintora (elvaka) - Monday, 09 December 2019, 18:34 GMT
If there are other ways to achieve the same goal I think we shouldn't merge this. Also I no longer need it.

Feel free to close :)

Surprised to see 9 years have passed since this patch :D

Loading...