]> sipb.mit.edu Git - ikiwiki.git/blob - doc/patchqueue/lib-fixup.mdwn
web commit by http://id.inelegant.org/
[ikiwiki.git] / doc / patchqueue / lib-fixup.mdwn
1 I'm using Ikiwiki on a box where I don't have root access, so I install all of my Perl modules in `~/lib`. The `ikiwiki.in` script is ran in Taint mode, which means that it ignores the contents of `$ENV{PERL5LIB}`. The result is that the current versions of the pre-requisite modules I've installed in `~/lib` are ignored by `./make`, which uses the outdated, and therefore incompatible versions, from the system-wide `@INC`... ;-)
2
3 I imagine that there's a clean and elegant solution to this, but the hack I'm currently using is to have `./make` alter `ikiwki.in` before it's run, by inserting `use lib ...` lines for each of the directories in `$ENV{PERL5LIB}`. Again, this is clearly ugly, but it allows me to run `./make`, so I'm submitting it FWIW.
4
5 <pre> 
6 Index: Makefile.PL
7 ===================================================================
8 --- Makefile.PL (revision 2630)
9 +++ Makefile.PL (working copy)
10 @@ -24,6 +24,7 @@
11  )
12  
13  extra_build:
14 +       LANG=C ./lib-fixup.pl ikiwiki.in
15         LANG=C ./ikiwiki.in doc html --templatedir=templates \
16                 --underlaydir=basewiki \
17                 --wikiname="ikiwiki" --verbose --no-rcs \
18 Index: lib-fixup.pl
19 ===================================================================
20 --- lib-fixup.pl        (revision 0)
21 +++ lib-fixup.pl        (revision 0)
22 @@ -0,0 +1,9 @@
23 +#!/usr/bin/perl -i.bak -p
24 +use strict;
25 +use warnings;
26 +my @dirs = $ENV{PERL5LIB} =~ /:/ ? split /:/, $ENV{PERL5LIB} : $ENV{PERL5LIB};
27 +if (@dirs) {
28 +    my $libs = join('', map { " use lib '$_';\n" } @dirs);
29 +    s/(use IkiWiki;)/$libs$1/;
30 +}
31
32
33 Property changes on: lib-fixup.pl
34 ___________________________________________________________________
35 Name: svn:executable
36    + *
37
38 </pre>