From owner-svn-ports-all@FreeBSD.ORG Wed Jun 4 15:42:36 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 493C730F; Wed, 4 Jun 2014 15:42:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A12B2050; Wed, 4 Jun 2014 15:42:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s54Fgaga067389; Wed, 4 Jun 2014 15:42:36 GMT (envelope-from milki@svn.freebsd.org) Received: (from milki@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s54FgZoT067385; Wed, 4 Jun 2014 15:42:35 GMT (envelope-from milki@svn.freebsd.org) Message-Id: <201406041542.s54FgZoT067385@svn.freebsd.org> From: Jonathan Chu Date: Wed, 4 Jun 2014 15:42:35 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r356507 - in head/ports-mgmt/portupdate-scan: . src X-SVN-Group: ports-head 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.18 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: Wed, 04 Jun 2014 15:42:36 -0000 Author: milki Date: Wed Jun 4 15:42:35 2014 New Revision: 356507 URL: http://svnweb.freebsd.org/changeset/ports/356507 QAT: https://qat.redports.org/buildarchive/r356507/ Log: Update ports-mgmt/portupdate-scan to 0.4 - Add support for pkgng. - ISCL License - Incorporates -a argument suggested by Marcel Bonnet in PR 179637. Hence this supersedes PR 179637, which can now be closed. - Other misc. fixes and enhancements, including correcting typos. PR: 190051 Submitted by: alex@stangl.us Approved by: swills (eadler) Modified: head/ports-mgmt/portupdate-scan/Makefile head/ports-mgmt/portupdate-scan/pkg-descr head/ports-mgmt/portupdate-scan/src/portupdate-scan head/ports-mgmt/portupdate-scan/src/portupdate-scan.8 Modified: head/ports-mgmt/portupdate-scan/Makefile ============================================================================== --- head/ports-mgmt/portupdate-scan/Makefile Wed Jun 4 15:30:41 2014 (r356506) +++ head/ports-mgmt/portupdate-scan/Makefile Wed Jun 4 15:42:35 2014 (r356507) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= portupdate-scan -PORTVERSION= 0.3 +PORTVERSION= 0.4 CATEGORIES= ports-mgmt MASTER_SITES= # none DISTFILES= # none @@ -10,6 +10,8 @@ DISTFILES= # none MAINTAINER= alex@stangl.us COMMENT= Display pertinent parts of {PORTSDIR}/UPDATING +LICENSE= ISCL + NO_BUILD= yes USES= perl5 shebangfix USE_PERL5= run Modified: head/ports-mgmt/portupdate-scan/pkg-descr ============================================================================== --- head/ports-mgmt/portupdate-scan/pkg-descr Wed Jun 4 15:30:41 2014 (r356506) +++ head/ports-mgmt/portupdate-scan/pkg-descr Wed Jun 4 15:42:35 2014 (r356507) @@ -4,7 +4,7 @@ many ports installed that it is difficul It reads /usr/ports/UPDATING, attempting for each block to determine whether the affected ports are installed. It omits blocks that do not apply. It handles wildcards and other special cases, however it cannot handle -all variants of phrases used on the APPLIES: line. +all variants of phrases used on the AFFECTS: line. In uncertain cases, it errs on the side of reporting. Alex Stangl Modified: head/ports-mgmt/portupdate-scan/src/portupdate-scan ============================================================================== --- head/ports-mgmt/portupdate-scan/src/portupdate-scan Wed Jun 4 15:30:41 2014 (r356506) +++ head/ports-mgmt/portupdate-scan/src/portupdate-scan Wed Jun 4 15:42:35 2014 (r356507) @@ -17,10 +17,7 @@ # Check /usr/ports/UPDATING file for all sections matching packages # that are installed, and outputting those sections. # Intended to be used prior to upgrading ports -# Usage: portupdatescan [-dDhmuvV] [--help] [--version] -# Created: 2006/12/21 Alex Stangl -# Updates: 2008/02/04 Alex Stangl INDEX computation change from Tom Doherty -# 2008/07/21 Alex Stangl Tolerate problems w/ MOVED & UPDATING +# Usage: portupdatescan [-dhmuvV] [-a yyyymmdd_date] [-D portsdir] [--help] [--version] use Text::ParseWords; use Getopt::Std; @@ -29,7 +26,8 @@ use strict; # Display usage and exit sub HELP_MESSAGE() { print </dev/null 2>&1`; +my $pkgngInUse = !$?; +print "+ PKGNG in use\n" if $opt{d} && $pkgngInUse; +print "+ Legacy PKG manager in use\n" if $opt{d} && !$pkgngInUse; + my $movedFile = "$portsdir/MOVED"; # file w/ port renames/deletes my $updatingFile = "$portsdir/UPDATING"; # file w/ ports update news -my @portlist = `pkg_info -aoq` - or die "Error trying to execute pkg_info -aoq: $!"; +my @portlist = $pkgngInUse ? `pkg info -aoq` : `pkg_info -aoq` + or die "Error trying to execute pkg info -aoq: $!"; my %installedPorts = map {chomp($_);$_, 1} @portlist; # map of installed ports -> 1 @@ -83,10 +90,10 @@ sub processBlock(@) { my ($affects, $remainder, $line); my $index = 0; foreach $line (@_) { - if ($line =~ /^\s*AFFECTS:/i) { + if ($line =~ /^\s*AFFECTS:/i) { $affects = $line; $remainder = $index; - } elsif ($affects and $line =~ /^\s*AUTHOR/i) { + } elsif ($affects and $line =~ /^\s*AUTHOR/i) { last; } elsif ($affects) { $affects .= $line; @@ -132,8 +139,7 @@ sub parseexpr($); # forward declaration sub parseexpr($) { my @retval; my $sepExp = "(,\\s+and\\s+|,\\s+or\\s+|,\\s+|\\s+and\\s+|\\s+or\\s+|\\s+)"; - if ($_[0] =~ /{.*,.*}/) - { + if ($_[0] =~ /{.*,.*}/) { # Handle expression like textproc/{senna,p5-Senna} # to produce textproc/senna, textproc/p5-Senna my ($prefix, $subexpr, $suffix) = ($_[0] =~ /([^{]*){([^}]*)}(.*)/); @@ -145,6 +151,18 @@ sub parseexpr($) { foreach $line (@exprs) { push @retval, parseexpr($prefix . $line . $suffix); } + } elsif ($_[0] =~ /{.*\|.*}/) { + # Handle expression like textproc/{senna|p5-Senna} + # to produce textproc/senna, textproc/p5-Senna + my ($prefix, $subexpr, $suffix) = ($_[0] =~ /([^{]*){([^}]*)}(.*)/); + + # Parse portname fragment contained within braces + # Breaks string at "|" and discards quotes and single backslashes + my @exprs = "ewords('\|', 0, $subexpr); + my $line; + foreach $line (@exprs) { + push @retval, parseexpr($prefix . $line . $suffix); + } } elsif ($_[0] =~ /\[\d{1,4}\]/) { # Handle expressions like net/openldap2[34]-server # to produce net/openldap23-server, net/openldap24-server @@ -164,7 +182,7 @@ sub parseexpr($) { # Handle "dir1/port1 and dir2/port2" recursively. my ($prefix, $sep, $suffix) = ($_[0] =~ /(.*?)$sepExp(.*)/); push @retval, parseexpr($prefix) if $prefix ne ""; - push @retval, parseexpr($suffix) if $suffix ne ""; + push @retval, parseexpr($suffix) if $suffix ne "" and $suffix ne "any port that depends on it"; } elsif ($_[0] =~ /\*/ or $_[0] =~ /\?/) { push @retval, expandwildcard($_[0]); } else { @@ -177,10 +195,12 @@ sub parseexpr($) { # Parse a single AFFECTS: line sub parseline($) { - return ("ALL") if $_[0] =~ /^\s+AFFECTS:\s*everybody\s*$/i - or $_[0] =~ /^\s+AFFECTS:\s*everyone\s*$/i - or $_[0] =~ /^\s+AFFECTS:\s*all\s*$/i; - if ($_[0] =~ s/.*([uU]sers|[tT]esters) of[ \t]*(.*)/$2/) { + if ($_[0] =~ s/^\s+AFFECTS:\s*(.*)/$1/) { + return ("ALL") if $_[0] =~ /^everybody\s*$/i + or $_[0] =~ /^everyone\s*$/i + or $_[0] =~ /^all users\s*$/i + or $_[0] =~ /^all\s*$/i; + $_[0] =~ s/.*([uU]sers|[tT]esters) of[ \t]*(.*)/$2/; my @retval = parseexpr($_[0]); print "+ parseline returns @retval for $_[0]\n" if $opt{d}; return @retval; @@ -210,7 +230,7 @@ sub expandwildcard($) { return @retval; } -# Convert glob-style pattern to standard regular-expression pattern +# Convert glob-style pattern to standard regex pattern sub glob2pat($) { (my $globstr = $_[0]) =~ s/(.)/$glob2regexp{$1} || "\Q$1"/ge; return '^' . $globstr . '$'; @@ -303,7 +323,7 @@ sub printall(@) { # Main entry point. First, open INDEX and read all ports into allPorts MAIN:{ - open(IDX, $portIndexFile) or die "Can't open $portIndexFile: $!"; + open(IDX, $portIndexFile) or die "Can't open $portIndexFile: $!. Maybe you should run make fetchindex or make index from ports directory"; while() { chomp; my ($portLine) = ($_ =~ /^[^|]*\|\/usr\/ports\/([^|]*)/) @@ -318,9 +338,9 @@ MAIN:{ open(MOVED, $movedFile) or die "Can't open $movedFile: $!"; while() { chomp; - if ($_ =~ /^\s*$/) { - print "+ Ignoring MOVED line containing no non-whitespace chars.\n" if $opt{d}; - } elsif ($_ !~ /^\s*#/) { + if ($_ =~ /^\s*$/) { + print "+ Ignoring MOVED line containing no non-whitespace chars.\n" if $opt{d}; + } elsif ($_ !~ /^\s*#/) { my ($from, $to) = ($_ =~ /^([^|]*)\|([^|]*)/) or die "$_ is not a correctly formed MOVED line"; @@ -340,6 +360,11 @@ MAIN:{ open(UPD, $updatingFile) or die "Can't open $updatingFile: $!"; while() { chomp; + if ($opt{a} && /^\d{8}/) { + my $sectionDate = $_; + $sectionDate =~ s/\://; + last if $sectionDate <= $afterDate; + } if (/^\s*AFFECTS:/ && @bufferBlock > 0) { processBlock(@bufferBlock); @bufferBlock = (); Modified: head/ports-mgmt/portupdate-scan/src/portupdate-scan.8 ============================================================================== --- head/ports-mgmt/portupdate-scan/src/portupdate-scan.8 Wed Jun 4 15:30:41 2014 (r356506) +++ head/ports-mgmt/portupdate-scan/src/portupdate-scan.8 Wed Jun 4 15:42:35 2014 (r356507) @@ -22,6 +22,7 @@ .Sh SYNOPSIS .Nm .Op Fl dhmuVv +.Op Fl a Ar yyyymmdd date .Op Fl D Ar portdir .Op Fl -help .Op Fl -version @@ -33,6 +34,8 @@ installed are omitted. .Pp The following options are available: .Bl -tag -width indent +.It Fl a Ar yyyymmdd date +only display sections later than the date specified in yyyymmdd format .It Fl D Ar portsdir use portsdir as ports directory instead of /usr/ports .It Fl d @@ -72,6 +75,6 @@ To include details of installed/uninstal .Sh AUTHORS .An "Alex Stangl" Aq alex@stangl.us .Sh BUGS -The concept of machine-interpreting the APPLIES: line in /usr/ports/UPDATING, +The concept of machine-interpreting the AFFECTS: line in /usr/ports/UPDATING, which were intended for human consumption, is dubious. It would be nice to evolve some more robust method for communicating this information.