Hello community,

here is the log from the commit of package perl-Bootloader for openSUSE:Factory 
checked in at 2013-10-17 14:25:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Bootloader (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Bootloader.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Bootloader"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Bootloader/perl-Bootloader.changes  
2013-10-02 13:32:06.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Bootloader.new/perl-Bootloader.changes     
2013-10-17 17:43:24.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Oct 15 13:09:05 CEST 2013 - snw...@suse.de
+
+- more flexible GetProduct() uses /etc/os-release (bnc #845606)
+- 0.711
+
+-------------------------------------------------------------------
@@ -4 +10 @@
-- grub2-efi: fix installation boot parameters not written (bnc#824609)
+- grub2-efi: fix installation boot parameters not written

Old:
----
  perl-Bootloader-0.710.tar.xz

New:
----
  perl-Bootloader-0.711.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Bootloader.spec ++++++
--- /var/tmp/diff_new_pack.j6JyNd/_old  2013-10-17 17:43:36.000000000 +0200
+++ /var/tmp/diff_new_pack.j6JyNd/_new  2013-10-17 17:43:36.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Bootloader
-Version:        0.710
+Version:        0.711
 Release:        0
 Requires:       coreutils
 Requires:       e2fsprogs

++++++ perl-Bootloader-0.710.tar.xz -> perl-Bootloader-0.711.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/perl-Bootloader-0.710/perl-Bootloader.changes 
new/perl-Bootloader-0.711/perl-Bootloader.changes
--- old/perl-Bootloader-0.710/perl-Bootloader.changes   2013-10-01 
09:10:52.000000000 +0200
+++ new/perl-Bootloader-0.711/perl-Bootloader.changes   2013-10-15 
13:10:14.000000000 +0200
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Tue Oct 15 13:09:05 CEST 2013 - snw...@suse.de
+
+- more flexible GetProduct() uses /etc/os-release (bnc #845606)
+- 0.711
+
+-------------------------------------------------------------------
 Tue Oct  1 09:10:04 CEST 2013 - snw...@suse.de
 
 - grub2-efi: fix installation boot parameters not written
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/perl-Bootloader-0.710/update-bootloader 
new/perl-Bootloader-0.711/update-bootloader
--- old/perl-Bootloader-0.710/update-bootloader 2013-08-26 14:31:58.000000000 
+0200
+++ new/perl-Bootloader-0.711/update-bootloader 2013-10-15 13:06:31.000000000 
+0200
@@ -23,6 +23,8 @@
     = ('','','','','',undef);
 my $add_product = 0;
 
+my $logger;
+
 =head1 NAME
 
 update-bootloader - update/change bootloader configuration using
@@ -122,41 +124,64 @@
 
 =cut
 
-# Get product name and version
-# If zypper is not available or versions is empty, use /etc/SuSE-release 
instead
-# linux is last possible fallback
- 
+# Get product name.
+# If zypper is not available use /etc/products.d/baseproduct and 
/etc/SuSE-release.
 sub GetProduct {
-    my $namever;
-    my $loader = Bootloader::Tools::GetBootloader();
-     
-    # first try: use zypper
-    if ( -f '/usr/bin/zypper' ){
-      my $zypper_out = qx{zypper --terse tos -l};
-      if ($zypper_out =~ 
m/^labelLong\s*(\S.*\S)\s*\nlabelShort\s*(\S.*\S)[\s\n]*$/){
-        return $1 if ($1 ne "" && ($loader eq "grub" || $loader eq "grub2" || 
$loader eq "grub2-efi"));
-        return $2 if ($2 ne "");
-      }
+  my $prod;
+  my $src;
+  my $loader = Bootloader::Tools::GetBootloader();
+  my $long_names_ok = $loader eq "grub" || $loader eq "grub2" || $loader eq 
"grub2-efi";
+ 
+  # 1st try: ask zypper
+  # note: may fail as older zypper versions don't support '--label'
+  if(-x '/usr/bin/zypper') {
+    if(`zypper --terse targetos --label 2>/dev/null` =~ 
/^labelLong\s*(.*?)\s*\nlabelShort\s*(.*?)\s*$/) {
+      $prod = $1 ne "" && $long_names_ok ? $1 : $2;
+      $src = "zypper";
     }
+  }
 
+  # 2nd try: read /etc/products.d/baseproduct
+  if($prod eq "" && open(my $f, "</etc/products.d/baseproduct")) {
+    my $tag = $long_names_ok ? "summary" : "shortsummary";
+    while(<$f>) {
+      $prod = $1 if /<$tag>\s*(.*?)\s*<\/$tag>/o;
+    }
+    close $f;
+    $src = "baseproduct";
+  }
 
-    # Second try: Is there a usable /etc/SuSE-release?
-    # This should really not be used anymore, as the syntax changed
-    # no 'SP1' in the output. 
-    if (open(RELEASE, "</etc/SuSE-release") && ($loader eq "grub" || $loader 
eq "grub2" || $loader eq "grub2-efi")) {
-       # first line is sufficient
-       $namever = <RELEASE>;
-
-       # delete everything starting with the first parenthesis
-       $namever =~ s/\s*\(.*//; 
-
-       close(RELEASE);
-       chomp $namever;
-       return "$namever";
+  # 3rd try: read /etc/os-release
+  if($prod eq "" && $long_names_ok && open(my $f, "</etc/os-release")) {
+    while(<$f>) {
+      $prod = $1, last if /^\s*PRETTY_NAME\s*=(.*?)\(/;
     }
+    close $f;
+    $prod =~ s/^\s*"?\s*//;
+    $prod =~ s/\s*"?\s*$//;
+    $prod = ">$prod<";
+    $src = "os-release";
+  }
+
+  # 4th try: read /etc/SuSE-release
+  if($prod eq "" && $long_names_ok && open(my $f, "</etc/SuSE-release")) {
+    ($prod = <$f>) =~ s/\s*\(.*//s;
+    while(<$f>) {
+      $prod .= " SP$1", last if /^\s*PATCHLEVEL\s*=\s*(\d+)/ && $1 > 0;
+    }
+    close $f;
+    $src = "SuSE-release";
+  }
+
+  # the last line of defense...
+  if($prod eq "") {
+    $prod = "Linux";
+    $src = "fallback";
+  }
+
+  $logger->milestone("update-bootloader::GetProduct($src) = $prod");
 
-    # the last line of defense ...
-    return "Linux";
+  return $prod;
 }
 
 sub test_gettext {
@@ -203,7 +228,7 @@
 die("Option 'force-default' is only allowed for operation 'add'\n")
     if ($opt_force_default and not defined $oper{add});
     
-my $logger = Bootloader::Library->new();
+$logger = Bootloader::Library->new();
 
 $logger->milestone($cmdline);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/perl-Bootloader-0.710/version 
new/perl-Bootloader-0.711/version
--- old/perl-Bootloader-0.710/version   2013-10-01 09:09:56.000000000 +0200
+++ new/perl-Bootloader-0.711/version   2013-10-15 13:08:34.000000000 +0200
@@ -1 +1 @@
-0.710
+0.711

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to