From 4a683e74a6afd9896df3c32b9d9d334e4599f7d3 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Tue, 9 Jun 2009 18:05:47 +0000 Subject: * fixed a whole lot of circular references which I found when researching #451 * some minor cleanups along the way git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2944 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSExport/BlockDevice/AoE.pm | 11 ----------- installer/OpenSLX/OSExport/BlockDevice/Base.pm | 13 +++++++++++++ installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm | 11 ----------- installer/OpenSLX/OSExport/BlockDevice/NBD.pm | 11 ----------- installer/OpenSLX/OSExport/Distro/Base.pm | 4 ++++ installer/OpenSLX/OSExport/FileSystem/Base.pm | 7 +++++++ installer/OpenSLX/OSExport/FileSystem/NFS.pm | 3 ++- installer/OpenSLX/OSExport/FileSystem/SquashFS.pm | 3 ++- installer/OpenSLX/OSSetup/Distro/Base.pm | 4 ++++ installer/OpenSLX/OSSetup/Engine.pm | 6 ++++-- installer/OpenSLX/OSSetup/MetaPackager/Base.pm | 5 +++++ installer/OpenSLX/OSSetup/Packager/Base.pm | 5 +++++ 12 files changed, 46 insertions(+), 37 deletions(-) (limited to 'installer') diff --git a/installer/OpenSLX/OSExport/BlockDevice/AoE.pm b/installer/OpenSLX/OSExport/BlockDevice/AoE.pm index d3916d6a..cc7866b5 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/AoE.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/AoE.pm @@ -41,17 +41,6 @@ sub new return bless $self, $class; } -sub initialize -{ - my $self = shift; - my $engine = shift; - my $fs = shift; - - $self->{'engine'} = $engine; - $self->{'fs'} = $fs; - return; -} - sub getExportPort { my $self = shift; diff --git a/installer/OpenSLX/OSExport/BlockDevice/Base.pm b/installer/OpenSLX/OSExport/BlockDevice/Base.pm index d2395e30..6469c2f4 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/Base.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/Base.pm @@ -18,6 +18,8 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version +use Scalar::Util qw( weaken ); + use OpenSLX::Basics; ################################################################################ @@ -30,6 +32,17 @@ sub new sub initialize { + my $self = shift; + my $engine = shift; + my $fs = shift; + + $self->{'engine'} = $engine; + weaken($self->{'engine'}); + # avoid circular reference between block-device and its engine + + $self->{'fs'} = $fs; + weaken($self->{'fs'}); + # avoid circular reference between block-device and its file-system } sub getExportPort diff --git a/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm b/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm index 8dcc340b..1ad9471e 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/DNBD2.pm @@ -35,17 +35,6 @@ sub new return bless $self, $class; } -sub initialize -{ - my $self = shift; - my $engine = shift; - my $fs = shift; - - $self->{'engine'} = $engine; - $self->{'fs'} = $fs; - return; -} - sub getExportPort { my $self = shift; diff --git a/installer/OpenSLX/OSExport/BlockDevice/NBD.pm b/installer/OpenSLX/OSExport/BlockDevice/NBD.pm index 73694fbc..58378751 100644 --- a/installer/OpenSLX/OSExport/BlockDevice/NBD.pm +++ b/installer/OpenSLX/OSExport/BlockDevice/NBD.pm @@ -35,17 +35,6 @@ sub new return bless $self, $class; } -sub initialize -{ - my $self = shift; - my $engine = shift; - my $fs = shift; - - $self->{'engine'} = $engine; - $self->{'fs'} = $fs; - return; -} - sub getExportPort { my $self = shift; diff --git a/installer/OpenSLX/OSExport/Distro/Base.pm b/installer/OpenSLX/OSExport/Distro/Base.pm index 1b3edb63..aa24f8de 100644 --- a/installer/OpenSLX/OSExport/Distro/Base.pm +++ b/installer/OpenSLX/OSExport/Distro/Base.pm @@ -18,6 +18,8 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version +use Scalar::Util qw( weaken ); + use OpenSLX::Basics; ################################################################################ @@ -34,6 +36,8 @@ sub initialize my $engine = shift; $self->{'engine'} = $engine; + weaken($self->{'engine'}); + # avoid circular reference between distro and its engine $self->initDistroInfo(); return; diff --git a/installer/OpenSLX/OSExport/FileSystem/Base.pm b/installer/OpenSLX/OSExport/FileSystem/Base.pm index 1014d596..05f3c6a0 100644 --- a/installer/OpenSLX/OSExport/FileSystem/Base.pm +++ b/installer/OpenSLX/OSExport/FileSystem/Base.pm @@ -19,6 +19,7 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version use File::Basename; +use Scalar::Util qw( weaken ); use OpenSLX::Basics; use OpenSLX::Utils; @@ -33,6 +34,12 @@ sub new sub initialize { + my $self = shift; + my $engine = shift; + + $self->{'engine'} = $engine; + weaken($self->{'engine'}); + # avoid circular reference between file-system and its engine } sub exportVendorOS diff --git a/installer/OpenSLX/OSExport/FileSystem/NFS.pm b/installer/OpenSLX/OSExport/FileSystem/NFS.pm index b9d88689..9bd2ca87 100644 --- a/installer/OpenSLX/OSExport/FileSystem/NFS.pm +++ b/installer/OpenSLX/OSExport/FileSystem/NFS.pm @@ -40,7 +40,8 @@ sub initialize my $self = shift; my $engine = shift; - $self->{'engine'} = $engine; + $self->SUPER::initialize($engine); + my $exportBasePath = "$openslxConfig{'public-path'}/export"; $self->{'export-path'} = "$exportBasePath/nfs/$engine->{'vendor-os-name'}"; return; diff --git a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm index d9760642..a092ddf0 100644 --- a/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm +++ b/installer/OpenSLX/OSExport/FileSystem/SquashFS.pm @@ -41,7 +41,8 @@ sub initialize my $engine = shift; my $blockDevice = shift || confess('need to pass in block-device!'); - $self->{'engine'} = $engine; + $self->SUPER::initialize($engine); + $self->{'block-device'} = $blockDevice; my $exportBasePath = "$openslxConfig{'public-path'}/export"; $self->{'export-path'} = "$exportBasePath/sqfs/$engine->{'vendor-os-name'}"; diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm index 75979ac6..075c0818 100644 --- a/installer/OpenSLX/OSSetup/Distro/Base.pm +++ b/installer/OpenSLX/OSSetup/Distro/Base.pm @@ -21,6 +21,8 @@ our $VERSION = 1.01; # API-version . implementation-version use Fcntl qw(:DEFAULT :flock); use File::Basename; use File::Path; +use Scalar::Util qw( weaken ); + use OpenSLX::Basics; use OpenSLX::Utils; @@ -38,6 +40,8 @@ sub initialize my $engine = shift; $self->{'engine'} = $engine; + weaken($self->{'engine'}); + # avoid circular reference between distro and its engine if ($engine->{'distro-name'} =~ m[x86_64]) { # be careful to only try installing 64-bit systems if actually diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index 74a5ed7e..6a2697d2 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -411,7 +411,6 @@ sub startChrootedShellForVendorOS } ); - $self->_touchVendorOS(); vlog( 0, _tr( @@ -419,6 +418,8 @@ sub startChrootedShellForVendorOS $self->{'vendor-os-name'} ) ); + $self->_touchVendorOS(); + return; } @@ -457,7 +458,6 @@ sub callChrootedFunctionForVendorOS } ); - $self->_touchVendorOS(); vlog( 1, _tr( @@ -465,6 +465,8 @@ sub callChrootedFunctionForVendorOS $self->{'vendor-os-name'} ) ); + $self->_touchVendorOS(); + return 1; } diff --git a/installer/OpenSLX/OSSetup/MetaPackager/Base.pm b/installer/OpenSLX/OSSetup/MetaPackager/Base.pm index af789888..f149d0f5 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/Base.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/Base.pm @@ -18,6 +18,8 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version +use Scalar::Util qw( weaken ); + use OpenSLX::Basics; ################################################################################ @@ -34,6 +36,9 @@ sub initialize my $engine = shift; $self->{'engine'} = $engine; + weaken($self->{'engine'}); + # avoid circular reference between meta-packager and its engine + return; } diff --git a/installer/OpenSLX/OSSetup/Packager/Base.pm b/installer/OpenSLX/OSSetup/Packager/Base.pm index 747ba7e4..af600b8b 100644 --- a/installer/OpenSLX/OSSetup/Packager/Base.pm +++ b/installer/OpenSLX/OSSetup/Packager/Base.pm @@ -18,6 +18,8 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version +use Scalar::Util qw( weaken ); + use OpenSLX::Basics; ################################################################################ @@ -34,6 +36,9 @@ sub initialize my $engine = shift; $self->{'engine'} = $engine; + weaken($self->{'engine'}); + # avoid circular reference between packager and its engine + return; } -- cgit v1.2.3-55-g7522