Date: Sun, 09 Jun 2002 04:07:43 -0700 From: Doug Barton <DougB@FreeBSD.org> To: freebsd-current@FreeBSD.org, tobez@FreeBSD.org Subject: use.perl patch for the new -current world Message-ID: <3D0336FF.5A0D4F0@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------9755D75EAEB4D5D7F08EC1D3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Attached is a patch that I think sufficiently updates use.perl to handle the state of the world in -current, without boning things for -stable. It also moves some duplicate code up out of the functions. There are certainly other possible ways to solve this problem, but I've tested the attached patch, moving back and forth between system and port, and it works fine. The other alternative I considered is to rely on something like: if (-f /usr/bin/perl-wrapper) { blah } but decided against it because the current script uses the concept of leaving /usr/bin/perl5 as whatever is installed on the system, so I figured that staying with that would be less of a pola violation. Comments/suggestions welcome. -- "We have known freedom's price. We have shown freedom's power. And in this great conflict, ... we will see freedom's victory." - George W. Bush, President of the United States State of the Union, January 28, 2002 Do YOU Yahoo!? --------------9755D75EAEB4D5D7F08EC1D3 Content-Type: text/plain; charset=us-ascii; name="use.perl.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="use.perl.diff" Index: use.perl =================================================================== RCS file: /home/ncvs/ports/lang/perl5/files/use.perl,v retrieving revision 1.2 diff -u -r1.2 use.perl --- use.perl 20 May 2002 00:03:07 -0000 1.2 +++ use.perl 9 Jun 2002 10:58:05 -0000 @@ -14,6 +14,11 @@ exit 2; } +my $port_perl = '%%PREFIX%%/bin/perl'; +$port_perl =~ tr|/|/|s; + +my $ident = `/usr/bin/ident /usr/bin/perl5`; + @ARGV == 1 or usage(); if ($ARGV[0] eq 'port') { switch_to_port(); @@ -24,18 +29,25 @@ } exit 0; +# Both functions depend on the idea that switch_to_port leaves +# perl5 alone. If the wrapper is installed on a -current system, +# /usr/bin/perl5 will also be the wrapper. + sub switch_to_system { - my $port_perl = '%%PREFIX%%/bin/perl'; - $port_perl =~ tr|/|/|s; - # protect against cases where people use PREFIX=/usr if ($port_perl ne '/usr/bin/perl') { unlink '/usr/bin/perl', '/usr/bin/suidperl', '/usr/bin/perl%%PERL_VERSION%%'; link '/usr/bin/perl5', '/usr/bin/perl'; - link '/usr/bin/sperl5', '/usr/bin/suidperl'; + link '/usr/bin/perl5', '/usr/bin/perl%%PERL_VERSION%%'; + + if ($ident =~ m#src/usr.bin/perl/perl.c#) { + link '/usr/bin/perl5', '/usr/bin/suidperl'; + } else { + link '/usr/bin/sperl5', '/usr/bin/suidperl'; + } } open MK, ">> /etc/make.conf" or die "/etc/make.conf: $!"; @@ -47,6 +59,7 @@ .undef PERL_VERSION .undef PERL_ARCH .undef NOPERL +.undef NO_PERL EOF close MK; @@ -54,13 +67,15 @@ sub switch_to_port { - my $port_perl = '%%PREFIX%%/bin/perl'; - $port_perl =~ tr|/|/|s; - # protect against cases where people use PREFIX=/usr if ($port_perl ne '/usr/bin/perl') { - unlink '/usr/bin/perl', '/usr/bin/suidperl', - '/usr/bin/perl%%PERL_VERSION%%'; + if ($ident =~ m#src/usr.bin/perl/perl.c#) { + rename '/usr/bin/perl', '/usr/bin/perl-wrapper'; + } else { + unlink '/usr/bin/perl'; + } + + unlink '/usr/bin/suidperl', '/usr/bin/perl%%PERL_VERSION%%'; symlink '%%PREFIX%%/bin/perl', '/usr/bin/perl'; symlink '%%PREFIX%%/bin/suidperl', '/usr/bin/suidperl'; @@ -76,6 +91,8 @@ PERL_VERSION=%%PERL_VERSION%% PERL_ARCH=%%PERL_ARCH%% NOPERL=yo +NO_PERL=yo +NO_PERL_WRAPPER=yo EOF close MK; --------------9755D75EAEB4D5D7F08EC1D3-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D0336FF.5A0D4F0>