public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/debmirror] epel10: Do not sum strings in the configuration file to the parameters passed on the command line
@ 2026-06-16 16:41 Simone Caronni
0 siblings, 0 replies; only message in thread
From: Simone Caronni @ 2026-06-16 16:41 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/debmirror
Branch : epel10
Commit : 511bf0db0e5c6e2461c69ac107ebf8714e0d70d4
Author : Simone Caronni <negativo17@gmail.com>
Date : 2026-06-16T18:37:01+02:00
Stats : +38/-61 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/debmirror/c/511bf0db0e5c6e2461c69ac107ebf8714e0d70d4?branch=epel10
Log:
Do not sum strings in the configuration file to the parameters passed on the command line
---
diff --git a/debmirror-arch-filter.patch b/debmirror-arch-filter.patch
deleted file mode 100644
index bd770a3..0000000
--- a/debmirror-arch-filter.patch
+++ /dev/null
@@ -1,58 +0,0 @@
---- 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-cli-overrides-config.patch b/debmirror-cli-overrides-config.patch
new file mode 100644
index 0000000..29aa331
--- /dev/null
+++ b/debmirror-cli-overrides-config.patch
@@ -0,0 +1,34 @@
+--- work.old/debmirror 2026-06-16 18:35:18.926190469 +0200
++++ work/debmirror 2026-06-16 18:35:18.927190479 +0200
+@@ -721,6 +721,18 @@
+
+ my $help;
+ my $print_version;
++# List-valued options that may also be set in a configuration file. When such
++# an option is given on the command line it should override the configured
++# value, not be appended to it (otherwise e.g. the default @arches="i386" from
++# the config file leaks into a "--arch=arm64" run). Save the configured values,
++# clear the arrays so GetOptions only collects command line values, and restore
++# the configured value afterwards for any option not given on the command line.
++my @conf_dists = @dists;
++my @conf_sections = @sections;
++my @conf_arches = @arches;
++@dists = ();
++@sections = ();
++@arches = ();
+ Getopt::Long::Configure qw(no_pass_through);
+ GetOptions('debug' => \$debug,
+ 'progress|p' => \$progress,
+@@ -779,6 +791,12 @@
+ ) or usage;
+ usage if $help;
+ usage("invalid number of arguments") if $ARGV[1];
++
++# Fall back to the configured values for any list option not given on the
++# command line (see the matching block before GetOptions above).
++@dists = @conf_dists unless @dists;
++@sections = @conf_sections unless @sections;
++@arches = @conf_arches unless @arches;
+ if ($print_version) {
+ print "debmirror $version\n";
+ exit(0);
diff --git a/debmirror.spec b/debmirror.spec
index 00bd3c1..8ec1e7c 100644
--- a/debmirror.spec
+++ b/debmirror.spec
@@ -9,9 +9,10 @@ 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
+# Let command line --arch/--dist/--section override the config file values
+# instead of appending to them (e.g. --arch=arm64 must not keep the default
+# @arches="i386" from debmirror.conf, which then 404s on ports.ubuntu.com).
+Patch1: %{name}-cli-overrides-config.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:41 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:41 [rpms/debmirror] epel10: Do not sum strings in the configuration file to the parameters passed on the command line Simone Caronni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox