[pacman-dev] code reuse for PKGBUILD
Allan McRae
allan at archlinux.org
Fri Mar 22 19:13:36 EDT 2013
On 23/03/13 04:34, Florian Pritz wrote:
> On 03.02.2013 00:07, Allan McRae wrote:
>> On 02/02/13 23:48, Florian Pritz wrote:
>>> Any progress on this?
>>
>> No... I expected to see a wiki page started with the details of how
>> this would work and some examples.
>
> I don't speak awk so I coded a basic POC in perl. If someone wants to
> turn this into awk please be my guest (assuming everyone is happy with
> the behaviour and input + output).
>
> It updates an input containing either "# template start; .." and "#
> template end; ..." markers or "%% template input; .." with the current
> templates. The "%% template input" syntax is just for initial PKGBUILD
> creation so the user doesn't have to write a start and end tag with no
> code inbetween.
>
> Perl script: http://paste.xinu.at/SMlb/
> input file: http://paste.xinu.at/Fue8s/
> template files: http://paste.xinu.at/tVhDo/ http://paste.xinu.at/y7x4S/
>
> Example output:
> ######
> pkgname=foo
> pkgver=1
>
> build() {
> # template start; name=perl-module; sha1=TODO; version=TODO;
> this is before the blabla template
> # template start; name=perl-bla; sha1=TODO; version=TODO;
> bla bla
> # template end; name=perl-bla
> and this is after
> perl Makefile.pl
> make
> make install
> # template end; name=perl-module
> }
> ######
>
> If you run the script again it will remove the inlined templates and
> recreate them from the template files.
Looks fine. But we either need to get makepkg completely split up, or
this needs to be bash based.
> Another note:
> Lukas suggested on IRC that we could also just use an existing macro
> tool such as m4. I didn't think about it before, but I feel like an
> inline solution that just updates a simple file is better suited for
> PKGBUILDS since they tend to be rather small and can be viewed more
> easily if everything is inlined. Any other opinions here?
>
Can m4 update? It is also a pain with escaping from memory.
More information about the pacman-dev
mailing list