public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/debmirror] epel10: Parse the Architectures field in the Release file to select architectures. Fixes mirroring specific architectures from ports.ubuntu.com.
@ 2026-06-16 16:16 Simone Caronni
  0 siblings, 0 replies; only message in thread
From: Simone Caronni @ 2026-06-16 16:16 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/debmirror
Branch : epel10
Commit : 6b992d8941be281e8378f8517e298df2e7676b0c
Author : Simone Caronni <negativo17@gmail.com>
Date   : 2026-06-16T18:14:52+02:00
Stats  : +62/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/debmirror/c/6b992d8941be281e8378f8517e298df2e7676b0c?branch=epel10

Log:
Parse the Architectures field in the Release file to select architectures. Fixes mirroring specific architectures from ports.ubuntu.com.

---
diff --git a/debmirror-arch-filter.patch b/debmirror-arch-filter.patch
new file mode 100644
index 0000000..bd770a3
--- /dev/null
+++ b/debmirror-arch-filter.patch
@@ -0,0 +1,58 @@
+--- work.old/debmirror	2026-06-16 18:09:04.536855747 +0200
++++ work/debmirror	2026-06-16 18:09:04.536855747 +0200
+@@ -1065,7 +1065,13 @@
+   if (open my $release, "<", "$tempdir/dists/$dist/Release") {
+     my $checksum_type;
+     while (<$release>) {
+-        if (/^(MD5Sum|SHA\d+):/) {
++        if (/^Architectures:\s+(.*)$/ && !defined $checksum_type) {
++                # Record the architectures this dist actually provides, so
++                # we don't try to fetch Packages files for arches (e.g. i386
++                # on ports.ubuntu.com) that are not part of this Release.
++                $distset{$dist}{arches}{$_} = 1 foreach (split(/\s+/, $1));
++        }
++        elsif (/^(MD5Sum|SHA\d+):/) {
+                 $checksum_type=$1;
+         }
+         elsif (/^ / && defined $checksum_type) {
+@@ -1106,10 +1112,21 @@
+   $bytes_to_get +=  $file_lists{"$tempdir/$name"}{size} if exists $file_lists{"$tempdir/$name"}{size};
+   return;
+ }
++# Return the list of requested architectures that the given dist actually
++# provides, according to the "Architectures" field of its Release file.
++# "all" is always included. If the Release file did not declare any
++# architectures, fall back to all requested arches (previous behaviour).
++sub dist_arches {
++  my $dist=shift;
++  if (exists $distset{$dist}{arches}) {
++    return (grep { exists $distset{$dist}{arches}{$_} } @arches), "all";
++  }
++  return (@arches, "all");
++}
+ foreach my $dist (keys %distset) {
+   next unless exists $distset{$dist}{mirror};
+   foreach my $section (@sections) {
+-    foreach my $arch (@arches, "all") {
++    foreach my $arch (dist_arches($dist)) {
+       add_bytes("dists/$dist/$section/binary-$arch/Packages");
+       add_bytes("dists/$dist/$section/binary-$arch/Packages.gz");
+       add_bytes("dists/$dist/$section/binary-$arch/Packages.xz");
+@@ -1139,7 +1156,7 @@
+   foreach my $section (@sections) {
+     # some suites don't have d-i
+     next if ($section =~ /debian-installer/ && di_skip_dist($dist) );
+-    foreach my $arch (@arches, "all") {
++    foreach my $arch (dist_arches($dist)) {
+       get_index("dists/$dist/$section/binary-$arch", "Packages");
+       link_index($dist,$section,$arch) if $debmarshal;
+     }
+@@ -3311,7 +3328,7 @@
+   my @sects = ((map {"/$_"} @sections), "");
+   foreach my $dist (keys %distset) {
+     next unless exists $distset{$dist}{mirror};
+-    foreach my $arch (@arches, "all") {
++    foreach my $arch (dist_arches($dist)) {
+       my %op_params = %$operational_params;
+       $op_params{is_source} = $arch=~/\bsource\b/o;
+       unless ($op_params{is_source} && !$op_params{do_for_source}) {

diff --git a/debmirror.spec b/debmirror.spec
index 0a798ef..00bd3c1 100644
--- a/debmirror.spec
+++ b/debmirror.spec
@@ -7,7 +7,11 @@ URL:        https://tracker.debian.org/pkg/debmirror
 BuildArch:  noarch
 
 Source:     https://ftp.debian.org/debian/pool/main/d/%{name}/%{name}_%{version}.tar.xz
+# Allow mirroring without being root (drop hardcoded root path assumptions).
 Patch0:     %{name}-no-root.patch
+# Only fetch Packages/dists files for architectures the dist's Release file
+# actually provides (e.g. i386 is absent on ports.ubuntu.com), avoiding 404s.
+Patch1:     %{name}-arch-filter.patch
 
 BuildRequires: perl
 BuildRequires: perl-generators

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-16 16:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16 16:16 [rpms/debmirror] epel10: Parse the Architectures field in the Release file to select architectures. Fixes mirroring specific architectures from ports.ubuntu.com Simone Caronni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox