From d7afcd0a5a3d03251991bc7fc91ba14b38a92fc8 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 28 May 2007 13:29:45 +0000 Subject: * integrated mirror support into yum & smart backend * fixed smart backend with respect to being restarted (it no longer stops, waiting for you to enter an alternative name for any existing channel) * the use of mirrors can now be deactivated with SLX_NO_MIRROR=1, very useful for development git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1095 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm | 12 ----------- installer/OpenSLX/OSSetup/Engine.pm | 18 ++-------------- installer/OpenSLX/OSSetup/MetaPackager/smart.pm | 28 +++++++++++++++++++------ installer/OpenSLX/OSSetup/MetaPackager/yum.pm | 15 ++++++++++--- 4 files changed, 36 insertions(+), 37 deletions(-) (limited to 'installer') diff --git a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm index f5a5b3ff..37dabf4d 100644 --- a/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm +++ b/installer/OpenSLX/OSSetup/Distro/SUSE_10_2.pm @@ -959,18 +959,6 @@ sub initDistroInfo zvbi ", }; - - $self->{config}->{'excludes'} = { - # these packages will never be installed: - - 'default' => " - ", - - 'kde' => " - <<>> - ", - }; - } 1; \ No newline at end of file diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm index d53cc6ab..da19ca7f 100644 --- a/installer/OpenSLX/OSSetup/Engine.pm +++ b/installer/OpenSLX/OSSetup/Engine.pm @@ -470,20 +470,6 @@ sub createMetaPackager $self->{'meta-packager'} = $metaPackager; } -sub selectBaseURL -{ - my $self = shift; - my $repoInfo = shift; - - my $baseURL = $repoInfo->{url}; - if (!defined $baseURL) { - my @baseURLs = string2Array($repoInfo->{urls}); - # TODO: insert a closest mirror algorithm here! - $baseURL = $baseURLs[0]; - } - return $baseURL; -} - sub sortRepositoryURLs { my $self = shift; @@ -530,7 +516,7 @@ try_next_url: } } if (!defined $foundFile) { - if ($tryCount < $maxTryCount) { + if (!$ENV{SLX_NO_MIRRORS} && $tryCount < $maxTryCount) { $tryCount++; $self->{'baseURL-index'} = ($self->{'baseURL-index'}+1) % scalar(@URLs); @@ -538,7 +524,7 @@ try_next_url: $URLs[$self->{'baseURL-index'}]); goto try_next_url; } - die _tr("unable to fetch '%s' from any mirrors!\n", + die _tr("unable to fetch '%s' from any source!\n", $fileVariantStr); } push @foundFiles, $foundFile; diff --git a/installer/OpenSLX/OSSetup/MetaPackager/smart.pm b/installer/OpenSLX/OSSetup/MetaPackager/smart.pm index c4b9735d..bef44ddc 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/smart.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/smart.pm @@ -48,6 +48,10 @@ sub initPackageSources my $self = shift; slxsystem("rm -f /etc/smart/channels/*"); + # remove channel if it already exists + if (slxsystem("smart channel -y --remove-all")) { + die _tr("unable to remove existing channels (%s)\n", $!); + } } sub setupPackageSource @@ -55,17 +59,29 @@ sub setupPackageSource my $self = shift; my $repoName = shift; my $repoInfo = shift; + my $excludeList = shift; - my $repoURL = $self->{engine}->selectBaseURL($repoInfo); + my $repoSubdir; if (length($repoInfo->{'repo-subdir'})) { - $repoURL .= "/$repoInfo->{'repo-subdir'}"; + $repoSubdir = "/$repoInfo->{'repo-subdir'}"; } - my $repoDescrCmdline - = qq[$repoName name="$repoInfo->{name}" baseurl=$repoURL]; - $repoDescrCmdline .= " type=rpm-md"; - if (slxsystem("smart channel -y --add $repoDescrCmdline")) { + my $repoURLs = $self->{engine}->sortRepositoryURLs($repoInfo); + my $baseURL = shift @$repoURLs; + my $repoDescr + = qq[$repoName name="$repoInfo->{name}" baseurl=$baseURL$repoSubdir]; + $repoDescr .= " type=rpm-md"; + if (slxsystem("smart channel -y --add $repoDescr")) { die _tr("unable to add channel '%s' (%s)\n", $repoName, $!); } + unless ($ENV{SLX_NO_MIRRORS}) { + my $mirrorDescr; + foreach my $mirrorURL (@$repoURLs) { + $mirrorDescr .= " --add $baseURL$repoSubdir $mirrorURL$repoSubdir"; + } + if (slxsystem("smart mirror $mirrorDescr")) { + die _tr("unable to add mirrors for channel '%s' (%s)\n", $repoName, $!); + } + } } sub installSelection diff --git a/installer/OpenSLX/OSSetup/MetaPackager/yum.pm b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm index acdb470d..6be391f0 100644 --- a/installer/OpenSLX/OSSetup/MetaPackager/yum.pm +++ b/installer/OpenSLX/OSSetup/MetaPackager/yum.pm @@ -58,11 +58,20 @@ sub setupPackageSource my $repoInfo = shift; my $excludeList = shift; - my $repoURL = $self->{engine}->selectBaseURL($repoInfo); + my $repoSubdir; if (length($repoInfo->{'repo-subdir'})) { - $repoURL .= "/$repoInfo->{'repo-subdir'}"; + $repoSubdir = "/$repoInfo->{'repo-subdir'}"; + } + my $repoURLs = $self->{engine}->sortRepositoryURLs($repoInfo); + my $baseURL = shift @$repoURLs; + + my $repoDescr + = "[$repoName]\nname=$repoInfo->{name}\nbaseurl=$baseURL$repoSubdir\n"; + unless ($ENV{SLX_NO_MIRRORS}) { + foreach my $mirrorURL (@$repoURLs) { + $repoDescr .= " $mirrorURL$repoSubdir\n"; + } } - my $repoDescr = "[$repoName]\nname=$repoInfo->{name}\nbaseurl=$repoURL\n"; my $repoFile = "/etc/yum.repos.d/$repoName.repo"; open(REPO, "> $repoFile") or die _tr("unable to create repo-file <%s> (%s)\n", $repoFile, $1); -- cgit v1.2.3-55-g7522