[Debtags-commits] [svn] r2030 - in debtags/1.6.0: . tools

Enrico Zini enrico at alioth.debian.org
Sun Oct 29 21:07:14 CET 2006


Author: enrico
Date: Sun Oct 29 21:07:14 2006
New Revision: 2030

Modified:
   debtags/1.6.0/   (props changed)
   debtags/1.6.0/tools/fetch
Log:
 r3554 at viaza:  enrico | 2006-10-29 21:04:46 +0100
 Cleanup previously fetched files before fetching new ones
 Fixed fetching items with wget


Modified: debtags/1.6.0/tools/fetch
==============================================================================
--- debtags/1.6.0/tools/fetch	(original)
+++ debtags/1.6.0/tools/fetch	Sun Oct 29 21:07:14 2006
@@ -79,7 +79,13 @@
 	}
 
 	# Read all the configuration first, so we can warn of syntax errors
-	for my $task (readConfig($CONFIG))
+	my @sources = readConfig($CONFIG);
+
+	# Delete old sources (this will also get rid of sources removed from
+	# sources.list)
+	system "rm -f '$OUTPUTDIR/debtags-fetch-*'";
+
+	for my $task (@sources)
 	{
 		my ($islocal, $func, $arg1, $arg2) = @$task;
 		# Skip nonlocal sources if so instructed
@@ -110,13 +116,13 @@
 		my $line = $1;
 		if ($line eq 'apt://')
 		{
-			push @res, [ 1, \&fetcher_apt, undef, "$OUTPUTDIR/apt" ];
+			push @res, [ 1, \&fetcher_apt, undef, "$OUTPUTDIR/debtags-fetch-apt" ];
 		}
 		elsif ($line =~ /^(?:http|ftp):\/\//)
 		{
 			my $mangle = $line;
 			$mangle =~ s/[^A-Za-z0-9._-]/-/g;
-			push @res, [ undef, \&fetcher_wget, $line, "$OUTPUTDIR/$mangle" ];
+			push @res, [ undef, \&fetcher_wget, $line, "$OUTPUTDIR/debtags-fetch-$mangle" ];
 		}
 		elsif ($line =~ /^file:(.+)/)
 		{
@@ -125,7 +131,7 @@
 			$mangle =~ s/[^A-Za-z0-9._-]/-/g;
 			# Delete extra leading slashes
 			$name =~ s/^\/*(\/.+)/$1/;
-			push @res, [ 1, \&fetcher_copy, $name, "$OUTPUTDIR/$mangle" ];
+			push @res, [ 1, \&fetcher_copy, $name, "$OUTPUTDIR/debtags-fetch-$mangle" ];
 		}
 	}
 
@@ -189,11 +195,11 @@
 
 	verbose("Fetching data from $uri via wget...");
 
-	system "wget", "$uri/vocabulary.gz", "-o", "$target.voc.tmp" and error "Failed downloading $uri/vocabulary.gz";
-	system "wget", "$uri/tags-current.gz", "-o", "$target.tag.tmp" and error "Failed downloading $uri/tags-current.gz";
+	system "wget", "-O", "$target.voc.gz.tmp", "$uri/vocabulary.gz" and error "Failed downloading $uri/vocabulary.gz";
+	system "wget", "-O", "$target.tag.gz.tmp", "$uri/tags-current.gz" and error "Failed downloading $uri/tags-current.gz";
 
-	finalize_file "$target.tag";
-	finalize_file "$target.voc";
+	finalize_file "$target.tag.gz";
+	finalize_file "$target.voc.gz";
 }
 
 sub fetcher_copy ($$)



More information about the Debtags-commits mailing list