From ee9e63141e6b871fbfee4ee12203ced29695dce9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 23 Jun 2013 12:35:32 -0400 Subject: Support new Contents file location used for wheezy, while still handling the old location. Closes: #637442 Thanks, Christoph Pleger --- debian/changelog | 3 +++ debmirror | 63 +++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2486fba..5c92ede 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ debmirror (1:2.16) UNRELEASED; urgency=low * Fix confusing output with --precleanup. Closes: #708355 + * Support new Contents file location used for wheezy, while still + handling the old location. + Closes: #637442 Thanks, Christoph Pleger -- Joey Hess Wed, 15 May 2013 13:28:42 -0400 diff --git a/debmirror b/debmirror index 872825b..0c2543c 100755 --- a/debmirror +++ b/debmirror @@ -1103,12 +1103,21 @@ if ($getcontents) { next if $dist=~/experimental/; next if $dist=~/.*-proposed-updates/; next if $arch=~/source/; - if ($diff_mode ne "none") { - if (!update_contents("dists/$dist", "Contents-$arch")) { - add_bytes("dists/$dist/Contents-$arch.gz"); - } - } elsif (!check_lists("$tempdir/dists/$dist/Contents-$arch.gz")) { - add_bytes("dists/$dist/Contents-$arch.gz"); + # In Debian Wheezy, the Contents-*.gz moved to '/dists/$dist/$sect/'. + # This handles the new location, but also checks the old location + # for backwards compatibility. + push my @sects, @sections, ""; + foreach my $sect (@sects) { + if ($sect ne "") {$sect = "/$sect";} + if (exists $file_lists{"$tempdir/dists/$dist${sect}Contents-$arch.gz"}) { + if ($diff_mode ne "none") { + if (!update_contents("dists/$dist$sect", "Contents-$arch")) { + add_bytes("dists/$dist$sect/Contents-$arch.gz"); + } + } elsif (!check_lists("$tempdir/dists/$dist$sect/Contents-$arch.gz")) { + add_bytes("dists/$dist$sect/Contents-$arch.gz"); + } + } } } } @@ -1961,10 +1970,16 @@ sub link_release_into_snapshot { sub link_contents_into_snapshot { my ($dist,$mirrordir,$arch,$tempdir) = @_; my $next = get_next_snapshot($dist); - unlink("$mirrordir/dists/$dist/$next/Contents-$arch.gz"); - link("$tempdir/dists/$dist/Contents-$arch.gz", - "$mirrordir/dists/$dist/$next/Contents-$arch.gz") - or die "Error while linking $tempdir/dists/$dist/Contents-$arch.gz: $!\n"; + push my @sects, @sections, ""; + foreach my $sect (@sects) { + if ($sect ne "") {$sect = "/$sect";} + if (exists $file_lists{"$tempdir/dists/$dist$sect/Contents-$arch.gz"}) { + unlink("$mirrordir/dists/$dist/$next$sect/Contents-$arch.gz"); + link("$tempdir/dists/$dist$sect/Contents-$arch.gz", + "$mirrordir/dists/$dist/$next$sect/Contents-$arch.gz") + or die "Error while linking $tempdir/dists/$dist$sect/Contents-$arch.gz: $!\n"; + } + } } sub link_translation_into_snapshot { @@ -2312,17 +2327,23 @@ sub get_contents_files { next if $dist=~/experimental/; next if $dist=~/.*-proposed-updates/; next if $arch=~/source/; - if (!check_lists("$tempdir/dists/$dist/Contents-$arch.gz")) { - if ($first) { - say("Get Contents files."); - $first = 0; - } - remote_get("dists/$dist/Contents-$arch.gz"); - } - $files{"dists/$dist/Contents-$arch.gz"}=1; - $files{$tempdir."/"."dists/$dist/Contents-$arch.gz"}=1; - if ($debmarshal) { - link_contents_into_snapshot($dist,$mirrordir,$arch,$tempdir); + push my @sects, @sections, ""; + foreach my $sect (@sects) { + if ($sect ne "") {$sect = "/$sect";} + if (exists $file_lists{"$tempdir/dists/$dist$sect/Contents-$arch.gz"}) { + if (!check_lists("$tempdir/dists/$dist$sect/Contents-$arch.gz")) { + if ($first) { + say("Get Contents files."); + $first = 0; + } + remote_get("dists/$dist$sect/Contents-$arch.gz"); + } + $files{"dists/$dist$sect/Contents-$arch.gz"}=1; + $files{$tempdir."/"."dists/$dist$sect/Contents-$arch.gz"}=1; + if ($debmarshal) { + link_contents_into_snapshot($dist,$mirrordir,$arch,$tempdir); + } + } } } } -- cgit v1.2.3