From 0ac467e31fe703a572fa0ba4ae9458ef8e9861d1 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 11 May 2007 20:47:04 +0000 Subject: * improved reliability in case of user interrupts * added support for specifying excludes, doesn't work properly yet, though git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1049 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSSetup/Distro/Base.pm | 4 +++ installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm | 3 +-- .../OpenSLX/OSSetup/Distro/SUSE_10_1_x86_64.pm | 3 +-- installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm | 28 +++++++++---------- .../OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm | 3 +-- installer/OpenSLX/OSSetup/Engine.pm | 31 +++++++++++++++++----- installer/OpenSLX/OSSetup/MetaPackager/Base.pm | 9 ++++++- installer/OpenSLX/OSSetup/MetaPackager/yum.pm | 2 ++ 8 files changed, 54 insertions(+), 29 deletions(-) (limited to 'installer') diff --git a/installer/OpenSLX/OSSetup/Distro/Base.pm b/installer/OpenSLX/OSSetup/Distro/Base.pm index cb2ac57c..7d63e049 100644 --- a/installer/OpenSLX/OSSetup/Distro/Base.pm +++ b/installer/OpenSLX/OSSetup/Distro/Base.pm @@ -122,6 +122,10 @@ sub startSession { } +sub updateDistroConfig +{ +} + sub finishSession { } diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm index 3d5f8a09..d9fa78f6 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1.pm @@ -55,7 +55,7 @@ sub fixPrerequiredFiles } } -sub finishSession +sub updateDistroConfig { my $self = shift; @@ -67,7 +67,6 @@ sub finishSession if (slxsystem("SuSEconfig")) { die _tr("unable to run SuSEconfig (%s)", $!); } - $self->SUPER::finishSession(); } sub initDistroInfo diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1_x86_64.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1_x86_64.pm index 7520cddd..fd74f4cd 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_1_x86_64.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_1_x86_64.pm @@ -55,7 +55,7 @@ sub fixPrerequiredFiles } } -sub finishSession +sub updateDistroConfig { my $self = shift; @@ -67,7 +67,6 @@ sub finishSession if (slxsystem("SuSEconfig")) { die _tr("unable to run SuSEconfig (%s)", $!); } - $self->SUPER::finishSession(); } sub initDistroInfo diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm index 28da0584..f67a8fba 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm @@ -55,7 +55,7 @@ sub fixPrerequiredFiles } } -sub finishSession +sub updateDistroConfig { my $self = shift; @@ -67,7 +67,6 @@ sub finishSession if (slxsystem("SuSEconfig")) { die _tr("unable to run SuSEconfig (%s)", $!); } - $self->SUPER::finishSession(); } sub initDistroInfo @@ -238,9 +237,6 @@ sub initDistroInfo autoyast2-installation bash bc - beagle - beagle-firefox - beagle-index bind-libs bind-utils binutils @@ -442,7 +438,6 @@ sub initDistroInfo kdeartwork3-kscreensaver kdeartwork3-xscreensaver kdebase3 - kdebase3-beagle kdebase3-kdm kdebase3-ksysguardd kdebase3-nsplugin @@ -472,8 +467,6 @@ sub initDistroInfo kdetv kdeutils3 kernel-default - kerry - kio_beagle kio_ipodslave kio_iso kio_slp @@ -672,10 +665,7 @@ sub initDistroInfo openssl opensuse-manual_de opensuse-manual_en - opensuse-quickstart_de - opensuse-quickstart_en openSUSE-release - opensuse-updater orbit2 pam pam-config @@ -759,7 +749,6 @@ sub initDistroInfo rrdtool rsync ruby - rug sane sane-frontends sash @@ -952,16 +941,25 @@ sub initDistroInfo yast2-xml ypbind yp-tools - zen-updater zip zisofs-tools zlib - zmd zsh zvbi - zypper ", }; + + $self->{config}->{'excludes'} = { + # these packages will never be installed: + + 'default' => " + ", + + 'kde' => " + <<>> + ", + }; + } 1; \ No newline at end of file diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm index 2885b38b..9df9f855 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2_x86_64.pm @@ -55,7 +55,7 @@ sub fixPrerequiredFiles } } -sub finishSession +sub updateDistroConfig { my $self = shift; @@ -67,7 +67,6 @@ sub finishSession if (slxsystem("SuSEconfig")) { die _tr("unable to run SuSEconfig (%s)", $!); } - $self->SUPER::finishSession(); } sub initDistroInfo diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index f5ebb20b..c5160234 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -368,6 +368,7 @@ sub readDistroInfo # merge user-provided configuration distro defaults... my %repository = %{$self->{distro}->{config}->{repository}}; my %selection = %{$self->{distro}->{config}->{selection}}; + my %excludes = %{$self->{distro}->{config}->{excludes}}; my $package_subdir = $self->{distro}->{config}->{'package-subdir'}; my $prereq_packages = $self->{distro}->{config}->{'prereq-packages'}; my $bootstrap_prereq_packages @@ -385,6 +386,10 @@ sub readDistroInfo foreach my $selKey (keys %selection) { $selection{$selKey} =~ s[<<<([^>]+)>>>][$selection{$1}]eg; } + # ...expand selection definitions... + foreach my $exclKey (keys %excludes) { + $excludes{$exclKey} =~ s[<<<([^>]+)>>>][$excludes{$1}]eg; + } # ...and store merged config: $self->{'distro-info'} = { 'package-subdir' => $package_subdir, @@ -393,6 +398,7 @@ sub readDistroInfo 'bootstrap-packages' => $bootstrap_packages, 'repository' => \%repository, 'selection' => \%selection, + 'excludes' => \%excludes, }; if ($openslxConfig{'verbose-level'} >= 2) { @@ -410,6 +416,13 @@ sub readDistroInfo vlog 3, "\t$sl"; } } + foreach my $e (sort keys %excludes) { + my @exclLines = split "\n", $excludes{$e}; + vlog 2, "excludes for '$e':"; + foreach my $excl (@exclLines) { + vlog 3, "\t$excl"; + } + } } } @@ -820,11 +833,14 @@ sub stage1D_setupPackageSources() my $self = shift; vlog 1, "setting up package sources for meta packager..."; + my $selectionName = $self->{'selection-name'}; + my $pkgExcludes = $self->{'distro-info'}->{excludes}->{$selectionName}; + my $excludeList = join ' ', string2Array($pkgExcludes); $self->{'meta-packager'}->initPackageSources(); my ($rk, $repo); while(($rk, $repo) = each %{$self->{'distro-info'}->{repository}}) { vlog 2, "setting up package source $rk..."; - $self->{'meta-packager'}->setupPackageSource($rk, $repo); + $self->{'meta-packager'}->setupPackageSource($rk, $repo, $excludeList); } } @@ -846,6 +862,7 @@ sub stage1D_updateBasicVendorOS() vlog 1, "updating basic vendor-os..."; $self->{'meta-packager'}->startSession(); $self->{'meta-packager'}->updateBasicVendorOS(); + $self->{'distro'}->updateDistroConfig(); $self->{'meta-packager'}->finishSession(); } @@ -857,16 +874,15 @@ sub stage1D_installPackageSelection vlog 1, "installing package selection <$selectionName>..."; my $pkgSelection = $self->{'distro-info'}->{selection}->{$selectionName}; - my @pkgs - = grep { length($_) > 0 } - map { $_ =~ s[^\s*(.*?)\s*$][$1]; $_ } - split "\n", $pkgSelection; + my @pkgs = string2Array($pkgSelection); if (scalar(@pkgs) == 0) { vlog 0, _tr("No packages listed for selection '%s', nothing to do.", $selectionName); } else { + vlog 2, "installing these packages:\n".join("\n\t", @pkgs); $self->{'meta-packager'}->startSession(); $self->{'meta-packager'}->installSelection(join " ", @pkgs); + $self->{'distro'}->updateDistroConfig(); $self->{'meta-packager'}->finishSession(); } } @@ -937,8 +953,9 @@ sub string2Array my $str = shift; return - grep { length($_) > 0 } - map { $_ =~ s[^\s*(.+?)\s*$][$1]; $_ } + grep { length($_) > 0 && $_ !~ m[^\s*#]; } + # drop empty lines and comments + map { $_ =~ s[^\s*(.*?)\s*$][$1]; $_ } split "\n", $str; } diff --git a/installer/OpenSLX/OSSetup/MetaPackager/Base.pm b/installer/OpenSLX/OSSetup/MetaPackager/Base.pm index 313460f6..218dd131 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/Base.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/Base.pm @@ -17,7 +17,9 @@ use vars qw($VERSION); $VERSION = 1.01; # API-version . implementation-version use strict; + use Carp; +use OpenSLX::Basics; ################################################################################ ### interface methods @@ -54,6 +56,9 @@ sub installSelection sub startSession { my $self = shift; + + addCleanupFunction('slxos-setup::meta-packager', + sub { $self->finishSession(); } ); system('mount -t proc proc /proc 2>/dev/null'); @@ -64,11 +69,13 @@ sub startSession sub finishSession { my $self = shift; - + $self->{engine}->{distro}->finishSession(); # allow vendor specific extensions system('umount /proc 2>/dev/null'); + + removeCleanupFunction('slxos-setup::meta-packager'); } 1; diff --git a/installer/OpenSLX/OSSetup/MetaPackager/yum.pm b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm index 62a9806a..a6011f67 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/yum.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm @@ -56,6 +56,7 @@ sub setupPackageSource my $self = shift; my $repoName = shift; my $repoInfo = shift; + my $excludeList = shift; my $repoURL = $self->{engine}->selectBaseURL($repoInfo); if (length($repoInfo->{'repo-subdir'})) { @@ -67,6 +68,7 @@ sub setupPackageSource open(REPO, "> $repoFile") or die _tr("unable to create repo-file <%s> (%s)\n", $repoFile, $1); print REPO $repoDescr; + print REPO "\nexclude=$excludeList\n"; close(REPO); } -- cgit v1.2.3-55-g7522