- Make compliant with PKG_PLIST when installing from package.

- Bump portrevision.

Approved by:	maho (mentor)
This commit is contained in:
Stephen Montgomery-Smith 2011-07-19 01:55:03 +00:00
parent d1a5abb27c
commit c294517637
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=277926
4 changed files with 29 additions and 23 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= octave-forge-base PORTNAME= octave-forge-base
PORTVERSION= 1.1 PORTVERSION= 1.1
PORTREVISION= 1 PORTREVISION= 2
CATEGORIES= math CATEGORIES= math
MASTER_SITES= #none MASTER_SITES= #none
DISTFILES= #none DISTFILES= #none

View file

@ -7,13 +7,27 @@
# installed in the correct order, so that dependency requirements are always # installed in the correct order, so that dependency requirements are always
# satisfied. # satisfied.
my $tardir = "%%PREFIX%%/share/octave/tarballs"; my $prefix = defined($ENV{"PKG_PREFIX"}) ? $ENV{"PKG_PREFIX"} : "%%PREFIX%%";
my $tardir = "$prefix/share/octave/tarballs";
use strict; use strict;
use Archive::Tar; use Archive::Tar;
use IO::Zlib; use IO::Zlib;
use File::Remove qw(remove); use File::Remove qw(remove);
# Interrogate octave to see where it stores its packages.
open(OCTAVE,"octave -H -q --no-site-file --eval \"pkg('prefix');pkg('global_list')\" |") || die;
my $install_prefix = <OCTAVE> || die;
chomp $install_prefix;
$install_prefix =~ s/.*\s+//;
my $arch_dep_prefix = <OCTAVE> || die;
chomp $arch_dep_prefix;
$arch_dep_prefix =~ s/.*\s+//;
my $global_list = <OCTAVE> || die;
chomp $global_list;
close OCTAVE;
# %long_form is a hash that does conversions like # %long_form is a hash that does conversions like
# $long_form{"odepkg"} == "odepkg-0.8.8.tar.gz" # $long_form{"odepkg"} == "odepkg-0.8.8.tar.gz"
@ -25,7 +39,7 @@ while (<$tardir/*>) {
$long_form{$1} = $n; $long_form{$1} = $n;
} }
} }
while (my $p = <%%PREFIX%%/share/octave/packages/*>) { while (my $p = <$install_prefix/*>) {
$p =~ s+.*/++; $p =~ s+.*/++;
$p =~ /(.*)\-/; $p =~ /(.*)\-/;
$long_form{$1} = "$p.tar.gz"; $long_form{$1} = "$p.tar.gz";
@ -52,7 +66,7 @@ my %to_install; # Those packages that remain to be installed. For these
# Calculate which entries of %is_installed exist. # Calculate which entries of %is_installed exist.
%is_installed = (); %is_installed = ();
while (my $p = <%%PREFIX%%/share/octave/packages/*>) { while (my $p = <$install_prefix/*>) {
$p =~ s+.*/++; $p =~ s+.*/++;
$is_installed{"$p.tar.gz"} = ""; $is_installed{"$p.tar.gz"} = "";
} }
@ -62,19 +76,17 @@ while (my $p = <%%PREFIX%%/share/octave/packages/*>) {
# out everything. # out everything.
my %check_installed; my %check_installed;
open(O,"octave -H -q --no-site-file --eval \"pkg('list')\" |") || die; open(OCTAVE,"octave -H -q --no-site-file --eval \"pkg('list')\" |") || die;
<O>; <OCTAVE>;
my $out = join "",<O>; my $out = join "",<OCTAVE>;
while ($out =~ s/^\s*(\S+)\s*\|\s*(\S+).*$//m) { while ($out =~ s/^\s*(\S+)\s*\|\s*(\S+).*$//m) {
$check_installed{"$1-$2.tar.gz"} = ""; $check_installed{"$1-$2.tar.gz"} = "";
} }
close O; close OCTAVE;
foreach my $p (sort keys %is_installed) { foreach my $p (sort keys %is_installed) {
if (defined($is_installed{$p}) && !defined($check_installed{$p})) { if (defined($is_installed{$p}) && !defined($check_installed{$p})) {
print "The octave packaging system is probably corrupt, so it will be rebuilt.\n"; print "The octave packaging system is probably corrupt, so it will be rebuilt.\n";
remove( \1, "%%PREFIX%%/lib/octave/packages", remove( \1, $arch_dep_prefix, $global_list, $install_prefix);
"%%PREFIX%%/share/octave/octave_packages",
"%%PREFIX%%/share/octave/packages");
%is_installed = (); %is_installed = ();
last; last;
} }
@ -82,9 +94,9 @@ foreach my $p (sort keys %is_installed) {
# Fill in the values of %is_installed by checking the dependencies. # Fill in the values of %is_installed by checking the dependencies.
while (my $p = <%%PREFIX%%/share/octave/packages/*>) { while (my $p = <$install_prefix/*>) {
$p =~ s+.*/++; $p =~ s+.*/++;
open(D,"%%PREFIX%%/share/octave/packages/$p/packinfo/DESCRIPTION") || die $!; open(D,"$install_prefix/$p/packinfo/DESCRIPTION") || die $!;
foreach my $l (<D>) { foreach my $l (<D>) {
if ($l=~s/Depends:\s*//) { if ($l=~s/Depends:\s*//) {
foreach my $ll (split ",",$l) { foreach my $ll (split ",",$l) {
@ -148,18 +160,16 @@ if ($nr_to_remove>0) {
# Clean out any crud that might be left over. # Clean out any crud that might be left over.
my @pkg = <%%PREFIX%%/share/octave/packages/*>; my @pkg = <$install_prefix/*>;
if ($#pkg==-1) { if ($#pkg==-1) {
print "load-octave-pkg: there are currently no octave packages installed.\n"; print "load-octave-pkg: there are currently no octave packages installed.\n";
remove( \1, "%%PREFIX%%/lib/octave/packages", remove( \1, $arch_dep_prefix, $global_list, $install_prefix);
"%%PREFIX%%/share/octave/octave_packages",
"%%PREFIX%%/share/octave/packages");
} }
# Recalculate which entries of %is_installed exist. # Recalculate which entries of %is_installed exist.
%is_installed = (); %is_installed = ();
while (my $p = <%%PREFIX%%/share/octave/packages/*>) { while (my $p = <$install_prefix/*>) {
$p =~ s+.*/++; $p =~ s+.*/++;
$is_installed{"$p.tar.gz"} = ""; $is_installed{"$p.tar.gz"} = "";
} }

View file

@ -10,6 +10,4 @@ packaging system.
Another purpose of the script "load-octave-pkg" is to attempt to correct any Another purpose of the script "load-octave-pkg" is to attempt to correct any
errors created by the octave packaging system. errors created by the octave packaging system.
Also, deinstalling this port will completely clean the octave packages.
WWW: http://octave.sourceforge.net/ WWW: http://octave.sourceforge.net/

View file

@ -1,7 +1,5 @@
@unexec %D/libexec/octave/load-octave-pkg
libexec/octave/load-octave-pkg libexec/octave/load-octave-pkg
@exec mkdir -p %D/share/octave/tarballs @exec mkdir -p %D/share/octave/tarballs
@exec %D/libexec/octave/load-octave-pkg @exec %D/libexec/octave/load-octave-pkg
@unexec rm -rf %D/lib/octave/packages >/dev/null 2>&1 || true
@unexec rm -f %D/share/octave/octave_packages >/dev/null 2>&1 || true
@unexec rm -rf %D/share/octave/packages >/dev/null 2>&1 || true
@dirrmtry share/octave/tarballs @dirrmtry share/octave/tarballs