[pacman-dev] code reuse for PKGBUILD

Florian Pritz bluewind at xinu.at
Fri Dec 7 12:17:18 EST 2012


On 07.12.2012 04:46, Kent Fredric wrote:
> Maybe the "Arch" way would be more template based, and maybe it could have
> a sort of "guard region comment" combined with some automatic content
> regeneration, ie: https://gist.github.com/4230499

That's a lot better and I really like the idea of simpler cpan pkgbuilds.

> Users who are paranoid could then add an option in makepkg.conf to /always/
> regenerate these sections from their local copies, or maybe only regenerate
> using the same version of that module.

We'd have to ship all old versions of the templates for regeneration of
the same version to work, but I guess it is a good idea anyway.

I also think that makepkg should always regenerate the template if its
version is available just to be sure. People are almost certainly not
going to verify the code given it will probably also grow larger to
handle corner cases.

At the very least it should check if the code differs from the template
and abort to prevent someone from applying fixes that will get lost
later. Either fix the template or don't mark it as being part of one.

> 
> The only really big downside I see to the approach is the commenting stuff
> is a little bit magical.

You could go with something like:
# template start: name=perl-module; sha1=feedbeef42c0ffee; version=1.2.3
code
code
# template end

(In case it isn't, the comment should be on one line)

That's pretty easy to parse for both a human and a script and also tells
a new user that the code is a template without requiring any weird syntax.

-- 
Florian Pritz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20121207/fb091e51/attachment.asc>


More information about the pacman-dev mailing list