Hello, > This would require debmirror to change at every debian release to keep the list of release names up-to-date. Can't it simply detect where the file is?
Ok, here is a second version that finds the location of the contents files by analyzing the Release file. Regards Christoph
--- debmirror.sid 2013-06-14 13:36:04.000000000 +0200 +++ debmirror.sid.modified 2013-06-18 12:11:39.000000000 +0200 @@ -1104,6 +1104,23 @@ next if $dist=~/experimental/; next if $dist=~/.*-proposed-updates/; next if $arch=~/source/; + +#EDIT: In Debian Wheezy, the Contents-*.gz moved to '/dists/$dist/$sect/'. The following changes take account +# of the new location, but also respect the old location for backwards compatibility + foreach my $sect (@sections) { + # only download contents-file from wheezy-location if it exists in release-file + 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"); + } + } + } + # furthermore download from old location, only if it is mentioned in release-file + if (exists $file_lists{"$tempdir/dists/$dist/Contents-$arch.gz"}) { if ($diff_mode ne "none") { if (!update_contents("dists/$dist", "Contents-$arch")) { add_bytes("dists/$dist/Contents-$arch.gz"); @@ -1112,6 +1129,8 @@ add_bytes("dists/$dist/Contents-$arch.gz"); } } +#END-EDIT + } } } foreach my $dist (keys %distset) { @@ -1962,10 +1981,27 @@ sub link_contents_into_snapshot { my ($dist,$mirrordir,$arch,$tempdir) = @_; my $next = get_next_snapshot($dist); +#EDIT: new contents location, see first #EDIT. +# TODO: The following changes have not been tested yet. Please test them +# before using in a production environment. + # wheezy-location + foreach my $sect (@sections) { + 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"; + } + } + + # old location + if (exists $file_lists{"$tempdir/dists/$dist/Contents-$arch.gz"}) { 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"; + } +#END_EDIT } sub link_translation_into_snapshot { @@ -2313,6 +2349,24 @@ next if $dist=~/experimental/; next if $dist=~/.*-proposed-updates/; next if $arch=~/source/; +#EDIT: new contents-location, see first #EDIT. + foreach my $sect (@sections) { + 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); + } + } + } + if (exists $file_lists{"$tempdir/dists/$dist/Contents-$arch.gz"}) { if (!check_lists("$tempdir/dists/$dist/Contents-$arch.gz")) { if ($first) { say("Get Contents files."); @@ -2325,6 +2379,8 @@ if ($debmarshal) { link_contents_into_snapshot($dist,$mirrordir,$arch,$tempdir); } +#END_EDIT + } } } }