[Debtags-commits] [svn] r1968 - in debtags/1.6.0: . debian tools
Enrico Zini
enrico at costa.debian.org
Fri Sep 29 17:40:12 UTC 2006
Author: enrico
Date: Fri Sep 29 17:40:11 2006
New Revision: 1968
Modified:
debtags/1.6.0/ (props changed)
debtags/1.6.0/debian/debtags.postinst
debtags/1.6.0/tools/debtags.cc
debtags/1.6.0/tools/fetch
Log:
r3434 at viaza: enrico | 2006-09-29 19:08:29 +0200
Reimplemented debtags update --local and call it from postinst
Modified: debtags/1.6.0/debian/debtags.postinst
==============================================================================
--- debtags/1.6.0/debian/debtags.postinst (original)
+++ debtags/1.6.0/debian/debtags.postinst Fri Sep 29 17:40:11 2006
@@ -6,6 +6,6 @@
rm -f /var/lib/debtags/*.idx*
# Regenerate the indexes
-#debtags update --local
+debtags update --local
#DEBHELPER#
Modified: debtags/1.6.0/tools/debtags.cc
==============================================================================
--- debtags/1.6.0/tools/debtags.cc (original)
+++ debtags/1.6.0/tools/debtags.cc Fri Sep 29 17:40:11 2006
@@ -1614,6 +1614,8 @@
else {
if (opts.out_verbose->boolValue())
fetcher += " --verbose";
+ if (opts.misc_local->boolValue())
+ fetcher += " --local";
if (system(fetcher.c_str()) != 0)
throw wibble::exception::Consistency("acquiring new data", "fetcher command " + fetcher + " failed");
}
Modified: debtags/1.6.0/tools/fetch
==============================================================================
--- debtags/1.6.0/tools/fetch (original)
+++ debtags/1.6.0/tools/fetch Fri Sep 29 17:40:11 2006
@@ -30,6 +30,7 @@
sub fetcher_copy ($$);
my $VERBOSE=undef;
+my $LOCAL=undef;
sub error (@)
{
@@ -42,30 +43,49 @@
print STDOUT @_, "\n" if $VERBOSE;
}
-if ($ARGV[0] eq '--verbose')
+if (@ARGV and $ARGV[0] eq '--verbose')
{
$VERBOSE=1;
shift @ARGV;
}
+if (@ARGV and $ARGV[0] eq '--local')
+{
+ $LOCAL=1;
+ shift @ARGV;
+}
# TODO: allow to use more than one config file
# TODO: allow to override $OUTPUTDIR with parameters read from commandline
-if (not -w $OUTPUTDIR)
+if (@ARGV and $ARGV[0] eq 'islocal')
{
- if (not -e $OUTPUTDIR)
+ my $res = 0;
+ # Read all the configuration first, so we can warn of syntax errors
+ for my $task (readConfig($CONFIG))
{
- error "Output directory $OUTPUTDIR does not exist";
- } else {
- error "I do not have permission to write to $OUTPUTDIR";
+ my ($islocal, $func, $arg1, $arg2) = @$task;
+ $res = 1 if not $islocal;
+ }
+ exit $res;
+} else {
+ if (not -w $OUTPUTDIR)
+ {
+ if (not -e $OUTPUTDIR)
+ {
+ error "Output directory $OUTPUTDIR does not exist";
+ } else {
+ error "I do not have permission to write to $OUTPUTDIR";
+ }
}
-}
-# Read all the configuration first, so we can warn of syntax errors
-for my $task (readConfig($CONFIG))
-{
- my ($func, $arg1, $arg2) = @$task;
- &$func($arg1, $arg2);
+ # Read all the configuration first, so we can warn of syntax errors
+ for my $task (readConfig($CONFIG))
+ {
+ my ($islocal, $func, $arg1, $arg2) = @$task;
+ # Skip nonlocal sources if so instructed
+ next if $LOCAL and not $islocal;
+ &$func($arg1, $arg2);
+ }
}
exit 0;
@@ -90,13 +110,13 @@
my $line = $1;
if ($line eq 'apt://')
{
- push @res, [ \&fetcher_apt, undef, "$OUTPUTDIR/apt" ];
+ push @res, [ 1, \&fetcher_apt, undef, "$OUTPUTDIR/apt" ];
}
elsif ($line =~ /^(?:http|ftp):\/\//)
{
my $mangle = $line;
$mangle =~ s/[^A-Za-z0-9._-]/-/g;
- push @res, [ \&fetcher_wget, $line, "$OUTPUTDIR/$mangle" ];
+ push @res, [ undef, \&fetcher_wget, $line, "$OUTPUTDIR/$mangle" ];
}
elsif ($line =~ /^file:(.+)/)
{
@@ -105,7 +125,7 @@
$mangle =~ s/[^A-Za-z0-9._-]/-/g;
# Delete extra leading slashes
$name =~ s/^\/*(\/.+)/$1/;
- push @res, [ \&fetcher_copy, $name, "$OUTPUTDIR/$mangle" ];
+ push @res, [ 1, \&fetcher_copy, $name, "$OUTPUTDIR/$mangle" ];
}
}
More information about the Debtags-commits
mailing list