head	1.10;
access;
symbols
	RELEASE_8_3_0:1.8
	RELEASE_9_0_0:1.6
	RELEASE_7_4_0:1.6
	RELEASE_8_2_0:1.6
	RELEASE_6_EOL:1.6
	RELEASE_8_1_0:1.6
	RELEASE_7_3_0:1.6
	RELEASE_8_0_0:1.5
	RELEASE_7_2_0:1.4
	old_RELEASE_7_1_0:1.2
	old_RELEASE_6_4_0:1.2
	old_RELEASE_5_EOL:1.2
	old_RELEASE_7_0_0:1.2
	old_RELEASE_6_3_0:1.2
	old_PRE_XORG_7:1.2
	old_RELEASE_4_EOL:1.2
	old_RELEASE_6_2_0:1.2
	old_RELEASE_6_1_0:1.2
	old_RELEASE_5_5_0:1.2
	old_RELEASE_6_0_0:1.1;
locks; strict;
comment	@# @;


1.10
date	2013.02.04.12.03.36;	author svnexp;	state dead;
branches;
next	1.9;

1.9
date	2012.11.17.05.58.54;	author svnexp;	state Exp;
branches;
next	1.8;

1.8
date	2012.03.11.23.49.09;	author linimon;	state Exp;
branches;
next	1.7;

1.7
date	2012.03.08.18.37.54;	author pgollucci;	state dead;
branches;
next	1.6;

1.6
date	2009.11.23.15.58.01;	author skv;	state Exp;
branches;
next	1.5;

1.5
date	2009.09.11.11.23.31;	author skv;	state Exp;
branches;
next	1.4;

1.4
date	2009.03.28.20.45.09;	author skv;	state Exp;
branches;
next	1.3;

1.3
date	2009.03.13.13.04.09;	author skv;	state Exp;
branches;
next	1.2;

1.2
date	2006.02.20.20.24.36;	author tobez;	state Exp;
branches;
next	1.1;

1.1
date	2005.06.24.09.17.06;	author tobez;	state Exp;
branches;
next	;


desc
@@


1.10
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/311580
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@#! %%PERL%% -w
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42)
# <tobez@@FreeBSD.org> wrote this file.  As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.   Anton Berezin
# ----------------------------------------------------------------------------
#
# $FreeBSD: head/lang/perl5.10/files/perl-after-upgrade 300896 2012-07-14 13:54:48Z beat $
# $Id: perl-after-upgrade,v 1.11 2005/06/23 19:39:00 tobez Exp $
#
=pod

=head1 NAME

perl-after-upgrade -- fixup FreeBSD packages that depend on perl

=head1 SYNOPSIS

  perl-after-upgrade
  perl-after-upgrade -f [-d] [-q]
  perl-after-upgrade -v

=head1 DESCRIPTION

The standard procedure after a perl port (lang/perl5.X) upgrade is to
basically reinstall all other packages that depend on perl.
This is always a painful exercise.  The perl-after-upgrade utility makes
this process mostly unnecessary.

The tool goes through the list of installed packages, looks for those
that depend on perl, moves files around, modifies shebang lines in those
scripts in which it is necessary to do so, tries its best to adjust
dynamically linked binaries that link with libperl.so in the old path,
and updates the package database.

After installation of the new perl is complete, either by hand from the
ports collection, or from a package, or via portupgrade, do the
following:

=over 4

=item o go root;

=item o run perl-after-upgrade utility.

Do not specify any arguments at first, so it does nothing destructive.
Pay attention to the produced output and especially to errorlist at the
end, if any;

=item o run the utility again, with B<-f> command line option.

This will actually do the work.  Again, pay attention to the output
produced;

=item o fix any reported errors;

=item o reinstall required packages:

The utility will tell you what packages that depend on perl it could not
handle.  It will also tell you why it happened (for example, they were
compiled against a binary incompatible perl).  If you want such packages
to remain operational, you will have to reinstall then by hand or via
portupgrade.

=item o review the files left in the older perl installation.

This is typically /usr/local/lib/perl5/site_perl/5.X.Y/.  There should
be very little, if any, files in that directory and its subdirectories,
excepting a number of .ph files;

=item o check that things work as they should;

=item o remove backup files from the package database.

