From owner-svn-ports-all@freebsd.org Thu Apr 30 23:32:19 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 694FA2CB5E3; Thu, 30 Apr 2020 23:32:19 +0000 (UTC) (envelope-from salvadore@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Cs9b26whz4C7p; Thu, 30 Apr 2020 23:32:19 +0000 (UTC) (envelope-from salvadore@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 442AE26D13; Thu, 30 Apr 2020 23:32:19 +0000 (UTC) (envelope-from salvadore@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UNWJrC077670; Thu, 30 Apr 2020 23:32:19 GMT (envelope-from salvadore@FreeBSD.org) Received: (from salvadore@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UNWIqn077664; Thu, 30 Apr 2020 23:32:18 GMT (envelope-from salvadore@FreeBSD.org) Message-Id: <202004302332.03UNWIqn077664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: salvadore set sender to salvadore@FreeBSD.org using -f From: Lorenzo Salvadore Date: Thu, 30 Apr 2020 23:32:18 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r533478 - in head/sysutils/bsdstats: . files X-SVN-Group: ports-head X-SVN-Commit-Author: salvadore X-SVN-Commit-Paths: in head/sysutils/bsdstats: . files X-SVN-Commit-Revision: 533478 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 23:32:19 -0000 Author: salvadore Date: Thu Apr 30 23:32:18 2020 New Revision: 533478 URL: https://svnweb.freebsd.org/changeset/ports/533478 Log: sysutils/bsdstats: Update to 7.0 - Use pkg query %n:%v:%o instead of pkg info -o “*” to get list of installed packages. This simplifies processing and accuracy of split for version numbers on the report server by not having to guess where that split is. - Check for existence of %%PREFIX%%/etc/bsdstats.conf and if it exists, restrict ports submitted to those listed in there. - Add a note to pkg-message.in about %%PREFIX%%/etc/bsdstats.conf - Get rid of the LIMITED config option: LIMITED is enabled if and only if %%PREFIX%%/etc/bsdstats.conf exists. While here, also modernize the port using option helpers. Submitted by: scrappy Approved by: gerald (mentor) Differential Revision: https://reviews.freebsd.org/D24644 Modified: head/sysutils/bsdstats/Makefile head/sysutils/bsdstats/files/300.statistics.in head/sysutils/bsdstats/files/pkg-message.in Modified: head/sysutils/bsdstats/Makefile ============================================================================== --- head/sysutils/bsdstats/Makefile Thu Apr 30 21:38:37 2020 (r533477) +++ head/sysutils/bsdstats/Makefile Thu Apr 30 23:32:18 2020 (r533478) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= bsdstats -PORTVERSION= 6.2 +PORTVERSION= 7.0 CATEGORIES= sysutils DISTFILES= @@ -17,28 +17,23 @@ SUB_FILES= 300.statistics bsdstats-send pkg-message SUB_LIST+= VERSION=${PORTVERSION} NO_ARCH= YES -OPTIONS_DEFINE= TOR -TOR_DESC= Submit securely through TOR anonymity network - PLIST_FILES= bin/bsdstats-send \ etc/periodic/monthly/300.statistics -.include +OPTIONS_DEFINE= TOR +TOR_DESC= Submit securely through TOR anonymity network -.if ${PORT_OPTIONS:MTOR} -RUN_DEPENDS+= tor:security/tor -.endif +TOR_RUN_DEPENDS= tor:security/tor -pre-install: -.if ${PORT_OPTIONS:MTOR} +pre-install-TOR-on: @${REINPLACE_CMD} -e 's|USE_TOR=NO|USE_TOR=YES|' ${WRKDIR}/300.statistics @${REINPLACE_CMD} -e 's|# REQUIRE: LOGIN|# REQUIRE: LOGIN tor|' ${WRKDIR}/bsdstats @${REINPLACE_CMD} -e 's|@@TOR_MESSAGE@@|Statistics will be submitted anonymously through the TOR network|' \ ${WRKDIR}/pkg-message -.else + +pre-install-TOR-off: @${REINPLACE_CMD} -e 's|@@TOR_MESSAGE@@|You can build bsdstats with TOR port option to submit anonymously|' \ ${WRKDIR}/pkg-message -.endif do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/monthly @@ -47,4 +42,4 @@ do-install: ${INSTALL_SCRIPT} ${WRKDIR}/bsdstats-send \ ${STAGEDIR}${PREFIX}/bin/bsdstats-send -.include +.include Modified: head/sysutils/bsdstats/files/300.statistics.in ============================================================================== --- head/sysutils/bsdstats/files/300.statistics.in Thu Apr 30 21:38:37 2020 (r533477) +++ head/sysutils/bsdstats/files/300.statistics.in Thu Apr 30 23:32:18 2020 (r533478) @@ -387,13 +387,20 @@ report_ports() { # Use pkgng case $(${UNAME}) in MidnightBSD) + report_uri="/scripts/report_ports.php" 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')" + report_uri="/scripts/report_ports_v2.php" + if [ -f %%PREFIX%%/etc/bsdstats.conf -a "0" = "0`grep ^all-ports /usr/local/etc/bsdstats.conf`" ]; then + query_string=$( pkg query %n:%v:%o | fgrep -f %%PREFIX%%/etc/bsdstats.conf | awk -F\/ '{print $1}' | sed -E -e 's/\+/%2b/g' -e 's/,/%2c/g' | awk '{printf"&port[]=%s", $1}' ) + else + query_string=$( pkg query %n:%v:%o | awk -F\/ '{print $1}' | sed -E -e 's/\+/%2b/g' -e 's/,/%2c/g' | awk '{printf"&port[]=%s", $1}' ) + fi ;; esac else + report_uri="/scripts/report_ports.php" #-----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 local line @@ -406,7 +413,7 @@ report_ports() { #-----END LEGACY----- fi echo_begin "Posting port statistics to ${checkin_server_description}" - do_http_request_check_status "POST" "/scripts/report_ports.php" \ + do_http_request_check_status "POST" $report_uri \ "token=${TOKEN}&key=${KEY}${query_string}" "application/x-www-form-urlencoded" "ports submission" echo_end_success log "INFO" "Posted port statistics to ${checkin_server_description}" Modified: head/sysutils/bsdstats/files/pkg-message.in ============================================================================== --- head/sysutils/bsdstats/files/pkg-message.in Thu Apr 30 21:38:37 2020 (r533477) +++ head/sysutils/bsdstats/files/pkg-message.in Thu Apr 30 23:32:18 2020 (r533478) @@ -1,7 +1,7 @@ [ { type: install message: <