Package: debmirror
Version: 1:2.4.4
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu lucid ubuntu-patch

Hello!

In addition to the patches waiting in bug 455082, here
is a patch to add a "--skip-installer" option to skip d-i
files for specific dists (this is very handy for Ubuntu).

Thanks,

-Kees

-- 
Kees Cook                                            @debian.org
Description: allow releases to be skipped when fetching installer files.
Author: Jamie Strandboge <[email protected]>, Kees Cook <[email protected]>

Index: debmirror-2.4.4/debmirror
===================================================================
--- debmirror-2.4.4.orig/debmirror	2010-04-05 12:17:14.642650357 -0700
+++ debmirror-2.4.4/debmirror	2010-04-05 12:20:54.705149743 -0700
@@ -69,6 +69,7 @@
           [--postcleanup|--cleanup|--nocleanup] [--skippackages]
           [--diff=use|mirror|none] [--gzip-options=options]
           [--state-cache-days=number]
+          [--skip-installer=foo[,bar,..] ...]
           [--ignore-small-errors] [--allow-dist-rename]
           <mirrordir>
 
@@ -106,6 +107,10 @@
 F<./.temp> working directory, but won't replace the old meta files, won't
 download debs and source files and only simulates cleanup.
 
+=item --skip-installer foo[,bar,..]
+
+Don't download debian-installer files for the specified distribution.
+
 =item --help
 
 Display a usage summary.
@@ -525,7 +530,7 @@
 our $mirrordir;
 our ($debug, $progress, $verbose, $passive, $skippackages, $getcontents, $i18n);
 our ($ua, $proxy);
-our (@dists, @sections, @arches, @extra_dirs, @ignores, @excludes, @includes);
+our (@dists, @sections, @arches, @extra_dirs, @ignores, @excludes, @includes, @skip_installer);
 our (@excludes_deb_section, @limit_priority);
 our (@di_dists, @di_arches, @rsync_extra);
 our $state_cache_days = 0;
@@ -635,6 +640,7 @@
 	   'postcleanup'            => \$post_cleanup,
 	   'nocleanup'              => \$no_cleanup,
 	   'ignore=s'               => \...@ignores,
+	   'skip-installer=s'       => \...@skip_installer,
 	   'exclude=s'              => \...@excludes,
 	   'exclude-deb-section=s'  => \...@excludes_deb_section,
 	   'limit-priority=s'       => \...@limit_priority,
@@ -706,6 +712,8 @@
 $cleanup=0 if ($no_cleanup);
 $post_cleanup=0 if ($no_cleanup);
 $post_cleanup=0 if ($cleanup);
+...@skip_installer=split(/,/,join(',',@skip_installer));
+...@skip_installer=() unless @skip_installer;
 
 # Display configuration.
 $|=1 if $debug;
@@ -889,6 +897,21 @@
   die "Failed to download some Release or Release.gpg files!\n";
 }
 
+# Figure out whether debian-installer should be skipped for a given dist.
+my %skip_installer=("woody" => 1, "experimental" => 1, "breezy-security" => 1);
+foreach my $skipped_dist (@skip_installer) {
+  $skip_installer{$skipped_dist} = 1;
+}
+sub must_skip_installer {
+  my $dist=shift;
+  if ( $dist =~ /.*-proposed-updates/ ||
+       $dist =~ /.*breezy-updates/    ||
+       defined($skip_installer{$dist}) ) {
+    return 1;
+  }
+  return 0;
+}
+
 # Enable caching again for http
 init_connection if ($ua);
 
@@ -949,12 +972,7 @@
 foreach my $dist (keys %distset) {
   next unless exists $distset{$dist}{mirror};
   foreach my $section (@sections) {
-    # no d-i in woody
-    next if ($section =~ /debian-installer/ && $dist eq "woody");
-    next if ($section =~ /debian-installer/ && $dist eq "experimental");
-    next if ($section =~ /debian-installer/ && $dist =~ /.*-proposed-updates/);
-    next if ($section =~ /debian-installer/ && $dist =~ /.*breezy-updates/ );
-    next if ($section =~ /debian-installer/ && $dist eq "breezy-security" );
+    next if ($section =~ /debian-installer/ && must_skip_installer($dist));
     foreach my $arch (@arches) {
       get_index("dists/$dist/$section/binary-$arch", "Packages");
     }

Reply via email to