Those will be /var/db/pkg/*/+CONTENTS.bak;

=item o that's all.

=back

=head1 COPYRIGHT AND LICENSE

Copyright 2005 by Anton Berezin

 "THE BEER-WARE LICENSE" (Revision 42)
 <tobez@@FreeBSD.org> wrote this module.  As long as you retain this
 notice you can do whatever you want with this stuff. If we meet some
 day, and you think this stuff is worth it, you can buy me a beer in
 return.

 Anton Berezin

NO WARRANTY OF ANY KIND, USE AT YOUR OWN RISK.

=head1 HISTORY

The first version of this utility was not bundled with perl package on
FreeBSD.  It was dumber than the current version in several important
areas.  It was faster.

=head1 CREDITS

Thanks to Mathieu Arnold for discussion.

=head1 SEE ALSO

perl(1).

=cut

use strict;
use warnings;
use 5.0100;

our $debug = 0;

# |/-\
my $pchar = "|";
my $do_progress = -t *STDOUT;
sub progress
{
	if ($do_progress) {
		print STDERR "$pchar";
		$pchar =~ tr<|/\\-><-|/\\>;
	}
}

package FreeBSD::Package;
use strict;
use warnings;

use IO::File;
use File::Copy;

sub new
{
	my ($pkg, %p) = @@_;
	my $pkgdir = $p{pkgdir} || return undef;
	my $name = $pkgdir;
	$name =~ s|.*/||;
	main::progress();
	my $c = IO::File->new("< $pkgdir/+CONTENTS");
	return undef unless $c;
	my @@lines;
	while (<$c>) {
		chomp;
		push @@lines, $_;
	}
	my $me = bless {
		pkgdir => $pkgdir,
		lines  => \@@lines,
		name   => $name,
	}, $pkg;
	return $me;
}

sub name
{
	return $_[0]->{name};
}

sub lines
{
	my $me = shift;
	if (@@_ && @@_ == 1 && ref(@@_) eq 'ARRAY') {
		$me->{lines} = [@@{$_[0]}];
		$me->{changed} = 1;
	} elsif (@@_) {
		$me->{lines} = [@@_];
		$me->{changed} = 1;
	} else {
		return @@{$me->{lines}};
	}
}

sub write_back
{
	my ($me) = @@_;

	return unless $me->{changed};
	main::progress();
	my $file = "$me->{pkgdir}/+CONTENTS";
	copy($file, "$file.bak");
	my $c = IO::File->new("> $file");
	return unless $c;
	for (@@{$me->{lines}}) {
		print $c "$_\n";
	}
}

package FreeBSD::Package::DB;
use strict;
use warnings;

sub new
{
	my ($pkg, %p) = @@_;
	my $me = bless {
		dbdir => $p{dbdir} || $ENV{PKG_DBDIR} || "/var/db/pkg",
	}, $pkg;
	$me->{packages} = [ grep { -d } glob "$me->{dbdir}/*" ];
	$me->reset;
	return $me;
}

sub next
{
	my ($me) = @@_;
	while (1) {
		$me->{current}++;
		if ($me->{current} >= @@{$me->{packages}}) {
			$me->reset;
			return undef;
		}
		my $pkg = FreeBSD::Package->new(pkgdir => $me->{packages}->[$me->{current}]);
		return $pkg if $pkg;
	}
}

sub reset
{
	my ($me) = @@_;
	$me->{current} = -1;
}

package main;
use strict;
use warnings;

use File::Temp qw/tempfile/;
use File::Copy;

our $dry_run = 1;
our $quiet = 0;
my @@tmpl;
our $VERSION = "1.4";

while (@@ARGV) {
	my $opt = shift;
	if ($opt eq "-f") {
		$dry_run = 0;
	} elsif ($opt eq "-d") {
		$debug = 1;
	} elsif ($opt eq "-q") {
		$quiet = 1;
	} elsif ($opt eq "-v") {
		$_ = $0;
		s|.*/||;
		print "$_ version $VERSION\n";
		exit 0;
	} elsif ($opt =~ /^-/) {
		$_ = $0;
		s|.*/||;
		print "Unknown option `$opt'\n";
		print "Usage:\n";
		print "\t$_\n\t$_ -v\n\t$_ -f\n";
		exit 1;
	} else {
		push @@tmpl, $opt;
	}
}

our $PERL_VERSION = '%%PERL_VERSION%%';
our $PERL_PKGNAME = '%%PKGNAME%%';

