svn commit: r527552 - in head/sysutils/bsdstats: . files

Lorenzo Salvadore salvadore at FreeBSD.org
Sun Mar 1 13:27:23 UTC 2020


Author: salvadore
Date: Sun Mar  1 13:27:22 2020
New Revision: 527552
URL: https://svnweb.freebsd.org/changeset/ports/527552

Log:
  Update sysutils/bsdstats to 6.2
  
  - Fix files/300.statistics.in so that it can work with the new output
    format of pciconf -l in 13.0-CURRENT.
  - Fix a bug in device reporting.
  - Add support for ports reporting from MidnightBSD systems, whose ports
    tree is based on FreeBSD ports tree.
  - Changes to using /usr/bin/nc on DragonFly BSD, whose ports tree is based
    on FreeBSD ports tree.
  - Assume maintainership of sysutils/bsdstats. [1]
  
  PR:		229347
  Submitted by:	scrappy
  Approved by:	yuri (maintainer) [1], gerald (mentor)

Modified:
  head/sysutils/bsdstats/Makefile
  head/sysutils/bsdstats/files/300.statistics.in

Modified: head/sysutils/bsdstats/Makefile
==============================================================================
--- head/sysutils/bsdstats/Makefile	Sun Mar  1 13:07:40 2020	(r527551)
+++ head/sysutils/bsdstats/Makefile	Sun Mar  1 13:27:22 2020	(r527552)
@@ -2,12 +2,11 @@
 # $FreeBSD$
 
 PORTNAME=	bsdstats
-PORTVERSION=	6.0
-PORTREVISION=	2
+PORTVERSION=	6.2
 CATEGORIES=	sysutils
 DISTFILES=
 
-MAINTAINER=	yuri at FreeBSD.org
+MAINTAINER=	salvadore at FreeBSD.org
 COMMENT=	Monthly script for reporting anonymous statistics about your machine
 
 LICENSE=	BSD4CLAUSE

Modified: head/sysutils/bsdstats/files/300.statistics.in
==============================================================================
--- head/sysutils/bsdstats/files/300.statistics.in	Sun Mar  1 13:07:40 2020	(r527551)
+++ head/sysutils/bsdstats/files/300.statistics.in	Sun Mar  1 13:27:22 2020	(r527552)
@@ -26,24 +26,12 @@ WC=/usr/bin/wc
 MV=/bin/mv
 RM=/bin/rm
 case $(${UNAME}) in
-  FreeBSD)
-    UMASK=/usr/bin/umask
-    OPENSSL=/usr/bin/openssl
-    CHOWN=/usr/sbin/chown
-    NC=/usr/bin/nc
-    ;;
   OpenBSD)
     UMASK=/usr/bin/umask
     OPENSSL=/usr/sbin/openssl
     CHOWN=/sbin/chown
     NC=/usr/bin/nc
     ;;
-  DragonFly)
-    UMASK=/usr/bin/umask
-    OPENSSL=/usr/bin/openssl
-    CHOWN=/usr/sbin/chown
-    NC=/usr/local/bin/netcat
-    ;;
   NetBSD)
     UMASK=umask
     OPENSSL=/usr/bin/openssl
@@ -351,16 +339,24 @@ setup_proxies() {
 
 report_devices() {
   case $(${UNAME}) in
-    FreeBSD|DragonFly)
+    FreeBSD|DragonFly|MidnightBSD)
       local query_string=""
       local line
-      for line in $(${PCICONF} -l); do
+      while read line
+      do
         local DRIVER=$(echo "${line}" | ${AWK} -F\@ '{print $1}')
-        local DEV=$(echo "${line}" | ${AWK} '{print $4}' | ${CUT} -c8-15)
+        if [ "0`echo "${line}" | awk '{print $5}' | awk -F= '{print $1}'`" = "0vendor" ]; then
+          local VENDOR=$(echo "${line}" | ${AWK} '{print $5}' | ${CUT} -c10-15)
+          local DEVICE=$(echo "${line}" | ${AWK} '{print $6}' | ${CUT} -c10-15)
+          local DEV=$(echo "${DEVICE}${VENDOR}")
+        else
+          local DEV=$(echo "${line}" | ${AWK} '{print $4}' | ${CUT} -c8-15)
+        fi
         local CLASS=$(echo "${line}" | ${AWK} '{print $2}' | ${CUT} -c9-14)
         query_string=$query_string`echo \&dev[]=${DRIVER}:${DEV}:${CLASS}`
-      done
-
+      done << EOT
+$(${PCICONF} -l)
+EOT
       echo_begin "Posting device statistics to ${checkin_server_description}"
       do_http_request_check_status "GET" "/scripts/report_devices.php?token=${TOKEN}&key=${KEY}$query_string" \
         "" "" "system devices submission"
@@ -373,14 +369,30 @@ report_devices() {
   esac
 }
 
+get_mports() {
+  for i in `/usr/libexec/mport.list | xargs`
+  do
+    pkg=$(echo "select pkg from packages where pkg || '-' || version = '$i'" | sqlite3 /var/db/mport/master.db)
+    echo -n "$i "
+    mport info $pkg | grep Origin | awk '{print $3}'
+  done
+}
+
 report_ports() {
   case $(${UNAME}) in
-    FreeBSD|DragonFly)
+    FreeBSD|DragonFly|MidnightBSD)
       local query_string=""
       # Detect pkgng
       if [ -e /var/db/pkg/local.sqlite ]; then
         # Use pkgng
-        query_string="${query_string}$(pkg info -o "*" | ${SED} -E -e 's/\+/%2b/g' -e 's/,/%2c/g' -e 's/^([^ ]+) +([^\/]+)\/.+$/\&port[]=\2:\1/g' | tr -d '\n')"
+        case $(${UNAME}) in
+          MidnightBSD)
+            query_string="${query_string}$( get_mports | ${SED} -E -e 's/\+/%2b/g' -e 's/,/%2c/g' -e 's/^([^ ]+) +([^\/]+)\/.+$/\&port[]=\2:\1/g' | tr -d '\n')"
+            ;;
+          *)
+            query_string="${query_string}$( pkg info -o "*" | ${SED} -E -e 's/\+/%2b/g' -e 's/,/%2c/g' -e 's/^([^ ]+) +([^\/]+)\/.+$/\&port[]=\2:\1/g' | tr -d '\n')"
+            ;;
+        esac
       else
     #-----BEGIN LEGACY: to delete when FreeBSD with pkg_ tools is out of support period (!!! don't forget to clarify what does DragonFly use before removing !!!) -----
         # Use obsolete pkg_* tools


More information about the svn-ports-all mailing list