Pacman

Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.
Tasklist

FS#34056 - [pacman] Makepkg runs function twice

Attached to Project: Pacman
Opened by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 19:59 GMT
Last edited by Allan McRae (Allan) - Thursday, 28 February 2013, 12:25 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Makepkg seems to parse PKGBUILD twice. When inserting an echo function in a PKGBUILD, it is called twice (when it should only be called once). It is called before "Making package" and after "Entering fakeroot environment"


Additional info:
pacman 4.0.3-5


Steps to reproduce:
Write in an "echo" statement in a PKGBUILD. Attempt to build with PKGBUILD and notice the echo statement appears twice.
This task depends upon

Closed by  Allan McRae (Allan)
Thursday, 28 February 2013, 12:25 GMT
Reason for closing:  Not a bug
Comment by Daniel Wallace (gtmanfred) - Wednesday, 27 February 2013, 20:06 GMT
a pkgbuild this actually happens to would be usefull...
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:06 GMT
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:08 GMT
The function is "echo This is a statement" in this case.
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 20:09 GMT
And this is a problem because... ?

You should never need to rely on code that lives outside of a function.
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:12 GMT
Here's an example where I wrap it in a function...It has the same result.
Comment by Daniel Wallace (gtmanfred) - Wednesday, 27 February 2013, 20:12 GMT
but you are still calling the function outside of the predefined functions
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:15 GMT
Yeah, therein lies the problem. Why does makepkg run non-standard code twice? If I remove the call "dummy_echo", the function just doesn't run.
Comment by Daniel Wallace (gtmanfred) - Wednesday, 27 February 2013, 20:16 GMT
because it expects the users to follow the packaging guidelines?

and you shouldn't call these extra functions outside of build() prepare() or package() functions


https://wiki.archlinux.org/index.php/Arch_Packaging_Standards
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:20 GMT
I understand the guidelines, but it still seems like a glitch to me (makepkg running the same non-standard code twice).
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 20:25 GMT
Your opinion doesn't make this bug report useful. Presenting a valid use case where this legitimately breaks something, does.
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:38 GMT
Let's say as part of build process, some source code needs to be replaced (not patched, just replaced). Since all of this occurs before the build process, it is possible for the source code to be replaced twice.
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 20:44 GMT
Please provide a PKGBUILD. I have no idea what "replace the source code" means, or why you would need to do so.
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:48 GMT
Here's an example pkgbuild where I allow users to install additional language packs or help packs for libreoffice 4.0.
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 20:57 GMT
Yeah, let's not. Interactive PKGBUILDs are a totally braindead idea.
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 20:59 GMT
Why are they a braindead idea (since you said opinions don't matter)?
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 21:06 GMT
PKGBUILDs are meant to be a strict recipe. You run makepkg for a given input (a PKGBUILD) and get the same output (a package) every time. The packaging guidelines really should reflect this.

And as a user, I find it to be annoying as all hell.
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 21:08 GMT
I'll also add that there's nothing here you couldn't accomplish via split packages or stuffing your silly logic into the build function.
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 21:09 GMT
So how would you write a package that allows the user to install multiple language packs for libreoffice (other than creating dozens of PKGBUILDS).

And, how does this relate to the fact that makepkg runs non-standard functions in the PKGBUILD twice?
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 21:10 GMT
Build function occurs after source packages are downloaded. I did attempt such a method (using wget + tar) but ran into a fakeroot error.
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 21:19 GMT
> So how would you write a package that allows the user to install multiple language packs for libreoffice (other than creating dozens of PKGBUILDS).
With a split PKGBUILD. makepkg -i --pkg lang1,lang2,lang3

> And, how does this relate to the fact that makepkg runs non-standard functions in the PKGBUILD twice?
Let me be clear: The "bug" you're reporting is that makepkg sources the PKGBUILD twice. I really doubt this is "fixable".
Comment by Mark E. Lee (bluerider) - Wednesday, 27 February 2013, 21:32 GMT
I will look into split packaging, although I'm trying to reduce the lines of code and maintenance on my point (hence I don't want to write multiple package functions).

Is there a particular reason why makepkg sources the PKGBUILD twice?
Comment by Dave Reisner (falconindy) - Wednesday, 27 February 2013, 21:34 GMT
Because it necessarily re-execs itself to run under fakeroot.
Comment by Allan McRae (Allan) - Thursday, 28 February 2013, 12:24 GMT
OK... look at the prepare function in pacman-4.1. Does what you want and lets us keep resourcing the PKGBUILD so we have the pkgname etc variables under fakeroot.

Loading...