From 5a19e0e52a5eb425d8dbed23a974ccb31d15d5200e947f146671dde48df74221 Mon Sep 17 00:00:00 2001 From: Elisei Roca Date: Thu, 1 Sep 2022 14:12:03 +0000 Subject: [PATCH] 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 --- ...oid-by-and-ru-mrrors-for-ua-requests.patch | 47 +++++++++++++++++++ MirrorCache.changes | 6 +++ MirrorCache.spec | 3 +- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch diff --git a/0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch b/0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch new file mode 100644 index 0000000..19f1ee6 --- /dev/null +++ b/0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch @@ -0,0 +1,47 @@ +From 7d9346897af13e5e5ca1752b7a9cfb5718305228 Mon Sep 17 00:00:00 2001 +From: Andrii Nikitin +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 + diff --git a/MirrorCache.changes b/MirrorCache.changes index 46ef2bf..44ff0d1 100644 --- a/MirrorCache.changes +++ b/MirrorCache.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 1 14:09:37 UTC 2022 - Elisei Roca + +- 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 diff --git a/MirrorCache.spec b/MirrorCache.spec index cd93654..56b3b51 100644 --- a/MirrorCache.spec +++ b/MirrorCache.spec @@ -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}