FS#3244 - pacman wishlist (4/4): Declaration of post_install() and friends inside PKGBUILDs
Attached to Project:
Pacman
Opened by Mark Rosenstand (mrose) - Wednesday, 28 September 2005, 00:09 GMT
Last edited by Xavier (shining) - Thursday, 24 July 2008, 12:19 GMT
Opened by Mark Rosenstand (mrose) - Wednesday, 28 September 2005, 00:09 GMT
Last edited by Xavier (shining) - Thursday, 24 July 2008, 12:19 GMT
|
Details
It seems silly that you're declaring a build() function but
need an external
file to declare other basic functions. I do realize that it's easier to include the file with install time functions in the tarball, but it shouldn't be too hard to extract them from the PKGBUILD and then include. It's also silly that you have to write the same three lines at the buttom of every single install-file. |
This task depends upon
If the file exists, it gets included. What do you think?
Perhaps we could clean up the way install files actually work though...
echo $FUNCTION(post_install) > install #made up syntax
This would become elegant. As it is now, there are two solutions, both of which seem goofy to me:
1) use complex regex / perl / python to strip the functions from the PKGBUILD, and spit them out to a file
2) include the PKGBUILD inside the package and use bash script, making sure to define all variables like $startdir beforehand so that it doesn't bail out on syntax errors.
Both seem hackish.
I would be more interested in creating say, a helper script for running install scriptlets, that pacman itself can call, removing some of the goofy framing logic (only a few lines anyway) from the scriptlets
Ah, my bad, I totally forgot that PKGBUILDs are not included in binary packages. Shame on me. :)
1) can be simplyfied, for example
build() {
. . .
}
#---
post_install() {
}
We can just split the rest of file after #--- to .INSTALL
But then, integrating post_install & friends into PKGBUILD will not improve things much, IMHO.
Anyway templating .install files could be done with something like install=$templates/xcursor.install line in PKGBUILD, so with integrating post_install stuff into PKGBUILD there will still be install= option.
patch proposed by molok :
http://www.archlinux.org/pipermail/pacman-dev/2007-September/009264.html
last discussion about it :
http://www.archlinux.org/pipermail/pacman-dev/2008-January/010977.html
About the second issue, you don't need "the same three lines at the bottom of every single install-file" anymore :
http://projects.archlinux.org/git/?p=pacman.git;a=commit;h=565d2eeed5fdd85b516cbc76bc48be439e42c41f
>echo $FUNCTION(post_install) > install #made up syntax
Would it work to parse the output from "type"? I'm not sure how that would work, as I'm not familiar with makepkg internels, but:
daenyth@Muspelheimr ~ $ cat testtype.bash
#!/bin/bash
function dummy() { echo "I am a dummy function"; }
type dummy
daenyth@Muspelheimr ~ $ bash testtype.bash
dummy is a function
dummy ()
{
echo "I am a dummy function"
}
> file to declare other basic functions. I do realize that it's easier to
> include the file with install time functions in the tarball, but it
> shouldn't be too hard to extract them from the PKGBUILD and then include.
We still need that external file in the end, so it is more simple to always create it in the first place.
> It's also silly that you have to write the same three lines at the buttom
> of every single install-file.
This is no longer the case.