How to include new dirs in @INC

Paul Schmehl pauls at utdallas.edu
Tue Jul 24 15:17:55 UTC 2007


--On Tuesday, July 24, 2007 16:25:14 +0200 Anton Berezin <tobez at tobez.org> 
wrote:

> On Tue, Jul 24, 2007 at 09:18:17AM -0500, Paul Schmehl wrote:
>
>> BTW, maybe you know the answer to this.  I can't remove the perl modules
>> in  pkg-plist because it prepends PREFIX to SITE_PERL, making the
>> location  /usr/local/usr/local/lib/perl5/site_perl/5.8.8.  This seems to
>> me to be a  bug.  Shouldn't pkg-plist honor SITE_PERL and not prepend
>> PREFIX?
>
> Hmmm.  I assume you are using %%SITE_PERL%% as the prefix in the
> pkg-plist?
>
Yes, that's correct.

> bsd.port.mk defines ${SITE_PERL} as ${PREFIX}${SITE_PERL_REL}, and it
> defines a plist substitution %%SITE_PERL%% to be the same as
> ${SITE_PERL_REL}, so in most circumstances it "just works".
>
I tried both %%SITE_PERL%% and %%SITE_PERL_REL%% and both failed.

> Maybe a snippet of your pkg-plist together with *-install Makefile targets
> (if any) would help to see what's wrong?
>
The %%SITE_PERL%% stuff is no longer in pkg-plist.  I moved it to the 
pkg-deinstall script.  I could do some more testing, I suppose.....

OK, commented out one of the modules in the pkg-deinstall script and added 
it to pkg-plist like this:
%%SITE_PERL%%/mach/IP4.pm

Then I installed the port and confirmed that the module was installed:
ls /usr/local/lib/perl5/site_perl/5.8.8/mach/IP4.pm
/usr/local/lib/perl5/site_perl/5.8.8/mach/IP4.pm

Then I deinstalled the port and got this error:
make deinstall PREFIX=/var/tmp/$(make -V PORTNAME)
===>  Deinstalling for security/bro
===>   Deinstalling bro-1.2
pkg_delete: file '/var/tmp/bro/lib/perl5/site_perl/5.8.8/mach/IP4.pm' 
doesn't exist
pkg_delete: couldn't entirely delete package (perhaps the packing list is
incorrectly specified?)

As you can see, SITE_PERL is prepending PREFIX to SITE_PERL_REL (as you 
said), but perl modules are *always* installed in 
/usr/local/lib/perl5/site_perl/blah, are they not?

IOW, this will work fine in pkg-plist *if* (and only if) PREFIX is the 
default.  If the installer changes PREFIX to anything else, the perl 
modules will not be uninstalled and the deinstall will generate an error. 
(Installing the perl modules in non-standard-PREFIX/lib/blah makes no sense 
because the scripts won't work because @INC doesn't include non-standard 
locations by default.)

Perhaps the correct way to resolve this is to change bsd.port.mk to define 
${SITE_PERL} in pkg-plist as ${LOCALBASE}/${SITE_PERL_REL} instead of 
${PREFIX}/${SITE_PERL_REL}?  No matter what PREFIX an installer chooses, 
perl modules should always be in LOCALBASE, right?

-- 
Paul Schmehl (pauls at utdallas.edu)
Senior Information Security Analyst
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/


More information about the freebsd-ports mailing list