[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#815728: jessie-pu: package debmirror/1:2.16+deb8u1



Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

As the new debmirror maintainer, I'd like to fix a couple of problems
with the version in stable.  One is serious and causes debmirror to sit
in an infinite loop when run against the current Debian archive
(#808216, #815149).  While the other doesn't have quite such dire
consequences, a current desktop system with the appstream package
installed needs to have the DEP-11 metadata files present in order for
"apt update" to succeed (#814416).

I think it makes sense to fix both of these in stable, and my proposed
patch follows.  Both changes are cherry-picks from unstable.

diff -Nru debmirror-2.16/debian/changelog debmirror-2.16+deb8u1/debian/changelog
--- debmirror-2.16/debian/changelog	2013-08-26 17:41:08.000000000 +0100
+++ debmirror-2.16+deb8u1/debian/changelog	2016-02-24 07:28:48.000000000 +0000
@@ -1,3 +1,10 @@
+debmirror (1:2.16+deb8u1) stable; urgency=medium
+
+  * Tolerate unknown lines in *.diff/Index (closes: #808216, #815149).
+  * Mirror DEP-11 metadata files (closes: #814416).
+
+ -- Colin Watson <cjwatson@debian.org>  Wed, 24 Feb 2016 07:28:42 +0000
+
 debmirror (1:2.16) unstable; urgency=low
 
   * Fix confusing output with --precleanup.
diff -Nru debmirror-2.16/debmirror debmirror-2.16+deb8u1/debmirror
--- debmirror-2.16/debmirror	2013-06-23 17:34:26.000000000 +0100
+++ debmirror-2.16+deb8u1/debmirror	2016-02-24 07:27:41.000000000 +0000
@@ -671,6 +671,10 @@
 # info. Files also get registered in %files.
 my %i18n_get;
 
+# Hash to record which DEP-11 metadata files need to be downloaded. Files
+# also get registered in %files.
+my %dep11_get;
+
 # Separate hash for files belonging to Debian Installer images.
 # This data is not cached.
 my %di_files;
@@ -1092,7 +1096,7 @@
 # for the ftp method.
 $do_dry_run = $dry_run;
 
-# Determine size of Contents and Translation files to get.
+# Determine size of Contents, Translation, and DEP-11 files to get.
 if ($getcontents) {
   # Updates of Contents files using diffs are done here; only full downloads
   # are delayed.
@@ -1126,6 +1130,7 @@
   next unless exists $distset{$dist}{mirror};
   foreach my $section (@sections) {
     i18n_from_release($dist,"$section/i18n");
+    dep11_from_release($dist,"$section/dep11");
   }
 }
 
@@ -1296,16 +1301,17 @@
   }
 }
 
-# With pre-mirror cleanup Contents and Translation files need to be
+# With pre-mirror cleanup Contents, Translation, and DEP-11 files need to be
 # downloaded before the cleanup as otherwise they would be deleted
 # because they haven't been registered yet.
 # With post-mirror cleanup it's more neat to do all downloads together.
 # This could be simplified if we could register the files earlier.
 
-# Download Contents and Translation files.
+# Download Contents, Translation, and DEP-11 files.
 init_connection();
 get_contents_files() if ($getcontents);
 get_i18n_files();
+get_dep11_files();
 
 # Pre-mirror cleanup
 if ($pre_cleanup) {
@@ -1982,7 +1988,7 @@
   }
 }
 
-sub link_translation_into_snapshot {
+sub link_auxfile_into_snapshot {
   my ($file,$dist,$distpath,$filename,$mirrordir,$tempdir) = @_;
   my $next = get_next_snapshot($dist);
   my $target_path = "$mirrordir/dists/$dist/$next/$distpath";
@@ -2421,12 +2427,67 @@
     if (! check_i18n("$tempdir/$file", $i18n_get{$file}{size}, $i18n_get{$file}{sha1})) {
       remote_get("$file");
       if ($debmarshal) {
-	link_translation_into_snapshot($file,
-				       $i18n_get{$file}{dist},
-				       $i18n_get{$file}{distpath},
-				       $i18n_get{$file}{filename},
-				       $mirrordir,
-				       $tempdir);
+        link_auxfile_into_snapshot($file,
+                                   $i18n_get{$file}{dist},
+                                   $i18n_get{$file}{distpath},
+                                   $i18n_get{$file}{filename},
+                                   $mirrordir,
+                                   $tempdir);
+      }
+    }
+  }
+}
+
+sub dep11_from_release {
+  my ($dist,$distpath) = @_;
+  my $subdir = "dists/$dist/$distpath";
+  my $compdir = $tempdir."/".$subdir;
+  my ($size, $filename);
+  my $exclude = "(".join("|", @excludes).")" if @excludes;
+  my $include = "(".join("|", @includes).")" if @includes;
+
+  # Create dep11 directories
+  make_dir($subdir);
+  make_dir($compdir);
+
+  # Search for DEP-11 files in file_lists
+  foreach my $path (keys %file_lists) {
+    next if length($compdir)+1>length($path); # the +1 stands for the slash after $compdir
+    next if substr($path, 0, length($compdir)) ne $compdir;
+
+    my $filename = substr($path, length($compdir)+1, length($path)-length($compdir)-1);
+    next if $filename !~ /\.(?:gz|bz2|xz)$/;
+    my $all_arches = "(".join("|", map(quotemeta, @arches)).")";
+    next if $filename =~ /^Components-/ and $filename !~ /^Components-$all_arches\./;
+
+    my $size = $file_lists{$path}{size};
+    if(!(defined($include) && ($subdir."/".$filename)=~/$include/o)) {
+      next if (defined($exclude) && ($subdir."/".$filename)=~/$exclude/o);
+    }
+
+    $files{"$subdir/$filename"}=1;
+    $files{$tempdir."/"."$subdir/$filename"}=1;
+    if (!check_lists("$tempdir/$subdir/$filename")) {
+      $bytes_to_get += $size;
+      $dep11_get{"$subdir/$filename"}{dist} = $dist;
+      $dep11_get{"$subdir/$filename"}{distpath} = $distpath;
+      $dep11_get{"$subdir/$filename"}{filename} = $filename;
+    }
+  }
+}
+
+sub get_dep11_files {
+  say("Get DEP-11 metadata files ...");
+  foreach my $file (sort keys %dep11_get) {
+    if (!check_lists("$tempdir/$file")) {
+      remote_get($file);
+      if ($debmarshal) {
+        link_auxfile_into_snapshot($file,
+                                   $dep11_get{$file}{dist},
+                                   $dep11_get{$file}{distpath},
+                                   $dep11_get{$file}{filename},
+                                   $mirrordir,
+                                   $tempdir);
       }
     }
   }
@@ -2463,6 +2524,9 @@
 	$diff_size{$file} = $size;
       }
     }
+    else {
+      $_ = <INDEX>;
+    }
   }
   close(INDEX);
 

-- System Information:
Debian Release: 8.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Colin Watson                                       [cjwatson@debian.org]


Reply to: