Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package MirrorCache for openSUSE:Factory 
checked in at 2022-09-09 18:27:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/MirrorCache (Old)
 and      /work/SRC/openSUSE:Factory/.MirrorCache.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "MirrorCache"

Fri Sep  9 18:27:42 2022 rev:18 rq:1002168 version:1.039

Changes:
--------
--- /work/SRC/openSUSE:Factory/MirrorCache/MirrorCache.changes  2022-08-19 
17:59:01.320420212 +0200
+++ /work/SRC/openSUSE:Factory/.MirrorCache.new.2083/MirrorCache.changes        
2022-09-09 18:29:13.921221291 +0200
@@ -1,0 +2,28 @@
+Thu Sep  1 14:29:10 UTC 2022 - Elisei Roca <[email protected]>
+
+- Update assets cache
+
+-------------------------------------------------------------------
+Thu Sep  1 14:09:37 UTC 2022 - Elisei Roca <[email protected]>
+
+- 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 <[email protected]>
+
+- Update to version 1.039:
+  * Fix editing columns with underscore in /app (#297)
+  * Fix mirror report links in header (#297)
+
+-------------------------------------------------------------------
+Wed Aug 24 08:12:10 UTC 2022 - Andrii Nikitin <[email protected]>
+
+- Update to version 1.038:
+  * Control order of projects in mirrors report (#294)
+  * Include subsidiary url into region in /report/mirrors (#295)
+  * Add mirror report links to header in openSUSE template (#296)
+  * Add operator to mirrors report (#296)
+  * Add column sponsor to server table (#296)
+
+-------------------------------------------------------------------

Old:
----
  MirrorCache-1.037.obscpio

New:
----
  0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch
  MirrorCache-1.039.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ MirrorCache.spec ++++++
--- /var/tmp/diff_new_pack.Alu1tH/_old  2022-09-09 18:29:14.409222575 +0200
+++ /var/tmp/diff_new_pack.Alu1tH/_new  2022-09-09 18:29:14.413222586 +0200
@@ -22,7 +22,7 @@
 %define main_requires %{assetpack_requires} perl(Carp) perl(DBD::Pg) >= 3.7.4 
perl(DBI) >= 1.632 perl(DBIx::Class) >= 0.082801 
perl(DBIx::Class::DynamicDefault) perl(DateTime) perl(Encode) perl(Time::Piece) 
perl(Time::Seconds) perl(Time::ParseDate) perl(DateTime::Format::Pg) 
perl(Exporter) perl(File::Basename) perl(LWP::UserAgent) perl(Mojo::Base) 
perl(Mojo::ByteStream) perl(Mojo::IOLoop) perl(Mojo::JSON) perl(Mojo::Pg) 
perl(Mojo::URL) perl(Mojo::Util) perl(Mojolicious::Commands) 
perl(Mojolicious::Plugin) perl(Mojolicious::Plugin::RenderFile) 
perl(Mojolicious::Static) perl(Net::OpenID::Consumer) perl(POSIX) 
perl(Sort::Versions) perl(URI::Escape) perl(XML::Writer) perl(base) 
perl(constant) perl(diagnostics) perl(strict) perl(warnings) shadow 
rubygem(sass) perl(Net::DNS) perl(LWP::Protocol::https) perl(Digest::SHA)
 %define build_requires %{assetpack_requires} rubygem(sass) tidy sysuser-shadow 
sysuser-tools
 Name:           MirrorCache
-Version:        1.037
+Version:        1.039
 Release:        0
 Summary:        WebApp to redirect and manage mirrors
 License:        GPL-2.0-or-later
@@ -34,6 +34,7 @@
 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
@@ -45,6 +46,7 @@
 
 %prep
 %setup -q -a1
+%patch0 -p1
 
 %build
 # make {?_smp_mflags}

++++++ 0001-Avoid-by-and-ru-mrrors-for-ua-requests.patch ++++++
>From 7d9346897af13e5e5ca1752b7a9cfb5718305228 Mon Sep 17 00:00:00 2001
From: Andrii Nikitin <[email protected]>
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


++++++ MirrorCache-1.037.obscpio -> MirrorCache-1.039.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.037/assets/javascripts/admintable.js 
new/MirrorCache-1.039/assets/javascripts/admintable.js
--- old/MirrorCache-1.037/assets/javascripts/admintable.js      2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/assets/javascripts/admintable.js      2022-08-26 
15:13:31.000000000 +0200
@@ -130,6 +130,7 @@
     var tableHeadings = trElement.closest('table').find('th');
     trElement.find('td').each(function() {
         var th = tableHeadings.eq(this.cellIndex);
+        // var name = th.text().trim().toLowerCase().replace(/ /g, '_');
         var name = th.text().trim().toLowerCase();
         var value;
         if (th.hasClass("col_value")) {
@@ -362,6 +363,7 @@
         if (th.hasClass('col_action')) {
             columnName = 'id';
         } else {
+            // columnName = th.text().trim().toLowerCase().replace(/ /g, '_');
             columnName = th.text().trim().toLowerCase();
         }
         columns.push({ data: columnName });
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/Schema/Result/MyServer.pm 
new/MirrorCache-1.039/lib/MirrorCache/Schema/Result/MyServer.pm
--- old/MirrorCache-1.037/lib/MirrorCache/Schema/Result/MyServer.pm     
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/Schema/Result/MyServer.pm     
2022-08-26 15:13:31.000000000 +0200
@@ -16,6 +16,10 @@
     is_nullable       => 0,
     sequence          => "server_id_seq",
   },
+  "sponsor",
+  { data_type => "varchar", is_nullable => 1, size => 64 },
+  "sponsor_url",
+  { data_type => "varchar", is_nullable => 1, size => 64 },
   "hostname",
   { data_type => "varchar", is_nullable => 0, size => 128 },
   "urldir",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/Schema/Result/Server.pm 
new/MirrorCache-1.039/lib/MirrorCache/Schema/Result/Server.pm
--- old/MirrorCache-1.037/lib/MirrorCache/Schema/Result/Server.pm       
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/Schema/Result/Server.pm       
2022-08-26 15:13:31.000000000 +0200
@@ -1,94 +1,13 @@
 use utf8;
 package MirrorCache::Schema::Result::Server;
 
-# Created by DBIx::Class::Schema::Loader
-# DO NOT MODIFY THE FIRST PART OF THIS FILE
-
-=head1 NAME
-
-MirrorCache::Schema::Result::Server
-
-=cut
-
 use strict;
 use warnings;
 
 use base 'DBIx::Class::Core';
 
-=head1 TABLE: C<server>
-
-=cut
-
 __PACKAGE__->table("server");
 
-=head1 ACCESSORS
-
-=head2 id
-
-  data_type: 'integer'
-  is_auto_increment: 1
-  is_nullable: 0
-  sequence: 'server_id_seq'
-
-=head2 hostname
-
-  data_type: 'varchar'
-  is_nullable: 0
-  size: 128
-
-=head2 urldir
-
-  data_type: 'varchar'
-  is_nullable: 0
-  size: 128
-
-=head2 enabled
-
-  data_type: 'boolean'
-  is_nullable: 0
-
-=head2 region
-
-  data_type: 'varchar'
-  is_nullable: 0
-  size: 2
-
-=head2 country
-
-  data_type: 'varchar'
-  is_nullable: 0
-  size: 2
-
-=head2 score
-
-  data_type: 'smallint'
-  is_nullable: 0
-
-=head2 comment
-
-  data_type: 'text'
-  is_nullable: 0
-
-=head2 public_notes
-
-  data_type: 'varchar'
-  is_nullable: 0
-  size: 512
-
-=head2 lat
-
-  data_type: 'numeric'
-  is_nullable: 1
-  size: [6,3]
-
-=head2 lng
-
-  data_type: 'numeric'
-  is_nullable: 1
-  size: [6,3]
-
-=cut
-
 __PACKAGE__->add_columns(
   "id",
   {
@@ -97,6 +16,10 @@
     is_nullable       => 0,
     sequence          => "server_id_seq",
   },
+  "sponsor",
+  { data_type => "varchar", is_nullable => 1, size => 64 },
+  "sponsor_url",
+  { data_type => "varchar", is_nullable => 1, size => 64 },
   "hostname",
   { data_type => "varchar", is_nullable => 0, size => 128 },
   "urldir",
@@ -119,28 +42,8 @@
   { data_type => "numeric", is_nullable => 1, size => [6, 3] },
 );
 
-=head1 PRIMARY KEY
-
-=over 4
-
-=item * L</id>
-
-=back
-
-=cut
-
 __PACKAGE__->set_primary_key("id");
 
-=head1 RELATIONS
-
-=head2 folder_diff_file_servers
-
-Type: has_many
-
-Related object: L<MirrorCache::Schema::Result::FolderDiffFileServer>
-
-=cut
-
 __PACKAGE__->has_many(
   "folder_diff_file_servers",
   "MirrorCache::Schema::Result::FolderDiffFileServer",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/Schema/ResultSet/Server.pm 
new/MirrorCache-1.039/lib/MirrorCache/Schema/ResultSet/Server.pm
--- old/MirrorCache-1.037/lib/MirrorCache/Schema/ResultSet/Server.pm    
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/Schema/ResultSet/Server.pm    
2022-08-26 15:13:31.000000000 +0200
@@ -273,6 +273,7 @@
     group by project_id
 )
 select s.id, s.region, s.country,
+    s.sponsor, s.sponsor_url,
     concat(s.hostname, s.urldir) as url,
     project,
     round(case when project_folder_count.cnt > 3 then s_eq * 100 / 
project_folder_count.cnt when s_eq =  project_folder_count.cnt then 100 else 50 
end, 0) score,
@@ -299,7 +300,7 @@
 group by server_id, project_id, name
 ) smry
 join project_folder_count on project_folder_count.project_id = smry.project_id
-join server s on smry.server_id = s.id
+join server s on smry.server_id = s.id and s.enabled
 order by region, country, score, url, project;
 END_SQL
     my $prep = $dbh->prepare($sql);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.037/lib/MirrorCache/Task/Report.pm 
new/MirrorCache-1.039/lib/MirrorCache/Task/Report.pm
--- old/MirrorCache-1.037/lib/MirrorCache/Task/Report.pm        2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/Task/Report.pm        2022-08-26 
15:13:31.000000000 +0200
@@ -36,8 +36,10 @@
     my $mirrors = $schema->resultset('Server')->report_mirrors;
     # this is just tmp structure we use for aggregation
     my %report;
+    my %sponsor;
     for my $m (@$mirrors) {
         $report{$m->{region}}{$m->{country}}{$m->{url}}{$m->{project}} = 
[$m->{score},$m->{victim}];
+        $sponsor{$m->{url}} = [$m->{sponsor},$m->{sponsor_url}];
     }
     # json expects array, so we collect array here
     my @report;
@@ -51,6 +53,11 @@
                     country => $country,
                     url     => $url,
                 );
+                if (my $sponsor = $sponsor{$url}) {
+                    $row{'sponsor'} = $sponsor->[0] if $sponsor->[0];
+                    $row{'sponsor_url'} = $sponsor->[1] if $sponsor->[1];
+                }
+                
                 my $by_project = $by_country->{$url};
                 for my $project (sort keys %$by_project) {
                     my $p = $by_project->{$project};
@@ -75,10 +82,13 @@
         my $url = $app->subsidiary->url($region);
         eval {
             my $res = Mojo::UserAgent->new->get($url . "/rest/repmirror")->res;
-            if ($res->code < 500 && $res->code > 199) {
+            if ($res->code < 300 && $res->code > 199) {
                 my $json = $res->json('/report');
                 my @elements = $json->@*;
-                push @report, @elements;
+                for my $item (@elements) {
+                    $item->{region} = $item->{region} . " ($url)";
+                }
+                push @report, @elements if @elements;
             } else {
                 print STDERR "Error code accessing {$url}:" . $res->code . 
"\n";
             }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Controller/App/Server.pm 
new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Controller/App/Server.pm
--- old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Controller/App/Server.pm       
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Controller/App/Server.pm       
2022-08-26 15:13:31.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright (C) 2014 SUSE LLC
+# Copyright (C) 2021 SUSE LLC
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Controller/Report/Mirrors.pm 
new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Controller/Report/Mirrors.pm
--- old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Controller/Report/Mirrors.pm   
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Controller/Report/Mirrors.pm   
2022-08-26 15:13:31.000000000 +0200
@@ -20,7 +20,8 @@
 sub index {
     my ($self) = @_;
     my $project  = $self->param('project');
-    my $projects = $self->mcproject->list_full;
+    my $allprojects = $self->mcproject->list_full;
+    my $projects    = $self->mcproject->list_full;
 
     if ($project && $project ne "all") {
         my @projects_new;
@@ -43,8 +44,9 @@
         $self->stash;
         $self->render(
             "report/mirrors/index",
-            mirrors  => $hash,
-            projects => $projects
+            mirrors     => $hash,
+            projects    => $projects,
+            allprojects => $allprojects
         );
     };
     my $error = $@;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Controller/Rest/Table.pm 
new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Controller/Rest/Table.pm
--- old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Controller/Rest/Table.pm       
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Controller/Rest/Table.pm       
2022-08-26 15:13:31.000000000 +0200
@@ -24,15 +24,15 @@
 my %tables = (
     Server => {
         keys     => [['id'], ['hostname'],],
-        cols     => ['id', 'hostname', 'urldir', 'enabled', 'region', 
'country', 'comment', 'public notes'],
+        cols     => ['id', 'sponsor', 'sponsor url', 'hostname', 'urldir', 
'enabled', 'region', 'country', 'comment', 'public notes'],
         required => ['id', 'hostname', 'urldir'],
-        defaults => {urldir => ''},
+        defaults => {urldir => '', sponsor => '', 'sponsor_url' => ''},
     },
     MyServer => {
         keys     => [['id'], ['hostname'],],
-        cols     => ['id', 'hostname', 'urldir', 'enabled', 'region', 
'country', 'comment', 'public notes'],
+        cols     => ['id', 'sponsor', 'sponsor url', 'hostname', 'urldir', 
'enabled', 'region', 'country', 'comment', 'public notes'],
         required => ['id', 'hostname', 'urldir'],
-        defaults => {urldir => ''},
+        defaults => {urldir => '', sponsor => '', 'sponsor_url' => ''},
     },
     Folder => {
         keys     => [['id'], ['path'],],
@@ -167,7 +167,7 @@
         if ($rc) {
             my @event_data;
             for my $k (keys %{ $entry }) {
-                next if !$entry->{$k} || "$entry->{$k}" eq '' and !$rc->$k || 
$rc->$k . '' eq '';
+                next if !$entry->{$k} || ("$entry->{$k}" eq '' && (!$rc->$k || 
$rc->$k . '' eq ''));
                 if (!$rc->$k or $rc->$k . '' eq '') {
                     push @event_data, {"new $k" => $entry->{$k}};
                 } elsif ($entry->{$k} ne $rc->$k) {
@@ -282,12 +282,13 @@
         $validation->required($par);
     }
     for my $par (@{$tables{$table}->{cols}}) {
-        next if $par eq 'id' && !$self->param($par);
+        my $par1 = $par;
+        $par1 =~ tr/ /_/;
+        $par1 =~ tr/+/_/;
+        next if $par eq 'id' && !$self->param($par) && !$self->param($par1);
         if (defined $validation->param($par)) {
-            $entry->{$par} = trim $validation->param($par);
+            $entry->{$par1} = trim $validation->param($par);
         } else {
-            my $par1 = $par;
-            $par1 =~ tr/ /_/;
             $entry->{$par1} = $self->param($par);
         }
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Plugin/Helpers.pm 
new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Plugin/Helpers.pm
--- old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Plugin/Helpers.pm      
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Plugin/Helpers.pm      
2022-08-26 15:13:31.000000000 +0200
@@ -147,15 +147,19 @@
     $app->helper(
         'region_name' => sub {
             shift;
-            my $reg = shift;
-            return 'Unknown'       unless $reg;
-            return 'Oceania'       if $reg eq 'oc';
-            return 'North America' if $reg eq 'na';
-            return 'South America' if $reg eq 'sa';
-            return 'Africa'        if $reg eq 'af';
-            return 'Europe'        if $reg eq 'eu';
-            return 'Asia'          if $reg eq 'as';
-            return 'Unknown';
+            my $input = shift;
+            return 'Unknown'       unless $input;
+            my $reg = substr($input, 0, 2);
+            my $res = 'Unknown';
+            $res = 'Oceania'       if $reg eq 'oc';
+            $res = 'North America' if $reg eq 'na';
+            $res = 'South America' if $reg eq 'sa';
+            $res = 'Africa'        if $reg eq 'af';
+            $res = 'Europe'        if $reg eq 'eu';
+            $res = 'Asia'          if $reg eq 'as';
+
+            return $res . substr($input, 2);
+
         });
 
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Plugin/Project.pm 
new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Plugin/Project.pm
--- old/MirrorCache-1.037/lib/MirrorCache/WebAPI/Plugin/Project.pm      
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/WebAPI/Plugin/Project.pm      
2022-08-26 15:13:31.000000000 +0200
@@ -39,9 +39,9 @@
     my ($c) = @_;
     $initialized = 1;
     eval { #the table may be missing - no big deal (only reports might be 
inaccurate if some other error occurred).
-        @projects = $c->schema->resultset('Project')->all;
+        @projects = $c->schema->resultset('Project')->search(undef, { order_by 
=> { -desc => [qw/prio name/] } });
         1;
-    } or $c->log->error(Dumper("Cannot load projects", @_));
+    } or $c->log->error(Dumper("Cannot load projects", $@));
 
     for my $p (@projects) {
         my $name = $p->name;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/resources/migrations/Pg.sql 
new/MirrorCache-1.039/lib/MirrorCache/resources/migrations/Pg.sql
--- old/MirrorCache-1.037/lib/MirrorCache/resources/migrations/Pg.sql   
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/resources/migrations/Pg.sql   
2022-08-26 15:13:31.000000000 +0200
@@ -296,4 +296,7 @@
 create index if not exists report_content_dt_inx on report_body(report_id, dt);
 -- 25 up
 alter table project add column if not exists redirect varchar(512);
+-- 26 up
+alter table project add column if not exists prio int;
+alter table server add column if not exists sponsor varchar(64), add column if 
not exists sponsor_url varchar(64);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/lib/MirrorCache/resources/migrations/mysql.sql 
new/MirrorCache-1.039/lib/MirrorCache/resources/migrations/mysql.sql
--- old/MirrorCache-1.037/lib/MirrorCache/resources/migrations/mysql.sql        
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/lib/MirrorCache/resources/migrations/mysql.sql        
2022-08-26 15:13:31.000000000 +0200
@@ -293,4 +293,7 @@
 create index if not exists report_content_dt_inx on report_body(report_id, dt);
 -- 25 up
 alter table project add column if not exists redirect varchar(512);
+-- 26 up
+alter table project add column if not exists prio int;
+alter table server add column if not exists sponsor varchar(64), add column if 
not exists sponsor_url varchar(64);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.037/t/environ/13-mirror-management.sh 
new/MirrorCache-1.039/t/environ/13-mirror-management.sh
--- old/MirrorCache-1.037/t/environ/13-mirror-management.sh     2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/t/environ/13-mirror-management.sh     2022-08-26 
15:13:31.000000000 +0200
@@ -10,7 +10,7 @@
 
 $mc/curl /app/server -I | grep '200'
 
-$mc/sql "insert into server(hostname,urldir,enabled,country,region) select 
'127.0.0.1:1304','','t','us','na'"
+$mc/sql "insert into 
server(hostname,sponsor,sponsor_url,urldir,enabled,country,region) select 
'127.0.0.1:1304','openSUSE','opensuse.org','','t','us','na'"
 
 # Add new mirror
 # TODO: check why empty id needs to be given here
@@ -18,10 +18,12 @@
     -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
     --data-raw 'id=&urldir=&hostname=127.0.0.1:1314&country=eu&enabled=0'
 
-# Update mirror urldir
+# Update mirror urldir and sponsor
 $mc/curl '/rest/server/2' \
     -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-    --data-raw 
'id=2&urldir=/somedir&hostname=127.0.0.1:1314&country=eu&enabled=0'
+    --data-raw 
'id=2&urldir=/somedir&sponsor=SUSE&hostname=127.0.0.1:1314&country=eu&enabled=0'
+
+$mc/sql_test SUSE == 'select sponsor from server where id = 2'
 
 # Look for server_update event with both ids: who executed action and what was 
affected
 $mc/curl '/admin/auditlog/ajax?search\[value\]=event:server_update' | grep 
'server_update' | grep '"user_id":-2' | grep '\\\"id\\\":\\\"2\\\"'
@@ -40,3 +42,5 @@
     -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
     --data-raw 
'id=2&urldir=/somedir&hostname=127.0.0.1:1314&country=eu&enabled=0' | grep 
'error'
 $mc/curl '/rest/server/2' -X DELETE | grep 'error'
+
+echo success 13-mirror-management.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.037/t/environ/14-project-hq.sh 
new/MirrorCache-1.039/t/environ/14-project-hq.sh
--- old/MirrorCache-1.037/t/environ/14-project-hq.sh    2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/t/environ/14-project-hq.sh    2022-08-26 
15:13:31.000000000 +0200
@@ -109,6 +109,7 @@
           | grep '"country":"dk"' \
           | grep '"country":"ca"' \
           | grep '"country":"us"' \
-          | grep '"country":"jp"'
+          | grep '"country":"jp"' \
+          | grep -F '"region":"na (http:\/\/127.0.0.1:3160)"'
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.037/t/environ/14-project-report.sh 
new/MirrorCache-1.039/t/environ/14-project-report.sh
--- old/MirrorCache-1.037/t/environ/14-project-report.sh        2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/t/environ/14-project-report.sh        2022-08-26 
15:13:31.000000000 +0200
@@ -3,6 +3,8 @@
 
 mc=$(environ mc $(pwd))
 
+# $mc/gen_env MIRRORCACHE_BRANDING=openSUSE
+
 $mc/start
 
 ap8=$(environ ap8)
@@ -10,8 +12,9 @@
 ap6=$(environ ap6)
 ap5=$(environ ap5)
 ap4=$(environ ap4)
+ap3=$(environ ap3)
 
-for x in $mc $ap7 $ap8 $ap6 $ap5 $ap4; do
+for x in $mc $ap7 $ap8 $ap6 $ap5 $ap4 $ap3; do
     mkdir -p $x/dt/{folder1,folder2,folder3}
     mkdir -p $x/dt/project1/{folder1,folder2,folder3}
     mkdir -p $x/dt/project2/{folder1,folder2,folder3}
@@ -20,6 +23,7 @@
     echo $x/dt/project2/{folder1,folder2,folder3}/{file1.1,file2.1}.dat | 
xargs -n 1 touch
 done
 
+$ap3/start
 $ap4/start
 $ap5/start
 $ap6/start
@@ -33,14 +37,15 @@
 rm -r $ap5/dt/project1/
 rm -r $ap4/dt/project2/
 
-$mc/sql "insert into server(hostname,urldir,enabled,country,region) select 
'$($ap6/print_address)','','t','us','na'"
+$mc/sql "insert into 
server(hostname,sponsor,sponsor_url,urldir,enabled,country,region) select 
'$($ap6/print_address)','sponsor1','www.sponsor.org','','t','us','na'"
 $mc/sql "insert into server(hostname,urldir,enabled,country,region) select 
'$($ap7/print_address)','','t','us','na'"
 $mc/sql "insert into server(hostname,urldir,enabled,country,region) select 
'$($ap8/print_address)','','t','de','eu'"
 $mc/sql "insert into server(hostname,urldir,enabled,country,region) select 
'$($ap5/print_address)','','t','cn','as'"
 $mc/sql "insert into server(hostname,urldir,enabled,country,region) select 
'$($ap4/print_address)','','t','jp','as'"
+$mc/sql "insert into server(hostname,urldir,enabled,country,region) select 
'$($ap3/print_address)','','f','jp','as'"
 
-$mc/sql "insert into project(name,path,etalon) select 'proj1','/project1', 3"
 $mc/sql "insert into project(name,path,etalon) select '2.0 
1','/project2/folder1', 3"
+$mc/sql "insert into project(name,path,etalon) select 'proj1','/project1', 3"
 $mc/sql "insert into project(name,path,etalon) select '2.0 
2','/project2/folder2', 3"
 
 $mc/backstage/job -e folder_sync -a '["/project1/folder1"]'
@@ -64,3 +69,10 @@
    grep -C3 '\b2\b' | \
    grep -C3 -F '</a>'
 
+
+rc=0
+# no disabled mirror in the report
+$mc/curl /report/mirrors | grep $($ap3/print_address) || rc=$?
+test $rc -gt 0
+
+echo success
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.037/t/lib/environ/mc/source/sql.sh.m4 
new/MirrorCache-1.039/t/lib/environ/mc/source/sql.sh.m4
--- old/MirrorCache-1.037/t/lib/environ/mc/source/sql.sh.m4     2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/t/lib/environ/mc/source/sql.sh.m4     2022-08-26 
15:13:31.000000000 +0200
@@ -2,6 +2,7 @@
 test "$MIRRORCACHE_DB_PROVIDER" != mariadb || {
 
 sql=${1/"'t'"/"1"}
+sql=${sql/"'f'"/"0"}
 sql=${sql/"extract(epoch from now())"/"unix_timestamp()"}
 
 re="(update|insert|select)(.*)\s([a-z_A-Z]*)((\([a-z_0-9]*\))?) - interval 
'([0-9]+) (month|day|hour|minute|second)'(.*)$"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/templates/app/myserver/index.html.ep 
new/MirrorCache-1.039/templates/app/myserver/index.html.ep
--- old/MirrorCache-1.037/templates/app/myserver/index.html.ep  2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/templates/app/myserver/index.html.ep  2022-08-26 
15:13:31.000000000 +0200
@@ -15,6 +15,8 @@
             <thead>
                 <tr>
                     <th class="col_value">Id</th>
+                    <th class="col_value">Sponsor</th>
+                    <th class="col_value">Sponsor Url</th>
                     <th class="col_value">Hostname</th>
                     <th class="col_value">Urldir</th>
                     <th class="col_value">Region</th>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.037/templates/app/server/index.html.ep 
new/MirrorCache-1.039/templates/app/server/index.html.ep
--- old/MirrorCache-1.037/templates/app/server/index.html.ep    2022-08-11 
15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/templates/app/server/index.html.ep    2022-08-26 
15:13:31.000000000 +0200
@@ -15,6 +15,8 @@
             <thead>
                 <tr>
                     <th class="col_value">Id</th>
+                    <th class="col_value">Sponsor</th>
+                    <th class="col_value">Sponsor Url</th>
                     <th class="col_value">Hostname</th>
                     <th class="col_value">Urldir</th>
                     <th class="col_value">Region</th>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/templates/branding/openSUSE/header.html.ep 
new/MirrorCache-1.039/templates/branding/openSUSE/header.html.ep
--- old/MirrorCache-1.037/templates/branding/openSUSE/header.html.ep    
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/templates/branding/openSUSE/header.html.ep    
2022-08-26 15:13:31.000000000 +0200
@@ -19,6 +19,15 @@
         </div>
       </li>
     </ul>
+    % if (my $extra = stash('extra_menu')) {
+    <div class="collapse navbar-collapse" id="navbar-collapse">
+      <ul class="nav navbar-nav mr-auto flex-md-shrink-0">
+    %   for my $e (@$extra) {
+          <li class="nav-item"><a class="nav-link" href="<%= $e->{href} 
%>"><%= $e->{title} %></a></li>
+    %   }
+      </ul>
+    </div>
+    % }
 
     <ul id="user-menu" class="navbar-nav">
       <li class="nav-item dropdown">
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.037/templates/report/mirrors/index.html.ep 
new/MirrorCache-1.039/templates/report/mirrors/index.html.ep
--- old/MirrorCache-1.037/templates/report/mirrors/index.html.ep        
2022-08-11 15:29:02.000000000 +0200
+++ new/MirrorCache-1.039/templates/report/mirrors/index.html.ep        
2022-08-26 15:13:31.000000000 +0200
@@ -1,5 +1,7 @@
 % layout 'bootstrap';
 
+% #######################################
+% # Build Title
 % my $first_old = '';
 % my $first;
 % for my $project (@$projects) {
@@ -17,6 +19,32 @@
 %     title 'Mirrors Report';
 % }
 
+% #######################################
+% # Stash extra menu links
+% my @extra_menu;
+% $first_old = '';
+% $first = '';
+% my %extra_menu_item_all = ( title => 'All Mirrors', href => 
"/report/mirrors" );
+% push @extra_menu, \%extra_menu_item_all;
+
+% for my $project (@$allprojects) {
+%     my $name   = $project->{name};
+%     ($first) = split ' ', $name, 2;
+%     my $extra_title = $first;
+%     $extra_title = "Leap $first"   if 0 == rindex $first, "15.", 0;
+%     $extra_title = "Build Service" if $first eq 'repositories';
+%     $extra_title = "Tumbleweed"    if $first eq 'TW';
+%     my %extra_menu_item = ( title => $extra_title, href => 
"/report/mirrors?project=$first" );
+%     push @extra_menu, \%extra_menu_item unless $first_old;
+
+%     if ($first_old && $first_old ne $first) {
+%         push @extra_menu, \%extra_menu_item;
+%     }
+%     $first_old = $first;
+% }
+% stash('extra_menu' => \@extra_menu);
+
+
 % content_for 'head' => begin
 
 <style type='text/css'>
@@ -76,6 +104,8 @@
 % end
 
 %= include_branding 'report_mirrors_banner'
+% my $mc_branding = eval '$branding' // 'MirrorCache';
+% my $is_opensuse = $mc_branding eq 'openSUSE';
 
 <form>
 <div class="row">
@@ -86,11 +116,15 @@
             <thead>
                 <tr>
                     <th class="col_value">Country</th>
+                    % if ($is_opensuse) {
+                    <th class="col_value">Operator</th>
+                    % }
                     <th class="col_value">Url</th>
-                    % my $first_old = '';
+                    % $first_old = '';
+                    % $first = '';
                     % for my $project (@$projects) {
                     %     my $name   = $project->{name};
-                    %     (my $first) = split ' ', $name, 2;
+                    %     ($first) = split ' ', $name, 2;
                     %     $first = "Leap $first"   if 0 == rindex $first, 
"15.", 0;
                     %     $first = "Build Service" if $first eq 'repositories';
                     %     $first = "Tumbleweed"    if $first eq 'TW';
@@ -117,6 +151,13 @@
                 <tr>
                 %     my $url = $m->{url};
                     <td><%= $m->{country} %></td>
+                %     if ($is_opensuse) {
+                %         my $sponsor     = $m->{sponsor};
+                %         my $sponsor_url = $m->{sponsor_url};
+                %         $sponsor = $sponsor_url unless $sponsor;
+                %         $sponsor_url = $sponsor unless $sponsor_url;
+                    <td><a href="https://<%= $sponsor_url 
%>"><%=$sponsor%></a></td>
+                %     }
                     <td><a href="http://<%= $url %>"><%=$url%></a></td>
                 %     my $inner = '';
                 %     $first_old = '';

++++++ MirrorCache.obsinfo ++++++
--- /var/tmp/diff_new_pack.Alu1tH/_old  2022-09-09 18:29:14.769223523 +0200
+++ /var/tmp/diff_new_pack.Alu1tH/_new  2022-09-09 18:29:14.773223533 +0200
@@ -1,5 +1,5 @@
 name: MirrorCache
-version: 1.037
-mtime: 1660224542
-commit: 5281a9c79509f79aec972de25f37d12b0e099b85
+version: 1.039
+mtime: 1661519611
+commit: 056db65ee5963af81f5b04c526dcc3f8df31e682
 

++++++ cache.tar.xz ++++++

Reply via email to