Hello community, here is the log from the commit of package perl-Bootloader checked in at Wed Aug 15 20:35:18 CEST 2007. -------- --- perl-Bootloader/perl-Bootloader.changes 2007-08-13 22:54:17.000000000 +0200 +++ /mounts/work_src_done/STABLE/perl-Bootloader/perl-Bootloader.changes 2007-08-14 18:04:43.000000000 +0200 @@ -1,0 +2,8 @@ +Tue Aug 14 18:01:21 CEST 2007 - aosthof@suse.de + +- Implemented new function AdaptCommentLine in Tools.pm which + adapts YaST-like comments in existing sections to be handled + properly by yast-bootloader (#283709) +- Version bump to 0.4.21 + +------------------------------------------------------------------- Old: ---- perl-Bootloader-0.4.20.tar.bz2 New: ---- perl-Bootloader-0.4.21.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Bootloader.spec ++++++ --- /var/tmp/diff_new_pack.Lf9626/_old 2007-08-15 20:35:14.000000000 +0200 +++ /var/tmp/diff_new_pack.Lf9626/_new 2007-08-15 20:35:14.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package perl-Bootloader (Version 0.4.20) +# spec file for package perl-Bootloader (Version 0.4.21) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,7 +11,7 @@ # norootforbuild Name: perl-Bootloader -Version: 0.4.20 +Version: 0.4.21 Release: 1 Requires: perl >= %{perl_version} Requires: perl-gettext @@ -66,6 +66,11 @@ /usr/lib/bootloader %changelog +* Tue Aug 14 2007 - aosthof@suse.de +- Implemented new function AdaptCommentLine in Tools.pm which + adapts YaST-like comments in existing sections to be handled + properly by yast-bootloader (#283709) +- Version bump to 0.4.21 * Mon Aug 13 2007 - od@suse.de - feature #302302: - removed CreateChainloaderLine() function and call again: ++++++ perl-Bootloader-0.4.20.tar.bz2 -> perl-Bootloader-0.4.21.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/perl-Bootloader-0.4.20/lib/Bootloader/Core/GRUB.pm new/perl-Bootloader-0.4.21/lib/Bootloader/Core/GRUB.pm --- old/perl-Bootloader-0.4.20/lib/Bootloader/Core/GRUB.pm 2007-08-13 22:52:09.000000000 +0200 +++ new/perl-Bootloader-0.4.21/lib/Bootloader/Core/GRUB.pm 2007-08-14 14:17:16.000000000 +0200 @@ -1424,6 +1424,9 @@ $grub_root = $self->UnixDev2GrubDev ($grub_root); } elsif ($type eq "menu" or $type eq "other") { + # FIXME: using the boot device of the current installation as the + # "root" parameter in sections for other installations does not make + # sense to me -- are there cases where this does make sense? my ($boot_dev,) = $self->SplitDevPath ("/boot"); $grub_root = $self->UnixDev2GrubDev ( exists $sectinfo{"root"} ? delete($sectinfo{"root"}) : $boot_dev @@ -1496,6 +1499,29 @@ } elsif ($key eq "chainloader") { + # This handles chainloader lines that specify a device name only -- + # a single block offset may have been passed down in our internal + # variable "blockoffset": this will be added to the constructed + # "chainloader" line. + # + # The general case, i.e. translating between + # "/dev/disk/by-label/testlabel/boot/grub/stage1" and + # "(hd0,1)/boot/grub/stage1" cannot be handled with our device name + # translation scheme. There is no reliable way to find the end of + # the device name in the above string, esp. since the device does + # not necessarily exist yet. + # + # Probably a different interface is needed to reliably pass + # "converted GRUB paths" that include UNIX device names between us + # and the upper layers. + # + # The same problem exists e.g. for "configfile" entries, but there + # we have no "common simple case" that we could still handle (as we + # do in the "chainloader" case). We usually would need to translate + # between "/dev/disk/by-label/testlabel/boot/grub/menu.lst" and + # "(hd0,3)/boot/grub/menu.lst". We rather choose to require the + # device in the "root" key and do not expect and handle UNIX device + # names in the "configfile" value at all. if ($type eq "other" and defined ($sectinfo{$key})) { $line_ref->{"value"} = $self->CreateChainloaderLine (\%sectinfo, $grub_root); delete ($sectinfo{$key}); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/perl-Bootloader-0.4.20/lib/Bootloader/Tools.pm new/perl-Bootloader-0.4.21/lib/Bootloader/Tools.pm --- old/perl-Bootloader-0.4.20/lib/Bootloader/Tools.pm 2007-08-01 17:32:06.000000000 +0200 +++ new/perl-Bootloader-0.4.21/lib/Bootloader/Tools.pm 2007-08-14 18:04:43.000000000 +0200 @@ -68,6 +68,8 @@ C<< Bootloader::Tools::GetSection($name); >> +C<< Bootloader::Tools::AdaptCommentLine($old_sections_ref, $original_name); >> + C<< Bootloader::Tools::AddSection($name, @params); >> C<< Bootloader::Tools::RemoveSections($name); >> @@ -90,7 +92,8 @@ RemoveImageSections GetDefaultImage GetDefaultInitrd GetBootloader UpdateBootloader GetGlobals SetGlobals - GetSectionList GetSection AddSection RemoveSections + GetSectionList GetSection AdaptCommentLine + AddSection RemoveSections ); use Bootloader::Library; @@ -1060,6 +1063,74 @@ =item +C<< Bootloader::Tools::AdaptCommentLine($old_sections_ref, $original_name); >> + +Adapt YaST-like comments in already existing sections to be handled correctly +by yast2-bootloader. Returns reference to sections array with adapted comment +lines. + +EXAMPLE: + + my $old_sections_ref = $lib_ref->GetSections (); + my $adapted_sections_ref = ""; + my $original_name = "linux"; + + $adapted_sections = Bootloader::Tools::AdaptCommentLine ($old_sections_ref, $original_name); + +=cut + +sub AdaptCommentLine { + my $sections_ref = shift; + my $original_name = shift; + + return unless defined $sections_ref; + return unless defined $original_name; + + my $comment_string = "###Don't change this comment - YaST2 identifier: Original name: "; + + # Adapt YaST-like comment in __lines member of sections array + foreach my $sect_ref (@$sections_ref) { + + my $lines_ref = $sect_ref->{"__lines"}; + + # Only check sections referring to a real kernel or xen image + if ($sect_ref->{"type"} eq "image" or $sect_ref->{"type"} eq "xen") { + foreach my $line_ref (@$lines_ref) { + + my $comment = $line_ref->{"comment_before"}; + my @temp = grep m/$original_name###/, @$comment; + + # Only lines containing the section title need to be checked + if ($line_ref->{"key"} eq "title" and scalar @temp > 0) { + + # Determine version and flavor of section to be adapted + my $version_and_flavor = $sect_ref->{"initrd"}; + $version_and_flavor =~ s/^[^-]+//; + + my $adapted_comment = $comment_string . $original_name . $version_and_flavor . "###"; + + # Finally, adapt the comment line + $line_ref->{"comment_before"} = [$adapted_comment]; + } + } + } + + # Remove empty lines + foreach my $line_ref (@$lines_ref) { + if ($line_ref->{"key"} eq "title") { + @{$line_ref->{"comment_before"}} = grep m/\S/, @{$line_ref->{"comment_before"}}; + } + } + + # Set new comment line, thus commit changes made + $sect_ref->{"__lines"} = $lines_ref; + } + + return @$sections_ref; +} + + +=item C<< Bootloader::Tools::AddSection($name, @params); >> Add a new section (boot entry) to config file, e.g. to /boot/grub/menu.lst @@ -1087,6 +1158,10 @@ my $mp = $lib_ref->GetMountPoints (); my @sections = @{$lib_ref->GetSections ()}; + + # Adapt YaST-like comment lines in old sections + @sections = AdaptCommentLine (\@sections, $option{"original_name"}); + my %new = ( "root" => $mp->{"/"} || "/dev/null", ); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org