our $PERL_VERSION_REGEX = qr/5\.10\.\d+/;
print STDERR "- Fuzzy source re: <$PERL_VERSION_REGEX>\n" if $debug;

our @@errors;
our @@notes;

sub fix_script
{
	my ($file) = @@_;

	main::progress();
	return 1 if $dry_run;
	my $sf = IO::File->new("< $file");
	return "" unless $sf;
	my $line = <$sf>;
	my $md5 = "";
	if ($line && $line =~ s|^(\s*#!\s*[\w/]+perl)$PERL_VERSION_REGEX\b|$1$PERL_VERSION|) {
		my $dir = $file;
		$dir =~ s|/[^/]+$||;
		my ($fh, $fn) = tempfile(DIR=> $dir);
		if ($fh) {
			print $fh $line;
			while (<$sf>) {
				print $fh $_;
			}
			close $fh;
			$md5 = `/sbin/md5 -q $fn`;
			chomp $md5;
			my $mode = (stat($file))[2] & 07777;
			unlink $file or do {
				push @@errors, "Failed to unlink $file: $!";
				unlink $fn;
				return "";
			};
			rename $fn, $file or do {
				push @@errors, "Failed to rename $fn to $file: $!";
				return "";
			};
			chmod $mode, $file;
		} else {
			push @@errors, "Failed to modify $file: $!";
		}
	}
	return $md5;
}

sub fix_binary
{
	my ($file) = @@_;

	main::progress();
	my $sf = IO::File->new("< $file");
	return "" unless $sf;
	my $was = $dry_run ? "would be" : "was";
	push @@notes, "The $file binary $was modified, make sure it works";
	return 1 if $dry_run;
	my $md5 = "";

	my $dir = $file;
	$dir =~ s|/[^/]+$||;
	my ($fh, $fn) = tempfile(DIR=> $dir);
	unless ($fn) {
		push @@errors, "Failed to modify $file: $!";
		return "";
	}

	while (<$sf>) {
		s|/lib/perl5/$PERL_VERSION_REGEX/mach/CORE|/lib/perl5/$PERL_VERSION/mach/CORE|g;
		print $fh $_;
	}
	close $fh;
	$md5 = `/sbin/md5 -q $fn`;
	chomp $md5;
	my $mode = (stat($file))[2] & 07777;
	unlink $file or do {
		push @@errors, "Failed to unlink $file: $!";
		unlink $fn;
		return "";
	};
	rename $fn, $file or do {
		push @@errors, "Failed to rename $fn to $file: $!";
		return "";
	};
	chmod $mode, $file;
	return $md5;
}

sub mkdir_recur
{
	my ($dir) = @@_;

	main::progress();
	$dir =~ s|/+$||;
	my $orig = $dir;
	if ($dir =~ m|^$|) {
		return 1;
	} else {
		$dir =~ s|/[^/]+$||;
		my $r = mkdir_recur($dir);
		return $r unless $r;
		mkdir $orig, 0777;
		my $e = $!;
		unless (-d $orig) {
			push @@errors, "Could not create directory $orig: $e";
			return 0;
		}
		return 1;
	}
}

sub might_need_to_fix
{
	my ($pkg) = @@_;
	my $pkg_name = $pkg->name;

	main::progress();
	if ($pkg_name =~ /^bsdpan-/) {
		return 1;
	}
	for ($pkg->lines) {
		if (/^\@@pkgdep\s+perl-(threaded-)?($PERL_VERSION_REGEX)\S*\s*$/) {
			return 1;
		}
	}
	return 0;
}

sub fixable_binary
{
	my ($file, $name) = @@_;

	main::progress();
	my $fixable = 0;
	for (`/usr/bin/ldd $file 2>&1`) {
		if (/^\s+libperl\.so\s+=>/) {
			my $found;
			for (`strings $file`) {
				if (m</lib/perl5/($PERL_VERSION_REGEX)/mach/CORE>) {
					$found++;
					if (length($1) != length($PERL_VERSION)) {
						push @@notes, "$name cannot be fixed up (and has to be reinstalled): cannot patch $file due to length difference";
						print STDERR "- Skipping $name: cannot patch $file due to length difference\n" if $debug;
						return undef;
					}
					print STDERR "- $name: fixable binary $file\n" if $debug && $found < 2;
					$fixable = 1 if $1 ne $PERL_VERSION;
				}
			}
			if (!$found) {
				push @@notes, "$name cannot be fixed up (and has to be reinstalled): $file is using unknown libperl";
				print STDERR "- Skipping $name: $file is using unknown libperl\n" if $debug;
				return undef;
			}
		}
	}
	return $fixable;
}

sub fixable_shared_lib
{
	my ($file, $name) = @@_;

	main::progress();
	my ($old);
	for (`strings $file`) {
		if (/^perl_get_sv$/) {
			push @@notes, "$name cannot be fixed up (and has to be reinstalled): $file uses an old perl API";
			print STDERR "- Skipping $name: $file uses an old perl API\n" if $debug;
			return 0;
		}
	}
	return 1;
}

sub cannot_be_fixed
{
	my ($pkg, $binaries, $scripts) = @@_;
	my $pkg_name = $pkg->name;
	my $prefix = "";

	main::progress();

	for ($pkg->lines) {
		if (/^\@@cwd\s+(\S+)\s*$/) {
			$prefix = $1;
			next;
		}
		my $file = "$prefix/$_";
		next if -l $file;
		next if $file =~ /\.gz$/;
		next if $file =~ /\.bz2$/;
		my $sf = IO::File->new("< $file");
		next unless $sf;
		my $line;
		sysread $sf, $line, 256;

		# binary executable
		if ($line && $line =~ /^\177ELF.\x01.\x09.{8}\x02\0/) {
			my $fixable = fixable_binary($file, $pkg_name);
			return 0 unless defined $fixable;
			push @@$binaries, $file if $fixable;
		# shared library - can prevent us from being able to upgrade
		} elsif ($line && $line =~ /^\177ELF.\x01.\x09.{8}\x03\0/) {
			return 0 unless fixable_shared_lib($file, $pkg_name);
		} elsif ($line && $line =~ m<^\s*#!\s*[\w/]+perl($PERL_VERSION_REGEX)\b>) {
			print STDERR "- $pkg_name: fixable script $file\n" if $debug;
			push @@$scripts, $file if $1 ne $PERL_VERSION;
		}
		main::progress();
	}
}

#
my $db = FreeBSD::Package::DB->new;
my ($fixed, $skipped, $tot_moved, $tot_modified) = (0,0,0,0);
while (my $pkg = $db->next) {
	my @@lines;
	my $new_md5;
	my ($adjusted, $moved, $modified) = (0,0,0);

	my $pkg_name = $pkg->name;
	if (@@tmpl) {
		my $ok;
		for (@@tmpl) {
			if ($pkg_name =~ /^$_/) {
				$ok = 1;
				last;
			}
		}
		next unless $ok;
	}

	unless (might_need_to_fix($pkg)) {
		$skipped++;
		print STDERR "- Skipping $pkg_name, it does not depend on perl\n" if $debug;
		next;
	}

	my (@@binaries_to_fix, @@scripts_to_fix);
	if (cannot_be_fixed($pkg, \@@binaries_to_fix, \@@scripts_to_fix)) {
		$skipped++;
		next;
	}
	if ($debug) {
		print STDERR "- $pkg_name: ", scalar(@@binaries_to_fix), " binaries to fix\n" if @@binaries_to_fix;
		print STDERR "- $pkg_name: ", scalar(@@scripts_to_fix), " scripts to fix\n" if @@scripts_to_fix;
	}
	my %binaries = map { $_ => 1 } @@binaries_to_fix;
	my %scripts = map { $_ => 1 } @@scripts_to_fix;

	my $prefix = "";
	my $pcnt = 0;
	for ($pkg->lines) {
		if (/^([^@@]\S+)\s*$/) {
			my $from = "$prefix/$_";
			local $_;  # we'll need it later
			$new_md5 = "";
			unless (-l $from) {  # skip symlinks
				if ($binaries{$from}) {
					$new_md5 = fix_binary($from);
				} elsif ($scripts{$from}) {
					$new_md5 = fix_script($from);
				}
				$modified++ if $new_md5;
			}
			my $to = $from;
			if ($to =~ s|(/perl5/(?:site_perl/)?)$PERL_VERSION_REGEX|$1$PERL_VERSION|g) {
				if ($to ne $from) {
					my $dir = $to;
					$dir =~ s|/[^/]+$||;
					main::progress();
					unless ($dry_run) {
						if (mkdir_recur($dir)) {
							move($from, $to);
						} else {
							push @@errors, "   could not move $from to $to";
						}
					}
					$moved++;
					print STDERR "- move: $from => $to\n" if $debug;
				}
			}
		} elsif (/^\@@comment\s+MD5:[\da-f]+\s*$/ && $new_md5) {
			s|MD5:(\S+)|MD5:$new_md5|;
			$new_md5 = "";
		} else {
			$new_md5 = "";
		}
		if (/^\@@cwd\s+(\S+)\s*$/) {
			$prefix = $1;
		} elsif (/^\@@pkgdep\s+perl-(threaded-)?($PERL_VERSION_REGEX)\S*\s*$/) {
			if ($PERL_VERSION ne $2) {
				my $perlver = $2;
				s|perl-(threaded-)?\Q$perlver\E\S*|$PERL_PKGNAME|;
			}
		}
		my $old = $_;
		if (s|(/perl5/(?:site_perl/)?)$PERL_VERSION_REGEX|$1$PERL_VERSION|g) {
			if ($old ne $_) {
				$adjusted++;
				print STDERR "- adjust: $_\n" if $debug;
			}
		}
		push @@lines, $_;
		main::progress() if $pcnt++ % 250 == 0;
	}
	unless ($dry_run) {
		$pkg->lines(@@lines);
		$pkg->write_back;
	}
	$fixed++ if $moved || $modified || $adjusted;
	$tot_modified += $modified;
	$tot_moved += $moved;
	say "$pkg_name: $moved moved, $modified modified, $adjusted adjusted"
		if !$quiet || ($moved || $modified || $adjusted);
}
print "\n---\n";
print "Fixed $fixed packages ($tot_moved files moved, $tot_modified files modified)\n";
print "Skipped $skipped packages\n";
if (@@errors) {
	print "\n**** The script has encountered following problems:\n";
	for (@@errors) {
		print "$_\n";
	}
	print "\n--- Repeating summary:\n";
	print "Fixed $fixed packages ($tot_moved files moved, $tot_modified files modified)\n";
	print "Skipped $skipped packages\n";
}
if (@@notes) {
	print "\n**** In addition, please pay attention to the following:\n";
	for (@@notes) {
		print "$_\n";
	}
	print "\n--- Repeating summary:\n";
	print "Fixed $fixed packages ($tot_moved files moved, $tot_modified files modified)\n";
	print "Skipped $skipped packages\n";
}
@


1.9
log
@Switch exporter over
@
text
@@


1.8
log
@Undo ports/165457 to not violate POLA.  As far as I knew, the PR
was to test what happened when we did eventually delete these two
ports, not to delete them immediately.

A subsequent commit will add appropriate deprecation messages.

Hat:		portmgr
PR:		ports/165457
Feature safe:	yes (actually no, however, this is to preserve POLA)
@
text
@d9 1
a9 1
# $FreeBSD: ports/lang/perl5.10/files/perl-after-upgrade,v 1.6 2009/11/23 15:58:01 skv Exp $
@


1.7
log
@- Remove lang/perl5.8 (12/16/2008 EOL) and lang/perl5.10 (08/23/2009 EOL)
- lang/5.12 (default) is in Maint mode and lang/5.14 is GA right now.
- The final UNcommitted portition of this PR will move the default perl
  to lang/perl5.14 but
    mail/cyrus-impad2
    mail/cyrus-impad22
    print/perlftlib
    audio/papcl
    www/WebMagick
    misc/gcstar
    math/ploymak
  must be fixed or marked BROKEN 1st.

PR:             ports/165457
Submitted by:   pgollucci (myself)
Approved by:    portmgr (linimon)
Exp Run by:     linimon
Tested by:      make index
@
text
@@


1.6
log
@perl-after-upgrade:
- simplify regexes
- catch lines in +CONTENTS like:
@@unexec rmdir %D/lib/perl5/5.10.0 2>/dev/null || true
@
text
@d9 1
a9 1
# $FreeBSD: ports/lang/perl5.10/files/perl-after-upgrade,v 1.5 2009/09/11 11:23:31 skv Exp $
@


1.5
log
@Update to 5.10.1

Changes:	http://search.cpan.org/~dapm/perl-5.10.1/pod/perl5101delta.pod
@
text
@d9 1
a9 1
# $FreeBSD: ports/lang/perl5.10/files/perl-after-upgrade,v 1.4 2009/03/28 20:45:09 skv Exp $
d533 1
a533 3
			if ($to =~ s|/perl5/$PERL_VERSION_REGEX/|/perl5/$PERL_VERSION/|g 
			||  $to =~ s|/perl5/site_perl/$PERL_VERSION_REGEX/|/perl5/site_perl/$PERL_VERSION/|g
			) {
d564 1
a564 1
		if (s|/perl5/$PERL_VERSION_REGEX/|/perl5/$PERL_VERSION/|g || s|/perl5/site_perl/$PERL_VERSION_REGEX/|/perl5/site_perl/$PERL_VERSION/|g) {
@


1.4
log
@Introduce Perl 5.10.0
@
text
@d9 1
a9 1
# $FreeBSD: ports/lang/perl5.10/files/perl-after-upgrade,v 1.3 2009/03/13 13:04:09 skv Exp $
d21 1
a21 1
  perl-after-upgrade -f
d112 5
a116 1
my $debug = 0;
d130 3
d194 1
d228 3
d234 2
a235 1
my $dry_run = 1;
d237 1
a237 1
my $VERSION = "1.3";
d245 2
d264 2
a265 2
my $target = '%%PERL_VERSION%%';
my $new_perl_pkgname = '%%PKGNAME%%';
d267 2
a268 2
my $fuzzy_source = qr/5\.10\.\d+/;
print STDERR "- Fuzzy source re: <$fuzzy_source>\n" if $debug;
d270 2
a271 2
my @@errors;
my @@notes;
d275 1
a275 1
	my ($file, $target) = @@_;
d283 1
a283 1
	if ($line && $line =~ s|^(\s*#!\s*[\w/]+perl)$fuzzy_source\b|$1$target|) {
d315 1
a315 1
	my ($file, $target) = @@_;
d334 1
a334 1
		s|/lib/perl5/$fuzzy_source/mach/CORE|/lib/perl5/$target/mach/CORE|g;
d387 1
a387 1
		if (/^\@@pkgdep\s+perl-(threaded-)?($fuzzy_source)\S*\s*$/) {
d404 1
a404 1
				if (m</lib/perl5/($fuzzy_source)/mach/CORE>) {
d406 1
a406 1
					if (length($1) != length($target)) {
d412 1
a412 1
					$fixable = 1 if $1 ne $target;
d471 1
a471 1
		} elsif ($line && $line =~ m<^\s*#!\s*[\w/]+perl($fuzzy_source)\b>) {
d473 1
a473 1
			push @@$scripts, $file if $1 ne $target;
d526 1
a526 1
					$new_md5 = fix_binary($from, $target);
d528 1
a528 1
					$new_md5 = fix_script($from, $target);
d533 3
a535 1
			if ($to =~ s|/perl5/$fuzzy_source/|/perl5/$target/|g or $to =~ s|/perl5/site_perl/$fuzzy_source/|/perl5/site_perl/$target/|g) {
d559 2
a560 2
		} elsif (/^\@@pkgdep\s+perl-(threaded-)?($fuzzy_source)\S*\s*$/) {
			if ($target ne $2) {
d562 1
a562 1
				s|perl-(threaded-)?\Q$perlver\E|$new_perl_pkgname|;
d566 1
a566 1
		if (s|/perl5/$fuzzy_source/|/perl5/$target/|g || s|/perl5/site_perl/$fuzzy_source/|/perl5/site_perl/$target/|g) {
d582 2
a583 1
	print "$pkg_name: $moved moved, $modified modified, $adjusted adjusted\n";
@


1.3
log
@Update "perl-after-upgrade": set correct perl package name in @@pkgdep.
@
text
@d9 1
a9 1
# $FreeBSD: ports/lang/perl5.8/files/perl-after-upgrade,v 1.2 2006/02/20 20:24:36 tobez Exp $
d26 4
a29 4
The standard procedure after a perl port (either lang/perl5.6 or
lang/perl5.8) upgrade is to basically reinstall all other packages that
depend on perl.  This is always a painful exercise.  The
perl-after-upgrade utility makes this process mostly unnecessary.
d225 1
a225 1
my $VERSION = "1.2";
d253 1
a253 1
my $fuzzy_source = "5\\.[\\d._]+";
@


1.2
log
@Upgrade to 5.8.8.

Also:
Do not strip when built with -DWITH_DEBUGGING. [1]
Do not build non-threaded perl with -pthread. [2]
Add rebuild-xs target which should be used when
perl-after-upgrade does not do its job adequately. [3]
Fix perl-after-upgrade to handle threaded perl. [4]

Submitted by:	John Narron <jnarron@@cdsinet.net> [2],
		Sergey Prikhodko <sergey@@network-asp.biz> [4],
		parv@@pair.com [1],
		pavel@@ctk.ru [2],
		skv [3],
		vasilis <vasilis@@karkampounas.gr> [2]
PR:	83223 [4], 83767 [2], 84255 [2], 89443 [1], 90832 [2]
@
text
@d9 1
a9 1
# $FreeBSD: ports/lang/perl5.8/files/perl-after-upgrade,v 1.1 2005/06/24 09:17:06 tobez Exp $
d26 1
a26 1
The standard procedure after a perl port (either lang/perl5 or
a219 1
use Config;
d250 2
a251 42
my $target =
	$Config::Config{PERL_REVISION} . "." .
	$Config::Config{PERL_VERSION} . "." .
	$Config::Config{PERL_SUBVERSION};
my $source = "";
my $api_revision = $Config::Config{api_revision} || 0;
my $api_version = $Config::Config{api_version} || 0;
my $api_subversion = $Config::Config{api_subversion} || 0;
if ($api_revision < $Config::Config{PERL_REVISION}) {
	$source = ".[";
	for ($api_revision .. $Config::Config{PERL_REVISION}) {
		$source .= $_;
	}
	$source .= "]\\.\\d+\\.\\d+";
} elsif ($api_revision > $Config::Config{PERL_REVISION}) {
	die "internal error, this perl is too old\n";
} else {
	$source .= "$Config::Config{PERL_REVISION}\\.";
	if ($api_version < $Config::Config{PERL_VERSION}) {
		$source .= "[";
		for ($api_version .. $Config::Config{PERL_VERSION}) {
			$source .= $_;
		}
		$source .= "]\\.\\d+";
	} elsif ($api_version > $Config::Config{PERL_VERSION}) {
		die "internal error, this perl is too old\n";
	} else {
		$source .= "$Config::Config{PERL_VERSION}\\.";
		if ($api_subversion < $Config::Config{PERL_SUBVERSION}) {
			$source .= "[";
			for ($api_subversion .. $Config::Config{PERL_SUBVERSION}) {
				$source .= $_;
			}
			$source .= "]";
		} elsif ($api_subversion > $Config::Config{PERL_SUBVERSION}) {
			die "internal error, this perl is too old\n";
		} else {
			$source .= "$Config::Config{PERL_SUBVERSION}\\.";
		}
	}
}
print STDERR "- Source re: <$source>\n" if $debug;
d546 1
a546 1
				s|perl-(threaded-)?\Q$perlver\E|perl-$target|;
@


1.1
log
@Upgrade to 5.8.7.  In addition:

    - add perl-after-upgrade utility to move around
      dependent packages
    - fix $0 expansion in use.perl [1]
    - enable threaded perl on amd64 [2]
    - always compile perl with -pthread [3]
    - fix errno issue in SDBM_File [4]
    - add support for // and err (defined-or) [5]
    - add WITH_DEBUGGING option [6]
    - fix suidperl symlink [7]
    - fix several small bugs in use.perl
    - print possible WITH_XXX flags (no OPTIONS support yet)

[1] Submitted by:	erwin, Nil Dogger <niel@@introweb.nl>
[2] Nudged by:		Mike Schroll <FreeBSD@@LogicX.us>
[3] Nudged by:		skv
[4] perl bug #35938
[5] Obtained from:	H.Merijn Brand <h.m.brand@@xs4all.nl>
[6] PR:	78811, submitted by:	skv
[7] PR:	80069, submitted by:	Sergey N. Voronkov <serg@@tmn.ru>
    A different solution was actually implemented.
@
text
@d9 1
a9 1
# $FreeBSD$
d414 1
a414 1
		if (/^\@@pkgdep\s+perl-($fuzzy_source)\S*\s*$/) {
d584 4
a587 4
		} elsif (/^\@@pkgdep\s+perl-($fuzzy_source)\S*\s*$/) {
			if ($target ne $1) {
				my $perlver = $1;
				s|perl-\Q$perlver\E|perl-$target|;
@

