[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Checking for old tex packages .....



On Mon, 1 Sep 1997, Christoph Martin wrote:

> Martin Schulze writes:
>  > Hi!
>  > 
>  > It's very annoying to have tetex-base check for old tex packages on a
>  > brandnew system.  Could this be avoided?  pre- and postinst scripts
>  > get arguments like `upgrade from to' and the like.
>  > 
> 
> How do you want to check whether it is a brandnew system? Yes you get
> arguments like these, but only if you upgrade from an old tetex
> package, not when replacing old tex packages. This is a problem with
> dpkg which can't handle replacements of more than one packages by a
> single package. So I have no idea how to change this.

I just had a look at tetex-*'s preinst scripts. It looks like the `dpkg -s
foo' takes so long. So I just wrote a simple Perl script based on
Klee's dpkg-perl package. The script parses /var/lib/dpkg/status and
checks for the old tex packages--just as the shell script, but hopefully
much faster.

Right now, the script is missing a few screen messages--I can implement
these if you like the script.

> Hopefully in the future we can drop the check, when allmost all
> systems have upgraded to at leas 1.3.

No, we can't do that. Debian is supposed to be easily upgradable even from
older releases. 

(Feel free to ask me to do further changes to the perl script, in case you
don't know Perl5.)


Thanks,

Chris

----------------------------------------------------------------------------

#!/usr/bin/perl

$OLDPACKAGES = "amsfonts amslatex amstex babel bibtex dviljk dvipsk kpathsea kpathsea-dev latex latex2e-doc ltxgraph ltxmisc ltxtool makeindex mfbasfnt mfbin mfdcfnt mfnfss ntgclass oldgerman pandora ps2pk psnfss texbin texi2html texinfo texlib texpsfnt t
extfm xdvik tetex tetexlib tetexdoc";

$OLDPACKAGES2 = "mflib xypic";

# ---end-of-configuration-part---

use Carp;
use Dpkg::Package::List;

# ---

package Dpkg::Package::List;

sub croak {
  Carp::croak(@_);
}

# ---

package main;

print "\n checking for old TeX packages...";

# Read dpkg's status file
$list = new Dpkg::Package::List('filename' => '/var/lib/dpkg/status');

# Convert package list to hash
$packages = $list->packages;
for $pkg (@$packages) {
	$pkgs{$pkg->{'package'}} = $pkg;
}

# Search for old packages
for $p (split(/\s+/,$OLDPACKAGES)) {
	next unless $pkgs{$p};
	next if $pkg->{'status'} =~ /ok not-installed/o;

	# old package found!
	push(@oldpkg,$p);
}
for $p (split(/\s+/,$OLDPACKAGES2)) {
	next unless $pkgs{$p};
	next if $pkg->{'status'} =~ /ok not-installed/o;

	# old package found!
	push(@oldpkg2,$p);
}

if (($#oldpkg == -1) and ($#oldpkg2 == -1)) {
	print " none.\n";
	exit 0;
}

print "\n\n";
print " I see that you have one or more of the pre-1.3 TeX packages installed:\n";
printf " %s %s\n\n",join(' ',@oldpkg),join(' ',@oldpkg2);

# ...to be continued...

--                  Christian Schwarz
                   schwarz@monet.m.isar.de, schwarz@schwarz-online.com
                  schwarz@debian.org, schwarz@mathematik.tu-muenchen.de
                       
                PGP-fp: 8F 61 EB 6D CF 23 CA D7  34 05 14 5C C8 DC 22 BA
              
 CS Software goes online! Visit our new home page at
 	                                     http://www.schwarz-online.com


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: