[pacman-dev] Fwd: [makepkg patch - generate .SRCINFO file when running "--source"]

vlad vla at uni-bonn.de
Wed Aug 4 07:41:53 EDT 2010

On Wed, Aug 04, 2010 at 01:27:43PM +1000, Allan McRae wrote:
> Overall, I am quite happy with this idea.  Obviously we could tidy
> up the implementation a bit at a later stage.
> First I think we need to get the formatting issues sorted, as once
> the format is set, it becomes very difficult to change.
It is just a start.

> >Note that "packager" defaults to the person who actually build the
> >source archive. Perhaps this has to be changed to AUR user name, not to
> >the makepkg.conf PACKAGER entry.
> Pacman and makepkg are distribution agnostic so the user would have
> to change the PACKAGER entry if it was deemed necessary to match the
> AUR username (which it should not have to...).
I think the "packager" should be the maintainer. I see no problem
therein. This can be simply overriden with "PACKAGER="" ; makepkg

> >A possible one is to restrict the way architecture specific variables
> >are written to PKGBUILDs; perhaps only smth like:
> >"[[ $CARCH == "i686" ]]&&  sources= ... "
> >Though this is quite restrictive, and I see a discussion coming up why this
> >and not the other way.
> I am against imposing restrictions to formatting like that as there
> is always something that needs to be done differently...
Me too. But I also dislike to see here too creative constructs instead
of a simple "if" or "[[". See the wine PKGBUILD.
There are tons of dirty hacks in bash which are totally intransparent,
but still somehow work. 

> >Note that only vars are allowed in these functions; other entries are ignored.
> >There should also be a list/array of allowed vars (like "splitpkg_overrides").
> >There are: depends, makedepends, optdepends, source, checksums.
> >Note that this does not affect the build/package functions in any way.
> >The main advantages are:
> >* This is a unified way to handle arch specific vars in PKGBUILDs.
> >   There are no dirty hacks, no barely readable if clauses, etc.
> >* This is easy to parse - if needed - and easily integrable into makepkg.
> >   After sourcing the buildfile, you can first check if there is such a function
> >   and than simply run it (eg: "declare -F arch_$CARCH&&  arch_$CARCH").
> >   In combination with .SRCINFO there is no need to parse the
> >   PKGBUILD at all afterwards.
> >* And for the .SRCINFO file: with these functions you can expand (only
> >   an example - as I said above, this formatting is just one possibility) the
> >   separation tags to "global_i686" and "global_x86_64" which point to
> >   the arch specific vars. This completes the output/writing of this file.
> I am not sure about this.  Despite it being simpler on the surface,
> how would you handle this within a split package function?  I could
> see the need for different dependencies depending on architecture
> within a split package.
That's a point I also stumbled upon (not so hard to do so...).
I have here two suggestions. First, since the .SRCINFO file should not
be a "replacement" for the buildfile, some information can simply be
dropped :D . The arch_$CARCH should only appear in the "global" part of
the buildfile. Though this results in a pretty inconsitent handling (why
here and not there...?).
Another idea I have, is to provide some internal makepkg "helper functions"
like gentoo has inside ebuilds. Some like "msg" or "error" are already
used in PKGBUILDs. But these are only output formatting functions. 
Some are also used in install files. So this is not too unorthodox. 
It is possible to introduce arch specific helper functions. 
As a thought:
for_i686 "depends=('bla' 'bla')"
for_x86_64 "source=(http://... file://)"
And these functions could look inside makepkg like:
for_i686() {
    [[ "$CARCH" == "i686" ]] && eval "$@"
As you see, it moves the "if" checks inside makepkg and you get a
uniform way to handle this inside the buildfile.
And last but not least, these functions can also be used inside
"package_" functions.
What do you think?



More information about the pacman-dev mailing list