1
0
mirror of https://github.com/fspc/dswim.git synced 2025-02-22 16:43:23 -05:00

Added --build-dep.

This commit is contained in:
freesource 2001-10-19 05:50:19 +00:00
parent e13572c82e
commit cce64f4874
4 changed files with 208 additions and 89 deletions

View File

@ -541,17 +541,30 @@ sub file {
untie %db; untie %db;
if (defined $file_now &&
if (defined $file_now && !($commands->{"z"} || !($commands->{"z"} ||
$commands->{"ftp"} || $commands->{"ftp"} ||
$commands->{"remove"} || $commands->{"r"} || $commands->{"remove"} ||
$commands->{"purge"} || $commands->{"reinstall"})) { $commands->{"r"} ||
if ($commands{"x"} || $commands{"ftp"} || $commands{"source"} || $commands->{"purge"} ||
$commands{"source_only"} || $commands{"remove"} || $commands->{"reinstall"} ||
$commands{"r"} || $commands{"purge"} || $commands->{"reinstall"} ) { $commands->{"build-dep"})) {
if ($commands{"x"} ||
$commands{"ftp"} ||
$commands{"source"} ||
$commands{"source_only"} ||
$commands{"remove"} ||
$commands{"r"} ||
$commands{"purge"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"}) {
require SWIM::Safex; require SWIM::Safex;
SWIM::Safex->import(qw(safex)); SWIM::Safex->import(qw(safex));
safex(\%commands); safex(\%commands);
} }
} }

View File

@ -67,9 +67,14 @@ sub findexer {
my $package = $ib{"$argument"}; my $package = $ib{"$argument"};
@alot = split(/\s/, $package); @alot = split(/\s/, $package);
@PACKAGES = @alot; @PACKAGES = @alot;
if ($commands->{"z"} || $commands->{"ftp"} || if ($commands->{"z"} ||
$commands->{"remove"} || $commands->{"r"} || $commands->{"ftp"} ||
$commands->{"purge"} || $commands->{"reinstall"}) { $commands->{"remove"} ||
$commands->{"r"} ||
$commands->{"purge"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"}) {
require SWIM::Safex; require SWIM::Safex;
SWIM::Safex->import(qw(safex)); SWIM::Safex->import(qw(safex));
safex(\%commands); safex(\%commands);
@ -79,9 +84,13 @@ sub findexer {
if ($commands->{"T"}) { if ($commands->{"T"}) {
foreach (@alot) { foreach (@alot) {
$argument = $_; $argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} || if ($commands->{"scripts"} ||
$commands->{"postinst"} || $commands->{"prerm"} || $commands->{"preinst"} ||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} ) { $commands->{"postinst"} ||
$commands->{"prerm"} ||
$commands->{"postrm"} ||
$commands->{"config"} ||
$commands->{"templates"} ) {
scripts(\%commands); scripts(\%commands);
} }
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -123,9 +132,13 @@ sub findexer {
# no -Ts. # no -Ts.
foreach (@alot) { foreach (@alot) {
$argument = $_; $argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} || if ($commands->{"scripts"} ||
$commands->{"postinst"} || $commands->{"prerm"} || $commands->{"preinst"} ||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) { $commands->{"postinst"} ||
$commands->{"prerm"} ||
$commands->{"postrm"} ||
$commands->{"config"} ||
$commands->{"templates"}) {
scripts(\%commands); scripts(\%commands);
} }
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -158,9 +171,14 @@ sub findexer {
if ($commands->{"T"}) { if ($commands->{"T"}) {
foreach (@alot) { foreach (@alot) {
$argument = $_; $argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} || if ($commands->{"scripts"} ||
$commands->{"postinst"} || $commands->{"prerm"} || $commands->{"preinst"} ||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) { $commands->{"postinst"} ||
$commands->{"prerm"} ||
$commands->{"postrm"} ||
$commands->{"config"} ||
$commands->{"templates"}) {
scripts(\%commands); scripts(\%commands);
} }
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -198,9 +216,13 @@ sub findexer {
} # which_character } # which_character
foreach (@alot) { foreach (@alot) {
$argument = $_; $argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} || if ($commands->{"scripts"} ||
$commands->{"postinst"} || $commands->{"prerm"} || $commands->{"preinst"} ||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) { $commands->{"postinst"} ||
$commands->{"prerm"} ||
$commands->{"postrm"} ||
$commands->{"config"} ||
$commands->{"templates"}) {
scripts(\%commands); scripts(\%commands);
} }
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -241,13 +263,25 @@ sub findexer {
} }
untie %ib; untie %ib;
if (!($commands->{"z"} || $commands->{"ftp"} || if (!($commands->{"z"} ||
$commands->{"remove"} || $commands->{"r"} || $commands->{"ftp"} ||
$commands->{"purge"}|| $commands->{"reinstall"} )) { $commands->{"remove"} ||
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} || $commands->{"r"} ||
$commands->{"source_only"} || $commands->{"remove"} || $commands->{"purge"} ||
$commands->{"r"} || $commands->{"purge"}|| $commands->{"reinstall"} ) { $commands->{"reinstall"} ||
$commands->{"build-dep"} )) {
if ($commands->{"x"} ||
$commands->{"ftp"} ||
$commands->{"source"} ||
$commands->{"source_only"} ||
$commands->{"remove"} ||
$commands->{"r"} ||
$commands->{"purge"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"} ) {
require SWIM::Safex; require SWIM::Safex;
SWIM::Safex->import(qw(safex)); SWIM::Safex->import(qw(safex));
safex(\%commands); safex(\%commands);
} }
@ -264,9 +298,14 @@ sub qindexer {
require SWIM::Ag; require SWIM::Ag;
SWIM::Ag->import(qw(description)); SWIM::Ag->import(qw(description));
if ($commands->{"scripts"} || $commands->{"preinst"} || if ($commands->{"scripts"} ||
$commands->{"postinst"} || $commands->{"prerm"} || $commands->{"preinst"} ||
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) { $commands->{"postinst"} ||
$commands->{"prerm"} ||
$commands->{"postrm"} ||
$commands->{"config"} ||
$commands->{"templates"}) {
scripts(\%commands); scripts(\%commands);
} }
menu(\%commands) if $commands->{"menu"} || $commands->{"m"}; menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -296,9 +335,14 @@ sub qindexer {
my $package = $ib{"$argument"}; my $package = $ib{"$argument"};
@alot = split(/\s/, $package); @alot = split(/\s/, $package);
@PACKAGES = @alot; @PACKAGES = @alot;
if ($commands->{"z"} || $commands->{"ftp"} || if ($commands->{"z"} ||
$commands->{"remove"} || $commands->{"r"} || $commands->{"ftp"} ||
$commands->{"purge"} || $commands->{"reinstall"}) { $commands->{"remove"} ||
$commands->{"r"} ||
$commands->{"purge"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"}) {
require SWIM::Safex; require SWIM::Safex;
SWIM::Safex->import(qw(safex)); SWIM::Safex->import(qw(safex));
safex(\%commands); safex(\%commands);

View File

@ -354,9 +354,14 @@ sub indexer {
if (@alot) { if (@alot) {
@PACKAGES = @alot; @PACKAGES = @alot;
} }
if ($commands->{"z"} || $commands->{"ftp"}|| if ($commands->{"z"} ||
$commands->{"remove"} || $commands->{"r"} || $commands->{"ftp"}||
$commands->{"purge"} || $commands->{"reinstall"}) { $commands->{"remove"} ||
$commands->{"r"} ||
$commands->{"purge"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"}) {
require SWIM::Safex; require SWIM::Safex;
SWIM::Safex->import(qw(safex)); SWIM::Safex->import(qw(safex));
safex(\%commands); safex(\%commands);
@ -496,12 +501,24 @@ sub indexer {
if (@alot) { if (@alot) {
@PACKAGES = @alot; @PACKAGES = @alot;
} }
if (!($commands->{"z"} || $commands->{"ftp"} || if (!($commands->{"z"} ||
$commands->{"remove"} || $commands->{"r"} || $commands->{"ftp"} ||
$commands->{"purge"} || $commands->{"reinstall"})) { $commands->{"remove"} ||
if ($commands->{"x"} || $commands->{"ftp"} || $commands->{"source"} || $commands->{"r"} ||
$commands->{"source_only"} || $commands->{"remove"} || $commands->{"purge"} ||
$commands->{"r"} || $commands->{"purge"} || $commands->{"reinstall"}) { $commands->{"reinstall"} ||
$commands->{"build-dep"})) {
if ($commands->{"x"} ||
$commands->{"ftp"} ||
$commands->{"source"} ||
$commands->{"source_only"} ||
$commands->{"remove"} ||
$commands->{"r"} ||
$commands->{"purge"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"}) {
require SWIM::Safex; require SWIM::Safex;
SWIM::Safex->import(qw(safex)); SWIM::Safex->import(qw(safex));
safex(\%commands); safex(\%commands);

View File

@ -42,7 +42,8 @@ sub safex {
$commands->{"remove"} || $commands->{"remove"} ||
$commands->{"r"} || $commands->{"r"} ||
$commands->{"purge"} || $commands->{"purge"} ||
$commands->{"reinstall"}) { $commands->{"reinstall"} ||
$commands->{"build-dep"}) {
if (!defined @PACKAGES) { if (!defined @PACKAGES) {
@ -75,7 +76,8 @@ sub safex {
$commands->{"purge"} || $commands->{"purge"} ||
$commands->{"remove"} || $commands->{"remove"} ||
$commands->{"r"} || $commands->{"r"} ||
$commands->{"reinstall"} ) { $commands->{"reinstall"} ||
$commands->{"build-dep"} ) {
if ($PACKAGES[$#PACKAGES] =~ /_/) { if ($PACKAGES[$#PACKAGES] =~ /_/) {
$PACKAGES[$#PACKAGES] =~ m,(.*)_.*,; $PACKAGES[$#PACKAGES] =~ m,(.*)_.*,;
$aptor = $1; $aptor = $1;
@ -97,7 +99,8 @@ sub safex {
$commands->{"purge"} || $commands->{"purge"} ||
$commands->{"remove"} || $commands->{"remove"} ||
$commands->{"r"} || $commands->{"r"} ||
$commands->{"reinstall"}) { $commands->{"reinstall"} ||
$commands->{"build-dep"}) {
if ($PACKAGES[$#PACKAGES] =~ /_/) { if ($PACKAGES[$#PACKAGES] =~ /_/) {
$PACKAGES[$#PACKAGES] =~ m,(.*)_.*,; $PACKAGES[$#PACKAGES] =~ m,(.*)_.*,;
$aptor = $1; $aptor = $1;
@ -189,32 +192,49 @@ sub xyz {
($commands->{"r"} || ($commands->{"r"} ||
$commands->{"remove"} || $commands->{"remove"} ||
$commands->{"purge"} || $commands->{"purge"} ||
$commands->{"reinstall"}) ) { $commands->{"reinstall"} ||
$commands->{"build-dep"}) ) {
print "swim: --ftp cannot be used with "; print "swim: --ftp cannot be used with ";
print "-r " if defined $commands->{"r"}; print "-r " if defined $commands->{"r"};
print "--remove " if defined $commands->{"remove"}; print "--remove " if defined $commands->{"remove"};
print "--purge " if defined $commands->{"purge"}; print "--purge " if defined $commands->{"purge"};
print "--reinstall " if defined $commands->{"reinstall"}; print "--reinstall " if defined $commands->{"reinstall"};
print "--build-dep " if defined $commands->{"build-dep"};
print "\n"; print "\n";
exit; exit;
} }
if ((($commands->{"r"} || if (
(($commands->{"r"} ||
$commands->{"remove"}) && $commands->{"remove"}) &&
$commands->{"purge"}) || $commands->{"purge"}) ||
(($commands->{"r"} ||
$commands->{"remove"}) &&
$commands->{"build-dep"}) ||
(($commands->{"r"} || (($commands->{"r"} ||
$commands->{"remove"}) && $commands->{"remove"}) &&
$commands->{"reinstall"}) || $commands->{"reinstall"}) ||
($commands->{"reinstall"} && ($commands->{"reinstall"} &&
$commands->{"purge"}) $commands->{"purge"}) ||
($commands->{"reinstall"} &&
$commands->{"build-dep"}) ||
($commands->{"purge"} &&
$commands->{"build-dep"})
) { ) {
print "swim: "; print "swim: ";
print "-r " if defined $commands->{"r"}; print "-r " if defined $commands->{"r"};
print "--remove " if defined $commands->{"remove"}; print "--remove " if defined $commands->{"remove"};
print "--purge " if defined $commands->{"purge"}; print "--purge " if defined $commands->{"purge"};
print "--reinstall " if defined $commands->{"reinstall"}; print "--reinstall " if defined $commands->{"reinstall"};
print "--build-dep " if defined $commands->{"build-dep"};
print "cannot be used together\n"; print "cannot be used together\n";
exit; exit;
} }
@ -342,6 +362,9 @@ sub xyz {
elsif ( $commands->{"reinstall"} ) { elsif ( $commands->{"reinstall"} ) {
system "$apt_get --reinstall install -qs $arg"; system "$apt_get --reinstall install -qs $arg";
} }
elsif ( $commands->{"build-dep"} ) {
system "$apt_get build-dep -qs $arg";
}
else { else {
system "$apt_get install -qs $arg"; system "$apt_get install -qs $arg";
} }
@ -401,6 +424,9 @@ sub xyz {
elsif ( $commands->{"reinstall"} ) { elsif ( $commands->{"reinstall"} ) {
system "$apt_get --reinstall install -qds $arg"; system "$apt_get --reinstall install -qds $arg";
} }
elsif ( $commands->{"build-dep"} ) {
system "$apt_get build-dep -qds $arg";
}
else { else {
system "$apt_get install -qds $arg"; system "$apt_get install -qds $arg";
} }
@ -452,15 +478,23 @@ sub xyz {
####### #######
# XYZ # # XYZ #
####### #######
if (!($commands->{"ftp"} || $commands->{"purge"} || if (
$commands->{"reinstall"})) { !($commands->{"ftp"} ||
$commands->{"purge"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"} )
) {
if (!$commands->{"y"}) { if (!$commands->{"y"}) {
if (!$commands->{"download-only"}) { if (!$commands->{"download-only"}) {
!($commands->{"r"} || $commands{"remove"}) ? !($commands->{"r"} || $commands{"remove"}) ?
system "$apt_get install $arg" : system "$apt_get install $arg" :
system "$apt_get remove $arg"; system "$apt_get remove $arg";
} }
else { else {
!($commands->{"r"} || $commands{"remove"}) ? !($commands->{"r"} || $commands{"remove"}) ?
system "$apt_get -d install $arg" : system "$apt_get -d install $arg" :
system "$apt_get remove $arg"; system "$apt_get remove $arg";
@ -468,12 +502,14 @@ sub xyz {
} }
else { else {
if (!$commands->{"download-only"}) { if (!$commands->{"download-only"}) {
!($commands->{"r"} || $commands{"remove"}) ? !($commands->{"r"} || $commands{"remove"}) ?
system "$apt_get install -y $arg" : system "$apt_get install -y $arg" :
system "$apt_get remove -y $arg"; system "$apt_get remove -y $arg";
} }
else { else {
# not that the y does anything
# not that the y does anything or d for that matter
!($commands->{"r"} || $commands{"remove"}) ? !($commands->{"r"} || $commands{"remove"}) ?
system "$apt_get install -y -d $arg" : system "$apt_get install -y -d $arg" :
system "$apt_get remove -y $arg"; system "$apt_get remove -y $arg";
@ -489,12 +525,17 @@ sub xyz {
qftp($arg,\%commands); qftp($arg,\%commands);
} }
############################## ##########################################
# PURGE & REMOVE & REINSTALL # # PURGE & REMOVE & REINSTALL & BUILD-DEP #
############################## #########################################
elsif ($commands->{"purge"} || $commands->{"remove"} || $commands->{"r"} || elsif ($commands->{"purge"} || $
$commands->{"reinstall"}) { commands->{"remove"} ||
$commands->{"r"} ||
$commands->{"reinstall"} ||
$commands->{"build-dep"} ) {
purge($arg,\%commands); purge($arg,\%commands);
} }
# this is a good time to return the versions, too, as well as # this is a good time to return the versions, too, as well as
@ -530,6 +571,9 @@ sub purge {
elsif ($commands->{"reinstall"}) { elsif ($commands->{"reinstall"}) {
system "$apt_get --reinstall install $arg"; system "$apt_get --reinstall install $arg";
} }
elsif ($commands->{"build-dep"}) {
system "$apt_get build-dep $arg";
}
} }
else { else {
print "swim: "; print "swim: ";
@ -537,6 +581,7 @@ sub purge {
print "--remove " if defined $commands->{"remove"}; print "--remove " if defined $commands->{"remove"};
print "--purge " if defined $commands->{"purge"}; print "--purge " if defined $commands->{"purge"};
print "--reinstall " if defined $commands->{"reinstall"}; print "--reinstall " if defined $commands->{"reinstall"};
print "--build-dep " if defined $commands->{"build-dep"};
print "can only be used with installed packages\n"; print "can only be used with installed packages\n";
} }