Package: debmirror Version: 1:2.26 Tags: patch Hi,
1) debmirror fails with --debmarshal and --getcontents $ debmirror --rsync-extra=none --method http --keyring /usr/share/keyrings/debian-archive-keyring.gpg --debmarshal --getcontents mirror Warning: --rsync-extra is not configured to mirror the trace files. This configuration is not recommended. Error while linking .temp/dists/sid/contrib/Contents-i386.gz: No such file or directory WARNING: releasing 1 pending lock... link_contents_into_snapshot() is called i a $sect loop and contains itself a $sect loop. Patch 01-debmarshal-getcontents.diff removes the loop in link_contents_into_snapshot(). 2) debmirror fails with --debmarshal and --dry-run and updates latest symlink Without --getcontents: $ debmirror --rsync-extra=none --method http --keyring /usr/share/keyrings/debian-archive-keyring.gpg --debmarshal --dry-run mirror ... [ 0%] Getting: dists/sid/contrib/i18n/Translation-en.bz2... ok linking dists/sid/contrib/i18n/Translation-en.bz2 Error while linking .temp/dists/sid/contrib/i18n/Translation-en.bz2: No such file or directory at /usr/bin/debmirror line 2028. WARNING: releasing 1 pending lock... With --getcontents: $ debmirror --rsync-extra=none --method http --keyring /usr/share/keyrings/debian-archive-keyring.gpg --debmarshal --dry-run --getcontents mirror ... [100%] Getting: dists/sid/main/Contents-i386.diff/Index... ok .temp/dists/sid/main/Contents-i386.diff/Index: No such file or directory at /usr/bin/debmirror line 2571. WARNING: releasing 1 pending lock... Patch 02-debmarshal-dry-run.diff fixes --debmarshal in --dry-run mode. 3) debmirror fails with --dry-run and --getcontents if --diff is != none debmirror --rsync-extra=none --method http --keyring /usr/share/keyrings/debian-archive-keyring.gpg --dry-run --getcontents mirror ... http://ftp.debian.org/debian/dists/sid/main/Contents-i386.diff/Index => [100%] Getting: dists/sid/main/Contents-i386.diff/Index... ok .temp/dists/sid/main/Contents-i386.diff/Index: No such file or directory at /usr/bin/debmirror line 2570. WARNING: releasing 1 pending lock... Patch 03-dry-run-getcontents.diff 4) debmirror creates pool/ and dists/$dist/ directory tree with --dry-run I did not expect that in --dry-run mode. Patch 04-dry-run.diff Regards Stefan
diff --git a/debmirror b/debmirror index 51fc92d..059cc23 100755 --- a/debmirror +++ b/debmirror @@ -2007,17 +2007,14 @@ sub link_release_into_snapshot { } sub link_contents_into_snapshot { - my ($dist,$mirrordir,$arch,$tempdir) = @_; + my ($dist,$mirrordir,$arch,$sect,$tempdir) = @_; my $next = get_next_snapshot($dist); - 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"; - } + say("Linking dists/$dist$sect/Contents-$arch.gz to $next"); + 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"; } } @@ -2419,7 +2416,7 @@ sub get_contents_files { $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); + link_contents_into_snapshot($dist,$mirrordir,$arch,$sect,$tempdir); } }; my $first = 1;
diff --git a/debmirror b/debmirror index 059cc23..dd66362 100755 --- a/debmirror +++ b/debmirror @@ -995,8 +995,12 @@ foreach my $dist (@dists) { $files{"dists/$codename$dist_sdir/Release"}=1; $files{$tempdir."/"."dists/$codename$dist_sdir/Release"}=1; if ($debmarshal) { - $next = make_next_snapshot($mirrordir,$dist,$codename, - $dist_sdir,$tempdir); + $next = get_next_snapshot($dist); + say("Making dists/$codename$dist_sdir snapshot $next"); + make_dir("$mirrordir/dists/$dist/$next") if ! $dry_run; + say("Linking dists/$codename$dist_sdir/Release to $next"); + link_release_into_snapshot($mirrordir,$dist,$next,$tempdir, + $codename,$dist_sdir,"Release") if ! $dry_run; } if (-f "$tdir/Release.gpg") { rename("$tdir/Release.gpg", "$tempdir/dists/$codename$dist_sdir/Release.gpg") @@ -1004,8 +1008,9 @@ foreach my $dist (@dists) { $files{"dists/$codename$dist_sdir/Release.gpg"}=1; $files{$tempdir."/"."dists/$codename$dist_sdir/Release.gpg"}=1; if ($debmarshal) { + say("Linking dists/$codename$dist_sdir/Release.gpg to $next"); link_release_into_snapshot($mirrordir,$dist,$next,$tempdir, - $codename,$dist_sdir,"Release.gpg"); + $codename,$dist_sdir,"Release.gpg") if ! $dry_run; } } if (-f "$tdir/InRelease") { @@ -1014,8 +1019,9 @@ foreach my $dist (@dists) { $files{"dists/$codename$dist_sdir/InRelease"}=1; $files{$tempdir."/"."dists/$codename$dist_sdir/InRelease"}=1; if ($debmarshal) { + say("Linking dists/$codename$dist_sdir/InRelease to $next"); link_release_into_snapshot($mirrordir,$dist,$next,$tempdir, - $codename,$dist_sdir,"InRelease"); + $codename,$dist_sdir,"InRelease") if ! $dry_run; } } } @@ -1968,18 +1974,6 @@ sub get_next_snapshot { return $latest; } -sub make_next_snapshot { - my ($mirrordir, $dist, $codename, $dist_sdir, $tempdir) = @_; - - my $next = get_next_snapshot($dist); - make_dir("$mirrordir/dists/$dist/$next"); - unlink("$mirrordir/dists/$dist/$next/Release"); - link("$tempdir/dists/$codename$dist_sdir/Release", - "$mirrordir/dists/$dist/$next/Release") - or die "Error while linking $tempdir/dists/$codename$dist_sdir/Release: $!\n"; - return $next; -} - sub update_latest_links { my ($mirrordir, $tempdir, @dists) = @_; foreach my $dist (@dists) { @@ -1988,9 +1982,11 @@ sub update_latest_links { if ($?) { my $next = get_next_snapshot($dist); say("Updating $mirrordir/dists/$dist/latest to $next"); - unlink("$mirrordir/dists/$dist/latest"); - symlink($next,"$mirrordir/dists/$dist/latest") - or die "Error while symlinking $mirrordir/dists/$dist/latest to $next: $\n"; + if (! $do_dry_run) { + unlink("$mirrordir/dists/$dist/latest"); + symlink($next,"$mirrordir/dists/$dist/latest") + or die "Error while symlinking $mirrordir/dists/$dist/latest to $next: $\n"; + } } else { say("Not updating $mirrordir/dists/$dist/latest"); } @@ -2010,11 +2006,13 @@ sub link_contents_into_snapshot { my ($dist,$mirrordir,$arch,$sect,$tempdir) = @_; my $next = get_next_snapshot($dist); say("Linking dists/$dist$sect/Contents-$arch.gz to $next"); - 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"; + if (! $do_dry_run) { + 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"; + } } } @@ -2022,11 +2020,13 @@ 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"; - say("linking $file"); - unlink("$target_path/$filename"); - make_path($target_path); - link("$tempdir/$file", "$target_path/$filename") - or die "Error while linking $tempdir/$file: $!"; + say("Linking $file to $next"); + if (! $do_dry_run ) { + unlink("$target_path/$filename"); + make_path($target_path); + link("$tempdir/$file", "$target_path/$filename") + or die "Error while linking $tempdir/$file: $!"; + } } sub gpg_verify { @@ -2428,7 +2428,7 @@ sub get_contents_files { # hardlink index files from tempdir to next debmarshal snapshot location sub link_index { my ($dist,$section,$arch) = @_; - my ($file,$archdir); + my ($file,$archdir,$subdir,$nextdir); if ($arch eq "source") { $file = "Sources"; $archdir = "source"; @@ -2437,19 +2437,18 @@ sub link_index { $archdir = "binary-$arch"; } my $next = get_next_snapshot($dist); - make_dir("$mirrordir/dists/$dist/$next/$section/$archdir"); - unlink("$mirrordir/dists/$dist/$next/$section/$archdir/$file"); - link("$tempdir/dists/$dist/$section/$archdir/$file", - "$mirrordir/dists/$dist/$next/$section/$archdir/$file") - or warn "Error while linking $tempdir/dists/$dist/$section/$archdir/$file: $!\n"; - unlink("$mirrordir/dists/$dist/$next/$section/$archdir/$file.gz"); - link("$tempdir/dists/$dist/$section/$archdir/$file.gz", - "$mirrordir/dists/$dist/$next/$section/$archdir/$file.gz") - or die "Error while linking $tempdir/dists/$dist/$section/$archdir/$file.gz: $!\n"; - unlink("$mirrordir/dists/$dist/$next/$section/$archdir/$file.xz"); - link("$tempdir/dists/$dist/$section/$archdir/$file.xz", - "$mirrordir/dists/$dist/$next/$section/$archdir/$file.xz") - or die "Error while linking $tempdir/dists/$dist/$section/$archdir/$file.xz: $!\n"; + $subdir = "$tempdir/dists/$dist/$section/$archdir"; + $nextdir = "$mirrordir/dists/$dist/$next/$section/$archdir"; + say("Linking dists/$dist/$section/$archdir/$file to $next"); + if (! $dry_run) { + make_dir("$nextdir"); + unlink("$nextdir/$file"); + link("$subdir/$file","$nextdir/$file") or warn "Error while linking $subdir/$file: $!\n"; + unlink("$nextdir/$file.gz"); + link("$subdir/$file.gz","$nextdir/$file.gz") or warn "Error while linking $subdir/$file.gz: $!\n"; + unlink("$nextdir/$file.xz"); + link("$subdir/$file.xz","$nextdir/$file.xz") or warn "Error while linking $subdir/$file.xz: $!\n"; + } } sub i18n_from_release {
diff --git a/debmirror b/debmirror index dd66362..3490d4b 100755 --- a/debmirror +++ b/debmirror @@ -2386,7 +2386,7 @@ sub update_contents { if (! -f "$tempdir/$subdir/$file.gz" || $file_ok) { # fetch diffs only - fetch_and_apply_diffs(1, $subdir, $file); + fetch_and_apply_diffs(1, $subdir, $file) if ! $do_dry_run; return $file_ok; }
diff --git a/debmirror b/debmirror index 3490d4b..c8e6f83 100755 --- a/debmirror +++ b/debmirror @@ -988,7 +988,7 @@ foreach my $dist (@dists) { if ($have_release) { my $next; - make_dir ("dists/$codename$dist_sdir"); + make_dir ("dists/$codename$dist_sdir") if ! $dry_run; make_dir ("$tempdir/dists/$codename$dist_sdir"); rename("$tdir/Release", "$tempdir/dists/$codename$dist_sdir/Release") or die "Error while moving $tdir/Release: $!\n"; @@ -1374,7 +1374,7 @@ sub batch_get { foreach my $file (sort keys %files) { if (!$files{$file}) { if (($dirname) = $file =~ m:(.*)/:) { - make_dir($dirname); + make_dir($dirname) if ! $dry_run; } if ($ftp) { ftp_get($file); @@ -2227,7 +2227,7 @@ sub name_release { sub get_index { my $subdir=shift; my $file=shift; - make_dir($subdir); + make_dir($subdir) if ! $dry_run; make_dir("$tempdir/$subdir"); if ($diff_mode ne "none" && exists $file_lists{"$tempdir/$subdir/$file.diff/Index"}) { @@ -2460,7 +2460,7 @@ sub i18n_from_release { my $include = "(".join("|", @includes).")" if @includes; # Create i18n directories - make_dir($subdir); + make_dir($subdir) if ! $dry_run; make_dir($compdir); # Search for translation files in file_lists @@ -2513,7 +2513,7 @@ sub dep11_from_release { my $include = "(".join("|", @includes).")" if @includes; # Create dep11 directories - make_dir($subdir); + make_dir($subdir) if ! $dry_run; make_dir($compdir); # Search for DEP-11 files in file_lists