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

This adds the no_rebuilddb Configuration option, because changes in the

status are now first diffed, then if a change is found --db --check is ran,
and then --rebuilddb (100% stable).  This is nice for programs like make-debian-x11.
This commit is contained in:
freesource 2001-10-13 05:28:42 +00:00
parent 01c6d30354
commit a3fea33120
3 changed files with 43 additions and 1 deletions

View File

@ -27,7 +27,7 @@ use Exporter;
$sort $md5sum $zcat $tar $grep $gzip $fastswim $slowswim $longswim
$mount $umount $mke2fs $copy $pager $base $pwd $parent $library
$splt $mv $imswim $swim_conf $debug $port $timeout
$firewall $passive $apt_sources $HISTORY $alt);
$firewall $passive $apt_sources $HISTORY $alt $no_rebuilddb);
%EXPORT_TAGS = (
Path => [ qw($tmp $parent $base $library $default_directory) ],
Deb => [ qw($pwd $dpkg_deb $ar $tar $grep $tmp $md5sum $cat $mv) ],
@ -53,6 +53,10 @@ $my_number = 23;
# Just like a shell, you can keep a history of whatever length you want.
$HISTORY = 10;
# Set to 1 if you don't want the swim to automatically rebuild its
# databases everytime there is a change.
$no_rebuilddb = 0;
# For not-installed:
# This part supplies the default value for --arch.
#

25
swim
View File

@ -784,6 +784,31 @@ sub command {
initndb(\%commands);
}
# Automatic rebuilding - assuming the first time
if (!-f "$main::home$parent$library/status") {
system "cp -fa $parent$library/status $main::home$parent$library";
}
else {
if ( $no_rebuilddb == 0 ) {
my $diff = `diff $parent$library/status $main::home$parent$library/status`;
if ( $diff ) {
$commands{"check"} = 1;
require SWIM::DB;
SWIM::DB->import(qw(db));
db(\%commands);
require SWIM::DB_Init;
$commands{"rebuilddb"} = 1;
SWIM::DB_Init->import(qw(database));
database(\%commands);
system "cp -fa $parent$library/status $main::home$parent$library";
}
}
}
# *deb packages -p querys can be handled separately because they a particular to
# *debs.

13
swimrc
View File

@ -10,6 +10,19 @@ $package_tool = "/usr/bin/dpkg";
# Do you have apt installed?
$apt = "yes";
# No automatic rebuilding of databases.
# Databases will automatically by rebuilt if any differences are found
# in the status. Although --db could be used to update the changes
# for each particular packages, newer versions of DB_File have introduced
# bugs; --rebuilddb is know to be 100% stable. On some systems
# which are slow, or have massive installations this feature may be
# annoying. If you decide to turn it off, remember to --rebuilddb your
# databases from time to time, or run it as a cron job. Programs like
# make-debian-x11 will then be guaranteed to have correct information about
# your system.
$no_rebuilddb = 0;
# Pick one.
#$architecture = "alpha";
#$architecture = "arm";