From owner-freebsd-questions@FreeBSD.ORG Wed Jun 24 15:45:51 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54E92106566C for ; Wed, 24 Jun 2009 15:45:51 +0000 (UTC) (envelope-from mrkvrg@acm.org) Received: from xena.bway.net (xena.bway.net [216.220.96.26]) by mx1.freebsd.org (Postfix) with ESMTP id 040EC8FC13 for ; Wed, 24 Jun 2009 15:45:50 +0000 (UTC) (envelope-from mrkvrg@acm.org) Received: (qmail 77023 invoked by uid 0); 24 Jun 2009 15:19:10 -0000 Received: from unknown (HELO gecko3.bs.net) (216.220.115.148) by smtp.bway.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 24 Jun 2009 15:19:10 -0000 From: mfv To: freebsd-questions@freebsd.org Date: Wed, 24 Jun 2009 11:19:09 -0400 User-Agent: KMail/1.11.4 (FreeBSD/7.2-STABLE; KDE/4.2.4; i386; ; ) References: <200906212038.39370.meslists@yahoo.fr> <4A3FE271.8080201@onetel.com> <20090622214802.0761813e@gumby.homeunix.com> In-Reply-To: <20090622214802.0761813e@gumby.homeunix.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906241119.09827.mrkvrg@acm.org> Cc: RW Subject: Re: upgrading installed ports: time to do it ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 15:45:51 -0000 On Monday, 22 June 2009 16:48:02 RW wrote: > On Mon, 22 Jun 2009 20:58:41 +0100 > > Chris Whitehouse wrote: > > I'll probably get flamed for this but since I've been using > > ports-mgmt/portmanager I've almost forgotten > > about /usr/ports/UPDATING and all that pkgdb -Fu stuff or whatever it > > was. I've upgraded ports just by doing 'portmanager -u' over one or > > two quite major changes and not had any problems that haven't been > > down to an individual ports. > > You still need to read UPDATING, portmanager handles some of the > issues automatically, but not all. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" Hello, Here is a perl hack I use to automatically read and parse UPDATING as part of my daily upgrade routine. It is part of a larger set of five scripts which use: 1. "csup" to update ports 2. "make index" to update the /usr/ports/INDEX 3. "pkg_version" to identify the ports that need upgrading 4. "portfetch" to download the tarballs 5. a script to display the relevant contents, if any, of UPDATING using the hack shown below and the contents identified in step 3 above. These five scripts are combined in a master script (csup-all) which I invoke the first thing in the morning. After doing some other morning chores I then run "portconfig -a -v" to set up any configuration settings prior to running "portmaster -a -u". Everything is automatic except for the configuration. Here is the perl hack. It can be improved by comparing the ports that need to be updated (step 3) with the ports specified within UPDATING (step 5). The embedded ansi codes will work with the default FreeBSD console settings, otherwise they can be removed. #!/usr/bin/perl # # file: csup-update.pl # # created: 2006-07-16 # # purpose: To review update notes in /usr/ports/UPDATING # This program will only display those notes issued # since last csup # # algorithm: Each line of the file /usr/ports/UPDATING is scanned and if # it finds a date in the form ^yyyymmdd$ the date is assigned # to the variable $date. Otherwise all non-date lines are printed # to STDOUT. As soon as this program finds a date older than the # last update this program quits and prints an appropriate closing # message. # unless ( open ( MYFILE, "/usr/ports/UPDATING" ) ) { die ("Cannot open input file /usr/ports/UPDATING.\n") ; } unless ( open ( LASTUPDATE, "/root/bin/csup-lastupdate.txt" ) ) { die ("Cannot open file csup-lastupdate.txt.\n") ; } $eof = '' ; $date = $lastupdate = ; $line = ; $count = 0 ; while ( $line ne $eof ) { if ( $line =~ /^2\d{7}/ ) { $date = $line ; $date =~ tr/://d ; $count++ ; } if ( ( $date - $lastupdate ) >= 0 ) { if ( $line =~ /^2\d{7}/ ) { print ("^[[32m$line^[[0m") ; } else { print ("^[[0m$line") ; } $line = ; $date = $lastupdate ; } else { $count-- ; if ( $count == 0 ) { print ( "^[[36mThere are no updates to review. ") ; } elsif ( $count == 1 ) { print ( "^[[36mThere is only one update to review. ") ; } else { print ( "^[[36mThere are $count updates to review. ") ; } chop ( $lastupdate ) ; print ( "The last run of csup was on $lastupdate.^[[0m\n\n" ) ; exit ; } } # EoF