Date: Mon, 29 Jun 2009 22:57:39 +0200 From: dan <meslists@yahoo.fr> To: mfv <mrkvrg@acm.org> Cc: freebsd-questions@freebsd.org Subject: Re: upgrading installed ports: time to do it ? Message-ID: <200906292257.39730.meslists@yahoo.fr> In-Reply-To: <200906241119.09827.mrkvrg@acm.org> References: <200906212038.39370.meslists@yahoo.fr> <20090622214802.0761813e@gumby.homeunix.com> <200906241119.09827.mrkvrg@acm.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 24 June 2009 17:19:09 you wrote: > On Monday, 22 June 2009 16:48:02 RW wrote: > > On Mon, 22 Jun 2009 20:58:41 +0100 > > > > Chris Whitehouse <cwhiteh@onetel.com> 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 = <LASTUPDATE> ; > $line = <MYFILE> ; > $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 = <MYFILE> ; > $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 > > _______________________________________________ > 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 mfv ! Thanks for sharing your perl hack and your experience :-) I do not know anything about PERL, but I am starting taking a look at this ! THanks dan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906292257.39730.meslists>