Add temporary patch to avoid by and ru mirrors for ua requests

OBS-URL: https://build.opensuse.org/package/show/openSUSE:infrastructure:MirrorCache/MirrorCache?expand=0&rev=63
This commit is contained in:
Elisei Roca 2022-09-01 14:12:03 +00:00 committed by Git OBS Bridge
parent c58dc80107
commit 5a19e0e52a
3 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From 7d9346897af13e5e5ca1752b7a9cfb5718305228 Mon Sep 17 00:00:00 2001
From: Andrii Nikitin <anikitin@suse.de>
Date: Thu, 1 Sep 2022 14:11:40 +0200
Subject: [PATCH] Avoid by and ru mrrors for ua requests
---
lib/MirrorCache/Datamodule.pm | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/MirrorCache/Datamodule.pm b/lib/MirrorCache/Datamodule.pm
index 5e5c2d8..7fb4cfd 100644
--- a/lib/MirrorCache/Datamodule.pm
+++ b/lib/MirrorCache/Datamodule.pm
@@ -322,8 +322,18 @@ sub _init_location($self) {
$region = lc($p);
}
}
- if (my $p = $query->param('AVOID_COUNTRY')) {
+ $country = substr(lc($country), 0, 2) if $country;
+ $country = $country // '';
+ my $p = $query->param('AVOID_COUNTRY');
+ if ($p || $country eq 'ua') {
my @avoid_countries = ();
+ if ($country eq 'ua') {
+ if ($p) {
+ $p = $p . ',by,ru';
+ } else {
+ $p = 'by,ru';
+ }
+ }
for my $c (split ',', $p) {
next unless length($c) == 2;
$c = lc($c);
@@ -331,8 +341,8 @@ sub _init_location($self) {
$country = '' if $c eq lc($country // '');
}
$self->_avoid_countries(\@avoid_countries);
- }
- $country = substr($country, 0, 2) if $country;
+ }
+
$self->_country($country // '');
$self->_region($region // '');
}
--
2.35.3

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 1 14:09:37 UTC 2022 - Elisei Roca <eroca@suse.com>
- Add temporary patch to avoid by and ru mirrors for ua requests
* 0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch
-------------------------------------------------------------------
Fri Aug 26 13:17:22 UTC 2022 - Andrii Nikitin <andrii.nikitin@suse.com>

View File

@ -34,6 +34,7 @@ Source2: %{name}-user.conf
Source3: %{name}-tmpfilesd.conf
# use update-cache (or tools/generate-packed-assets) to generate/update cache.tar.xz
Source101: update-cache.sh
Patch0: 0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch
BuildRequires: %{build_requires}
Requires: %{main_requires}
Requires: perl(Minion) >= 10.0
@ -44,7 +45,7 @@ BuildArch: noarch
Mirror redirector web service, which automatically scans the main server and mirrors
%prep
%setup -q -a1
%autosetup -p1
%build
# make {?_smp_mflags}