public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Simone Caronni <negativo17@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/debmirror] f43: Parse the Architectures field in the Release file to select architectures. Fixes mirroring specific architectures from ports.ubuntu.com.
Date: Tue, 16 Jun 2026 16:16:04 GMT	[thread overview]
Message-ID: <178162656491.1.18276337434040436651.rpms-debmirror-6b992d8941be@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/debmirror
Branch : f43
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=f43

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

                 reply	other threads:[~2026-06-16 16:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178162656491.1.18276337434040436651.rpms-debmirror-6b992d8941be@fedoraproject.org \
    --to=negativo17@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox