pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/p5-FusionInventory-Agent Improves NetBSD suport: u...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0aceec127bc0
branches:  trunk
changeset: 452206:0aceec127bc0
user:      bouyer <bouyer%pkgsrc.org@localhost>
date:      Thu May 06 20:25:15 2021 +0000

description:
Improves NetBSD suport: use (and parse) /var/run/dmesg.boot if present,
use pcictl if present, use NetBSD sysctls when present.
Bump PKGREVISION

diffstat:

 net/p5-FusionInventory-Agent/Makefile                                                               |    4 +-
 net/p5-FusionInventory-Agent/distinfo                                                               |   10 +-
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD.pm          |   19 +
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Alpha.pm    |   26 +
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_MIPS.pm     |   29 +
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_SPARC.pm    |   26 +
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Storages.pm |  155 ++++++++++
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_Generic_PCI.pm  |   15 +
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Tools_BSD.pm                   |   39 ++
 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Tools_Generic.pm               |  153 +++++++++
 10 files changed, 474 insertions(+), 2 deletions(-)

diffs (truncated from 535 to 300 lines):

diff -r 82e52a144382 -r 0aceec127bc0 net/p5-FusionInventory-Agent/Makefile
--- a/net/p5-FusionInventory-Agent/Makefile     Thu May 06 20:19:43 2021 +0000
+++ b/net/p5-FusionInventory-Agent/Makefile     Thu May 06 20:25:15 2021 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.19 2021/05/03 17:12:23 bouyer Exp $
+# $NetBSD: Makefile,v 1.20 2021/05/06 20:25:15 bouyer Exp $
 
 DISTNAME=      FusionInventory-Agent-2.6
 PKGNAME=       p5-${DISTNAME}
+PKGREVISION=   1
 CATEGORIES=    net perl5
 MASTER_SITES=  ${MASTER_SITE_PERL_CPAN:=../../authors/id/G/GB/GBOUGARD/}
 
@@ -32,6 +33,7 @@
 DEPENDS+=      p5-IO-Capture-[0-9]*:../../devel/p5-IO-Capture
 DEPENDS+=      p5-IPC-Run-[0-9]*:../../devel/p5-IPC-Run
 DEPENDS+=      p5-YAML-[0-9]*:../../textproc/p5-YAML
+DEPENDS+=      p5-YAML-Tiny-[0-9]*:../../textproc/p5-YAML-Tiny
 DEPENDS+=      p5-SUPER-[0-9]*:../../devel/p5-SUPER
 DEPENDS+=      p5-Net-SNMP-[0-9]*:../../net/p5-Net-SNMP
 DEPENDS+=      p5-File-Copy-Recursive-[0-9]*:../../sysutils/p5-File-Copy-Recursive
diff -r 82e52a144382 -r 0aceec127bc0 net/p5-FusionInventory-Agent/distinfo
--- a/net/p5-FusionInventory-Agent/distinfo     Thu May 06 20:19:43 2021 +0000
+++ b/net/p5-FusionInventory-Agent/distinfo     Thu May 06 20:25:15 2021 +0000
@@ -1,7 +1,15 @@
-$NetBSD: distinfo,v 1.6 2021/05/03 17:12:23 bouyer Exp $
+$NetBSD: distinfo,v 1.7 2021/05/06 20:25:15 bouyer Exp $
 
 SHA1 (FusionInventory-Agent-2.6.tar.gz) = 288acf5707e550fa10275f8e6fab70b50aa790aa
 RMD160 (FusionInventory-Agent-2.6.tar.gz) = 1d6504f2119bb531c527180c9275bb692b8a1a2a
 SHA512 (FusionInventory-Agent-2.6.tar.gz) = c4d12b17e87f9b7e59c1a7284fb88bb0ab51c22037624f666469c75b993ec5939f3f88752afdab82b5d35972c76fbc36a49c6fd1f5246481efb8adf893b4fa3f
 Size (FusionInventory-Agent-2.6.tar.gz) = 2819730 bytes
 SHA1 (patch-Makefile.PL) = d01414b74fa3bbd9bedb658b39d3a07074274142
+SHA1 (patch-lib_FusionInventory_Agent_Task_Inventory_BSD.pm) = 7548564a13a16c0f9da9f8d0df5a6fe5e63079f1
+SHA1 (patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Alpha.pm) = ba0bd79e697ac5c9a39ffe70ce26575cc88846a2
+SHA1 (patch-lib_FusionInventory_Agent_Task_Inventory_BSD_MIPS.pm) = c5449c5181f92984cfe129dbca5e11d69094c424
+SHA1 (patch-lib_FusionInventory_Agent_Task_Inventory_BSD_SPARC.pm) = 48fcf497b55efcd17dd34d8807fa6dc091303169
+SHA1 (patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Storages.pm) = a2ffacd0b9ee84accc001b2013aa52a0c0dc419f
+SHA1 (patch-lib_FusionInventory_Agent_Task_Inventory_Generic_PCI.pm) = 94f5afb7b4277a1729c322c7111c94481e1cbe34
+SHA1 (patch-lib_FusionInventory_Agent_Tools_BSD.pm) = d312bc244889beb7c747a4c8b021590102a8294c
+SHA1 (patch-lib_FusionInventory_Agent_Tools_Generic.pm) = 1e8cc8d8ff4c03ba563c3c63ed348e22bd665e9d
diff -r 82e52a144382 -r 0aceec127bc0 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD.pm        Thu May 06 20:25:15 2021 +0000
@@ -0,0 +1,19 @@
+$NetBSD: patch-lib_FusionInventory_Agent_Task_Inventory_BSD.pm,v 1.1 2021/05/06 20:25:15 bouyer Exp $
+
+Adjust for NetBSD's sysctl kern.boottime output
+
+--- lib/FusionInventory/Agent/Task/Inventory/BSD.pm.orig       2021-05-05 00:17:48.974000555 +0200
++++ lib/FusionInventory/Agent/Task/Inventory/BSD.pm    2021-05-05 00:20:26.256041770 +0200
+@@ -28,6 +28,12 @@
+         command => "sysctl -n kern.boottime",
+         pattern => qr/sec = (\d+)/
+     );
++    if (! defined($boottime)) {
++        $boottime = getFirstMatch(
++            command => "sysctl -n kern.boottime",
++            pattern => qr/(\d+)/
++        );
++    }
+ 
+     my $name = canRun('lsb_release') ?
+         getFirstMatch(
diff -r 82e52a144382 -r 0aceec127bc0 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Alpha.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Alpha.pm  Thu May 06 20:25:15 2021 +0000
@@ -0,0 +1,26 @@
+$NetBSD: patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Alpha.pm,v 1.1 2021/05/06 20:25:15 bouyer Exp $
+
+Use /var/run/dmesg.boot if present
+
+--- lib/FusionInventory/Agent/Task/Inventory/BSD/Alpha.pm.orig 2021-05-04 23:00:51.263555904 +0200
++++ lib/FusionInventory/Agent/Task/Inventory/BSD/Alpha.pm      2021-05-04 22:57:35.095417352 +0200
+@@ -42,9 +42,16 @@
+     # CPU: EV45 (21064A) major=6 minor=2
+ 
+     my $cpu;
+-    foreach my $line (getAllLines(command => 'dmesg')) {
+-        if ($line =~ /$bios->{SMODEL},\s*(\S+)\s*MHz/) { $cpu->{SPEED} = $1; }
+-        if ($line =~ /^cpu[^:]*:\s*(.*)$/i)            { $cpu->{NAME} = $1;  }
++    if ( -r "/var/run/dmesg.boot") {
++      foreach my $line (getAllLines(file => '/var/run/dmesg.boot')) {
++            if ($line =~ /$bios->{SMODEL},\s*(\S+)\s*MHz/) { $cpu->{SPEED} = $1; }
++            if ($line =~ /^cpu[^:]*:\s*(.*)$/i)            { $cpu->{NAME} = $1;  }
++      }
++    } else {
++        foreach my $line (getAllLines(command => 'dmesg')) {
++            if ($line =~ /$bios->{SMODEL},\s*(\S+)\s*MHz/) { $cpu->{SPEED} = $1; }
++            if ($line =~ /^cpu[^:]*:\s*(.*)$/i)            { $cpu->{NAME} = $1;  }
++        }
+     }
+ 
+     $inventory->setBios($bios);
diff -r 82e52a144382 -r 0aceec127bc0 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_MIPS.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_MIPS.pm   Thu May 06 20:25:15 2021 +0000
@@ -0,0 +1,29 @@
+$NetBSD: patch-lib_FusionInventory_Agent_Task_Inventory_BSD_MIPS.pm,v 1.1 2021/05/06 20:25:15 bouyer Exp $
+
+Use /var/run/dmesg.boot if present
+
+--- lib/FusionInventory/Agent/Task/Inventory/BSD/MIPS.pm.orig  2021-05-04 23:07:03.767869134 +0200
++++ lib/FusionInventory/Agent/Task/Inventory/BSD/MIPS.pm       2021-05-04 23:08:31.241450459 +0200
+@@ -48,10 +48,18 @@
+     # cpu0: cache L1-I 32KB D 32KB 2 way, L2 512KB direct
+ 
+     my $cpu;
+-    foreach my $line (getAllLines(command => 'dmesg')) {
+-        if ($line =~ /$bios->{SMODEL}\s*\[\S*\s*(\S*)\]/) { $bios->{SSN} = $1; }
+-        if ($line =~ /cpu0 at mainbus0:\s*(.*)$/)         { $cpu->{NAME} = $1; }
+-        if ($line =~ /CPU\s*.*\D(\d+)\s*MHz/)             { $cpu->{SPEED} = $1;  }
++    if ( -r "/var/run/dmesg.boot") {
++      foreach my $line (getAllLines(file => '/var/run/dmesg.boot')) {
++            if ($line =~ /$bios->{SMODEL}\s*\[\S*\s*(\S*)\]/) { $bios->{SSN} = $1; }
++            if ($line =~ /cpu0 at mainbus0:\s*(.*)$/)         { $cpu->{NAME} = $1; }
++            if ($line =~ /CPU\s*.*\D(\d+)\s*MHz/)             { $cpu->{SPEED} = $1;  }
++        }
++    } else {
++      foreach my $line (getAllLines(command => 'dmesg')) {
++            if ($line =~ /$bios->{SMODEL}\s*\[\S*\s*(\S*)\]/) { $bios->{SSN} = $1; }
++            if ($line =~ /cpu0 at mainbus0:\s*(.*)$/)         { $cpu->{NAME} = $1; }
++            if ($line =~ /CPU\s*.*\D(\d+)\s*MHz/)             { $cpu->{SPEED} = $1;  }
++        }
+     }
+ 
+     $inventory->setBios($bios);
diff -r 82e52a144382 -r 0aceec127bc0 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_SPARC.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_SPARC.pm  Thu May 06 20:25:15 2021 +0000
@@ -0,0 +1,26 @@
+$NetBSD: patch-lib_FusionInventory_Agent_Task_Inventory_BSD_SPARC.pm,v 1.1 2021/05/06 20:25:15 bouyer Exp $
+
+Use /var/run/dmesg.boot if present
+
+--- lib/FusionInventory/Agent/Task/Inventory/BSD/SPARC.pm.orig 2021-05-04 23:09:07.913462371 +0200
++++ lib/FusionInventory/Agent/Task/Inventory/BSD/SPARC.pm      2021-05-04 23:09:59.586815307 +0200
+@@ -57,9 +57,16 @@
+     # cpu0: Sun Microsystems UltraSparc-I Processor (167.00 MHz CPU)
+ 
+     my $cpu;
+-    foreach my $line (getAllLines(command => 'dmesg')) {
+-        if ($line=~ /^mainbus0 \(root\):\s*(.*)$/) { $bios->{SMODEL} = $1; }
+-        if ($line =~ /^cpu[^:]*:\s*(.*)$/i)        { $cpu->{NAME}    = $1; }
++    if ( -r "/var/run/dmesg.boot") {
++      foreach my $line (getAllLines(file => '/var/run/dmesg.boot')) {
++            if ($line=~ /^mainbus0 \(root\):\s*(.*)$/) { $bios->{SMODEL} = $1; }
++            if ($line =~ /^cpu[^:]*:\s*(.*)$/i)        { $cpu->{NAME}    = $1; }
++        }
++    } else {
++        foreach my $line (getAllLines(command => 'dmesg')) {
++            if ($line=~ /^mainbus0 \(root\):\s*(.*)$/) { $bios->{SMODEL} = $1; }
++            if ($line =~ /^cpu[^:]*:\s*(.*)$/i)        { $cpu->{NAME}    = $1; }
++        }
+     }
+ 
+     $bios->{SMODEL} =~ s/SUNW,//;
diff -r 82e52a144382 -r 0aceec127bc0 net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Storages.pm
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/p5-FusionInventory-Agent/patches/patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Storages.pm       Thu May 06 20:25:15 2021 +0000
@@ -0,0 +1,155 @@
+$NetBSD: patch-lib_FusionInventory_Agent_Task_Inventory_BSD_Storages.pm,v 1.1 2021/05/06 20:25:15 bouyer Exp $
+
+Use /var/run/dmesg.boot if present
+Use sysctl hw.disknames if present
+match NetBSD disk names
+
+--- lib/FusionInventory/Agent/Task/Inventory/BSD/Storages.pm.orig      2020-08-04 09:36:42.000000000 +0200
++++ lib/FusionInventory/Agent/Task/Inventory/BSD/Storages.pm   2021-05-06 22:14:19.168779300 +0200
+@@ -37,38 +37,68 @@
+         command => $command,
+         %params
+     );
+-    $lines =~ s/^kern.geom.confxml://;
+-    my $tpp = XML::TreePP->new();
+-    my $tree = $tpp->parse($lines);
+-
+-    my @storages = ();
+-    for my $class (@{$tree->{mesh}->{class}}) {
+-        my $name = $class->{name} || $class->{'#name'} || '';
+-        next unless ($name && $name eq 'DISK');
+-        for my $geom (@{$class->{geom}}) {
+-            my $device = {};
+-            $device->{NAME} = $geom->{name} if $geom->{name};
+-            $device->{DESCRIPTION} = $geom->{provider}->{config}->{descr}
+-                if ($geom->{provider}
+-                    && $geom->{provider}->{config}
+-                    && $geom->{provider}->{config}->{descr});
+-            $device->{DISKSIZE} = $geom->{provider}->{mediasize}
+-                if ($geom->{provider}
+-                    && defined $geom->{provider}->{mediasize});
+-            $device->{TYPE} = _retrieveDeviceTypeFromName($device->{NAME});
+-            push @storages, $device;
++    if ($lines =~ /^kern.geom.confxml:/) {
++        $lines =~ s/^kern.geom.confxml://;
++        my $tpp = XML::TreePP->new();
++        my $tree = $tpp->parse($lines);
++    
++        my @storages = ();
++        for my $class (@{$tree->{mesh}->{class}}) {
++            my $name = $class->{name} || $class->{'#name'} || '';
++            next unless ($name && $name eq 'DISK');
++            for my $geom (@{$class->{geom}}) {
++                my $device = {};
++                $device->{NAME} = $geom->{name} if $geom->{name};
++                $device->{DESCRIPTION} = $geom->{provider}->{config}->{descr}
++                    if ($geom->{provider}
++                        && $geom->{provider}->{config}
++                        && $geom->{provider}->{config}->{descr});
++                $device->{DISKSIZE} = $geom->{provider}->{mediasize}
++                    if ($geom->{provider}
++                        && defined $geom->{provider}->{mediasize});
++                $device->{TYPE} = _retrieveDeviceTypeFromName($device->{NAME});
++                push @storages, $device;
++            }
+         }
++    
++        # Unittest support
++        $params{file} = $params{dmesgFile} if ($params{dmesgFile});
++    
++        _extractDataFromDmesg(
++            storages => \@storages,
++            %params
++        );
++    
++        return @storages;
+     }
+-
+-    # Unittest support
+-    $params{file} = $params{dmesgFile} if ($params{dmesgFile});
+-
+-    _extractDataFromDmesg(
+-        storages => \@storages,
++    $command = 'sysctl hw.disknames';
++    $lines = getAllLines(
++        command => $command,
+         %params
+     );
+-
+-    return @storages;
++    if ($lines =~ /^hw.disknames = /) {
++        $lines =~ s/^hw.disknames = //;
++      chop $lines;
++        my @storages = ();
++      foreach my $drive (split / /, $lines) {
++          
++          next if $drive =~ /^vnd/;
++          next if $drive =~ /^dk/;
++          next if $drive =~ /^raid/;
++          next if $drive =~ /^cgd/;
++          next if $drive =~ /^ccd/;
++          next if $drive =~ /^dm/;
++            my $device->{NAME} = $drive;
++            push @storages, $device;
++        }
++    
++        _extractDataFromDmesg(
++            storages => \@storages,
++            %params
++        );
++    
++        return @storages;
++    }
+ }
+ 
+ sub _retrieveDeviceTypeFromName {
+@@ -76,6 +106,10 @@
+     my $type = not (defined $name) ? 'unknown' :
+             $name =~ /^da/ ? 'disk' :
+             $name =~ /^ada/ ? 'disk' :
++            $name =~ /^wd/ ? 'disk' :
++            $name =~ /^sd/ ? 'disk' :
++            $name =~ /^ld/ ? 'disk' :
++            $name =~ /^xbd/ ? 'disk' :
+             $name =~ /^cd/ ? 'cdrom' :
+                 'unknown';
+     return $type;
+@@ -85,11 +119,19 @@
+     my (%params) = @_;
+ 
+     my $storages = $params{storages};
++    my $dmesgLines;
+ 
+-    my $dmesgLines = getAllLines(
+-        command => 'dmesg',
+-        %params
+-    );
++    if ( -r "/var/run/dmesg.boot") {
++        $dmesgLines = getAllLines(
++            file => '/var/run/dmesg.boot',
++            %params
++        );
++    } else {
++        $dmesgLines = getAllLines(
++            command => 'dmesg',
++            %params
++        );
++    }
+     for my $storage (@$storages) {
+         next unless $storage->{NAME};



Home | Main Index | Thread Index | Old Index