mirror of
				https://github.com/fspc/dswim.git
				synced 2025-10-31 16:35:35 -04: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:
		
							parent
							
								
									01c6d30354
								
							
						
					
					
						commit
						a3fea33120
					
				| @ -27,7 +27,7 @@ use Exporter; | |||||||
|              $sort $md5sum $zcat $tar $grep $gzip $fastswim $slowswim $longswim |              $sort $md5sum $zcat $tar $grep $gzip $fastswim $slowswim $longswim | ||||||
|              $mount $umount $mke2fs $copy $pager $base $pwd $parent $library |              $mount $umount $mke2fs $copy $pager $base $pwd $parent $library | ||||||
|              $splt $mv $imswim $swim_conf $debug $port $timeout |              $splt $mv $imswim $swim_conf $debug $port $timeout | ||||||
|              $firewall $passive $apt_sources $HISTORY $alt); |              $firewall $passive $apt_sources $HISTORY $alt $no_rebuilddb); | ||||||
| %EXPORT_TAGS = ( | %EXPORT_TAGS = ( | ||||||
|                Path => [ qw($tmp $parent $base $library $default_directory) ], |                Path => [ qw($tmp $parent $base $library $default_directory) ], | ||||||
|                Deb => [ qw($pwd $dpkg_deb $ar $tar $grep $tmp $md5sum $cat $mv) ], |                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.   | # Just like a shell, you can keep a history of whatever length you want.   | ||||||
| $HISTORY = 10; | $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: | # For not-installed: | ||||||
| # This part supplies the default value for --arch. | # This part supplies the default value for --arch. | ||||||
| # | # | ||||||
|  | |||||||
							
								
								
									
										25
									
								
								swim
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								swim
									
									
									
									
									
								
							| @ -784,6 +784,31 @@ sub command { | |||||||
|         initndb(\%commands); |         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  |   # *deb packages -p querys can be handled separately because they a particular to  | ||||||
|   # *debs. |   # *debs. | ||||||
|  | |||||||
							
								
								
									
										13
									
								
								swimrc
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								swimrc
									
									
									
									
									
								
							| @ -10,6 +10,19 @@ $package_tool = "/usr/bin/dpkg"; | |||||||
| # Do you have apt installed? | # Do you have apt installed? | ||||||
| $apt = "yes"; | $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. | # Pick one. | ||||||
| #$architecture = "alpha"; | #$architecture = "alpha"; | ||||||
| #$architecture = "arm"; | #$architecture = "arm"; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user