From 1a84688f596fafc9a64ad8fd891bb9e1469e306f Mon Sep 17 00:00:00 2001 From: freesource Date: Thu, 18 Oct 2001 05:15:22 +0000 Subject: [PATCH] Changed the package check to query -i, and check to see whether the status has deinstall|purge, as well as to check whether the package actually exists. --- add-ons/yard/make-debian-X11/make_debian-X11 | 31 ++++++++------------ yard/scripts/make_debian | 31 ++++++++------------ 2 files changed, 24 insertions(+), 38 deletions(-) diff --git a/add-ons/yard/make-debian-X11/make_debian-X11 b/add-ons/yard/make-debian-X11/make_debian-X11 index 7aa7639..fb2008f 100755 --- a/add-ons/yard/make-debian-X11/make_debian-X11 +++ b/add-ons/yard/make-debian-X11/make_debian-X11 @@ -291,18 +291,14 @@ return $stuff; # the information is taken directly from the system. But it is fun # to test for anyways, weirder things have been known to happen. -my $required_packages_check = "swim -q @required_packages|"; -open (CHECK,$required_packages_check) - or die "Couldn't find any required packages: $?\n"; my @rpc; -while () { - if (/^package/) { - my $rpc = (split(/\s/))[1]; - push(@rpc,$rpc); - - } +foreach my $p (@required_packages) { + $p =~ s/\+/\\+/g if $p !~ /\\+/g; + if ( grep(/Status: deinstall|Status: purge|package $p is not installed/, + `swim -qi $p`) == 1 ) { + push(@rpc,$p); + } } -close (CHECK); if (@rpc) { print STDERR "These are the required packages which were specified:\n\n"; @@ -313,17 +309,14 @@ if (@rpc) { $, = ""; } -my $extra_packages_check = "swim -q @extra_packages|"; -open (CHECK,$extra_packages_check) - or die "Couldn't find any required packages: $?\n"; my @epc; -while () { - if (/^package/) { - my $epc = (split(/\s/))[1]; - push(@epc,$epc); - } +foreach my $p (@extra_packages) { + $p =~ s/\+/\\+/g if $p !~ /\\+/g; + if ( grep(/Status: deinstall|Status: purge|package $p is not installed/, + `swim -qi $p`) == 1 ) { + push(@epc,$p); + } } -close (CHECK); if (@epc) { print STDERR "These are the extra packages which were specified:\n\n"; diff --git a/yard/scripts/make_debian b/yard/scripts/make_debian index d3f2ece..f52aa7e 100755 --- a/yard/scripts/make_debian +++ b/yard/scripts/make_debian @@ -264,18 +264,14 @@ return $stuff; # the information is taken directly from the system. But it is fun # to test for anyways, weirder things have been known to happen. -my $required_packages_check = "swim -q @required_packages|"; -open (CHECK,$required_packages_check) - or die "Couldn't find any required packages: $?\n"; my @rpc; -while () { - if (/^package/) { - my $rpc = (split(/\s/))[1]; - push(@rpc,$rpc); - - } +foreach my $p (@required_packages) { + $p =~ s/\+/\\+/g if $p !~ /\\+/g; + if ( grep(/Status: deinstall|Status: purge|package $p is not installed/, + `swim -qi $p`) == 1 ) { + push(@rpc,$p); + } } -close (CHECK); if (@rpc) { print STDERR "These are the required packages which were specified:\n\n"; @@ -286,17 +282,14 @@ if (@rpc) { $, = ""; } -my $extra_packages_check = "swim -q @extra_packages|"; -open (CHECK,$extra_packages_check) - or die "Couldn't find any required packages: $?\n"; my @epc; -while () { - if (/^package/) { - my $epc = (split(/\s/))[1]; - push(@epc,$epc); - } +foreach my $p (@extra_packages) { + $p =~ s/\+/\\+/g if $p !~ /\\+/g; + if ( grep(/Status: deinstall|Status: purge|package $p is not installed/, + `swim -qi $p`) == 1 ) { + push(@epc,$p); + } } -close (CHECK); if (@epc) { print STDERR "These are the extra packages which were specified:\n\n";