Re: Check for ports updates

2000-06-28 Thread Leif Neland



On Tue, 6 Jun 2000, Thomas Schuerger wrote:

 Hi!
 
 Is there already a tool that checks the installed ports for available
 updates in /usr/ports?
 
 I've written such a tool, which seems to work fine already. Anyone
 interested?
 
Now that such a tool (yours?) is in /etc/periodic/weekly, how does one
update a package?

If I update foo-1.1 to foo-1.2 by just doing a make install, I now have
both foo-1.1 and foo-1.2 listed in /var/db/pkg

And if I remove foo-1.1 first, it will complain that bar-2.3 requires foo.

If I remove foo-1.1 after installing foo-1.2, /usr/bin/foo will be
removed, I fear. Or will the MD5 values in +CONTENT check, that only files
belonging to foo-1.1 be removed? That can't be, because some files might
be the same in both packages.

The steps needed for upgrading a package (from ports) would be:

make install

append foo-1.1/+REQUIRED_BY to foo-1.2/+REQUIRED_BY

traverse /var/db/pkg/* and remove foo-1.1/replace with foo-1.2

"subtract" foo-1.2/+CONTENT from foo-1.1/+CONTENT, only removing files
needed only in foo-1.1

remove /var/db/pkg/foo-1.1

Does this look sane?

Have I overlooked the pkg_add --update command, or is it now "send
patches-time"?

Leif



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-28 Thread Alexander Leidinger

On 28 Jun, Leif Neland wrote:

 The steps needed for upgrading a package (from ports) would be:
 
 make install
 
 append foo-1.1/+REQUIRED_BY to foo-1.2/+REQUIRED_BY
 
 traverse /var/db/pkg/* and remove foo-1.1/replace with foo-1.2
 
 "subtract" foo-1.2/+CONTENT from foo-1.1/+CONTENT, only removing files
 needed only in foo-1.1
 
 remove /var/db/pkg/foo-1.1

cd /usr/ports/foo/bar
make
mv /var/db/pkg/bar-x.y.z/+REQUIRED_BY .
pkg_delete bar-a.b.c
make install
mv +REQUIRED_BY /var/db/pkg/bar-d.e.f
port_update.sh bar a.b.c d.e.f

port_update.sh:
---snip---
#!/bin/sh

# Syntax: port_update.sh progname version_old version_new
# yes, I know it's ugly

if [ ! $3  ]; then
  echo "$0 name oldver newver"
  exit 1
fi

for i in `cat /var/db/pkg/${1}-${3}/+REQUIRED_BY`; do
  echo -n "Updating ${i}... "
  perl -npi -e "s:\@pkgdep\ ${1}\-${2}:\@pkgdep\ ${1}\-${3}:g" 
/var/db/pkg/${i}/+CONTENTS
  echo "done"
done
---snip---

Lazy disclaimer:
 - works for me
 - I think I know what I'm doing here (and what the limitations are
   (e.g. bar == libxyz  libmajorversion(old) !=
   libmajorversion(new))).

Bye,
Alexander.

-- 
  The best things in life are free, but the
expensive ones are still worth a look.

http://www.Leidinger.net  Alexander+Home @ Leidinger.net
  GPG fingerprint = 7423 F3E6 3A7E B334 A9CC  B10A 1F5F 130A A638 6E7E



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-28 Thread Leif Neland

Any reason not to put this into bsd.port.mk?

make update




On Wed, 28 Jun 2000, Alexander Leidinger wrote:

 On 28 Jun, Leif Neland wrote:
 
  The steps needed for upgrading a package (from ports) would be:
  
  make install
  
  append foo-1.1/+REQUIRED_BY to foo-1.2/+REQUIRED_BY
  
  traverse /var/db/pkg/* and remove foo-1.1/replace with foo-1.2
  
  "subtract" foo-1.2/+CONTENT from foo-1.1/+CONTENT, only removing files
  needed only in foo-1.1
  
  remove /var/db/pkg/foo-1.1
 
 cd /usr/ports/foo/bar
 make
 mv /var/db/pkg/bar-x.y.z/+REQUIRED_BY .
 pkg_delete bar-a.b.c
 make install
 mv +REQUIRED_BY /var/db/pkg/bar-d.e.f
 port_update.sh bar a.b.c d.e.f
 
 port_update.sh:
 ---snip---
 #!/bin/sh
 
 # Syntax: port_update.sh progname version_old version_new
 # yes, I know it's ugly
 
 if [ ! $3  ]; then
   echo "$0 name oldver newver"
   exit 1
 fi
 
 for i in `cat /var/db/pkg/${1}-${3}/+REQUIRED_BY`; do
   echo -n "Updating ${i}... "
   perl -npi -e "s:\@pkgdep\ ${1}\-${2}:\@pkgdep\ ${1}\-${3}:g" 
/var/db/pkg/${i}/+CONTENTS
   echo "done"
 done
 ---snip---
 
 Lazy disclaimer:
  - works for me
  - I think I know what I'm doing here (and what the limitations are
(e.g. bar == libxyz  libmajorversion(old) !=
libmajorversion(new))).
 
 Bye,
 Alexander.
 
 



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-28 Thread Neil Blakey-Milner

On Wed 2000-06-28 (15:13), Leif Neland wrote:
 Any reason not to put this into bsd.port.mk?
 
 make update

It will break the system at least 20% of the time.  Change 20% to 100%
for gnome, kde, xpm, png, tiff, jpeg, and so forth.

Neil
-- 
Neil Blakey-Milner
Sunesi Clinical Systems
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-28 Thread Alexander Leidinger

On 28 Jun, Leif Neland wrote:
 Any reason not to put this into bsd.port.mk?
 
 make update

 - it removes your config files in most cases.
 - it may break binaries which depend upon a specific library.
 - ...

Bye,
Alexander.

-- 
Secret hacker rule #11: hackers read manuals.

http://www.Leidinger.net  Alexander+Home @ Leidinger.net
  GPG fingerprint = 7423 F3E6 3A7E B334 A9CC  B10A 1F5F 130A A638 6E7E



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-28 Thread Alexander Leidinger

On 28 Jun, Neil Blakey-Milner wrote:

 Any reason not to put this into bsd.port.mk?
 
 make update
 
 It will break the system at least 20% of the time.  Change 20% to 100%
 for gnome, kde, xpm, png, tiff, jpeg, and so forth.

I've successfully updated png/tiff/jpeg and some gnome packages
(core/libs, but not from 1.0.x to 1.2.x) this way. 100% is to much, but
even 10% is to much for "make update".

Bye,
Alexander.

-- 
   I believe the technical term is "Oops!"

http://www.Leidinger.net  Alexander+Home @ Leidinger.net
  GPG fingerprint = 7423 F3E6 3A7E B334 A9CC  B10A 1F5F 130A A638 6E7E



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-28 Thread Leif Neland



On Wed, 28 Jun 2000, Alexander Leidinger wrote:

 On 28 Jun, Neil Blakey-Milner wrote:
 
  Any reason not to put this into bsd.port.mk?
  
  make update
  
  It will break the system at least 20% of the time.  Change 20% to 100%
  for gnome, kde, xpm, png, tiff, jpeg, and so forth.
 
 I've successfully updated png/tiff/jpeg and some gnome packages
 (core/libs, but not from 1.0.x to 1.2.x) this way. 100% is to much, but
 even 10% is to much for "make update".
 
Can the portmaintainer add a flag: 

NO_UPDATE="major jump in version - keep old version too" 

Or

UPDATE_OK="1.0.3"
meaning it's ok to upgrade if the previous version is 1.0.3 or higher.

Leif




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-28 Thread Leif Neland



On Wed, 28 Jun 2000, Alexander Leidinger wrote:

 On 28 Jun, Leif Neland wrote:
  Any reason not to put this into bsd.port.mk?
  
  make update
 
  - it removes your config files in most cases.

Most sane install's either just installs foo.conf.sample, or won't
overwrite existing config-files.

  - it may break binaries which depend upon a specific library.
  - ...

Libraries should be marked non-autoupgradable somehow.

Leif




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-07 Thread Nik Clayton

On Tue, Jun 06, 2000 at 10:25:02PM +0200, Thomas Schuerger wrote:
   Is there already a tool that checks the installed ports for available
   updates in /usr/ports?
   
   I've written such a tool, which seems to work fine already. Anyone
   interested?
  
  pkg_version(1)
 
 Ah, haven't seen that before. The output of pkg_version is very
 canonical, but not very readable for humans. 

pkg_version -v
pkg_version -c

N
-- 
Internet connection, $19.95 a month.  Computer, $799.95.  Modem, $149.95.
Telephone line, $24.95 a month.  Software, free.  USENET transmission,
hundreds if not thousands of dollars.  Thinking before posting, priceless.
Somethings in life you can't buy.  For everything else, there's MasterCard.
  -- Graham Reed, in the Scary Devil Monastery


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-06 Thread Will Andrews

On Tue, Jun 06, 2000 at 09:27:16PM +0200, Thomas Schuerger wrote:
 Is there already a tool that checks the installed ports for available
 updates in /usr/ports?
 
 I've written such a tool, which seems to work fine already. Anyone
 interested?

pkg_version(1)

-- 
Will Andrews [EMAIL PROTECTED]
GCS/E/S @d- s+:++:- a---+++ C++ UB P+ L- E--- W+++ !N !o ?K w---
?O M+ V-- PS+ PE++ Y+ PGP t++ 5 X++ R+ tv+ b++ DI+++ D+ 
G+ e- h! r--+++ y?


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-06 Thread Thomas Schuerger

  Is there already a tool that checks the installed ports for available
  updates in /usr/ports?
  
  I've written such a tool, which seems to work fine already. Anyone
  interested?
 
 pkg_version(1)

Ah, haven't seen that before. The output of pkg_version is very
canonical, but not very readable for humans. And it's slower than my
version... ;-)

Here is my version called "ports_updates":


-

#!/usr/bin/perl


# $Id: ports_updates,v 1.1 2000/06/01 20:24:06 schuerge Exp $
#
# 2601 schuerge first checkin
#
# TODO: Make version check more sophisticated. Currently the version strings are
#   compared lexicographically, which may sometimes not be what is expected.

#
# ports_updates - fast check for available updates of installed ports
#
# (C) 2000 by Thomas Schürger   Mail: [EMAIL PROTECTED]
#
# invocation:
#  ports_updates
#
# description:
#  Checks for each installed port if a newer version is available
#  in /usr/ports. Ports are output in a sorted manner.
#
#  Uses efficient merge-sort like algorithm for detecting updated
#  port versions. The file /usr/ports/INDEX is inspected for
#  detecting updates, which is not updated daily in the ports
#  collection. Therefore the results are just almost exact.
#


$installedports = `\\ls -1 /var/db/pkg | sort -t "-" +0 -1`;
@installedports = split(/\n/, $installedports);

$c = 0;
foreach $i ( @installedports )
  {
next if($i =~ /^\./);   # super-user ls also lists dot-files
$i =~ /(.*)-([^\-].*)/;
$installedname[$c] = $1;
$installedversion[$c] = $2;
$c++;
  }

$ports = ` cut -f "1-2" -d "|" /usr/ports/INDEX | sort -t "-" +0 -1`;
@ports = split(/\n/, $ports);

$c = 0;
foreach $i ( @ports )
  {
$i =~ /^(.*)-([^\-\|].*)\|(.*)/;
$name[$c] = $1;
$version[$c] = $2;
$location[$c] = $3;
# $location[$c] =~ s/^\/usr\/ports\///;
$c++;
  }

@a = stat("/usr/ports/INDEX");
$time = localtime($a[9]);
$age = -M "/usr/ports/INDEX";

if($age = 30)
  {
printf("Ports available: %4d (last port index update: %s)\n",($#ports+1),$time);
  }
else
  {
printf("Ports available: %4d (last port index update %d day%s 
ago)\n",($#ports+1),$age,$age == 1 ? "" : "s");
  }

printf("Ports installed: %4d\n",($#installedname+1));

$c = 0;   # counter for @ports
$d = 0;   # counter for @installedports

while($c = $#name  $d = $#installedname)
  {
$a = $name[$c] cmp $installedname[$d];

# printf("%4d %-30s %-10s  %4d %-30s %-10s  
$a\n",$c,$name[$c],$version[$c],$d,$installedname[$d],$installedversion[$d]);

if($a == 0)
  {
$ver = $version[$c];
$instver = $installedversion[$d];

if($ver gt $instver)  # newer version available?
  {
if(!$header)  # has the table header not been printed yet?
  {
print "\nThe following installed ports should be updated:\n\n";
print "Port name/usr/ports   Installed   Port location\n";
print 
"--\n";
$header = 1;
  }

printf("%-20s %-12s %-10s  %s\n",$name[$c],$ver,$instver,$location[$c]);
  }
  }

$c++ if($a = 0);

if($a  0)
  {
push(@obsolete,$installedname[$d]."-".$installedversion[$d]);
  }

$d++ if($a = 0);
  }

if(!$header)
  {
print "\nCongratulations, all installed ports are up-to-date!\n";
  }

if($#obsolete = 0)
  {
print "\nThe following ports are installed but are no longer available in 
/usr/ports\n";
print "(or now have a different name) and should be considered for deletion:\n\n";

foreach $i (@obsolete)
  {
print "$i\n",
  }
  }

--


Ciao,
Thomas Schürger.   http://www.menden.org



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: Check for ports updates

2000-06-06 Thread Bruce A. Mah

If memory serves me right, Thomas Schuerger wrote:
   Is there already a tool that checks the installed ports for available
   updates in /usr/ports?
   
   I've written such a tool, which seems to work fine already. Anyone
   interested?
  
  pkg_version(1)
 
 Ah, haven't seen that before. The output of pkg_version is very
 canonical, but not very readable for humans. And it's slower than my
 version... ;-)

Without having looked at ports_updates yet, let me just mention that:

1.  If you want human-readable output, try "pkg_version -v".  Maybe 
that should have been a default; certainly I always run it that way.  
But in the case that a program was going to postprocess the output, I 
didn't want it to have to wade through a bunch of pretty-printing stuff 
to get the results it needed.

2.  When I was writing pkg_version, speed wasn't exactly a big priority 
to me, since pretty much *anything* was faster than what I was doing.

Bruce.

PS.  I've been really bad about ignoring suggestions for pkg_version, 
mostly because it does everything I need/want it to do right now.





To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message