Skip to content

Commit

Permalink
Merge pull request #101 from SUSE/smt11_staging_repoid
Browse files Browse the repository at this point in the history
Use repo CATALOGID instead of ID in smt-staging (bsc#1058992)
  • Loading branch information
ikapelyukhin authored Oct 4, 2017
2 parents b244a31 + 4c57cf8 commit ef02bf7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = smt
VERSION = 2.0.30
VERSION = 2.0.31
DESTDIR = /
PERL ?= perl
PERLMODDIR = $(shell $(PERL) -MConfig -e 'print $$Config{installvendorlib};')
Expand Down
7 changes: 7 additions & 0 deletions package/smt.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Oct 4 07:43:16 UTC 2017 - ikapelyukhin@suse.com

- version 2.0.31
- Specify TLSv1 explicitly for older wget versions (bsc#1059943)
- Use repo CATALOGID instead of ID in smt-staging (bsc#1058992)

-------------------------------------------------------------------
Thu May 4 10:38:53 CEST 2017 - ikapelyukhin@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/smt.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Name: smt
BuildRequires: apache2
BuildRequires: apache2-mod_perl
BuildRequires: swig
Version: 2.0.30
Version: 2.0.31
Release: 0
Requires: createrepo
Requires: gpg2
Expand Down
4 changes: 2 additions & 2 deletions script/smt-staging
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ if(! $testingdir)
# get the repository from DB (all commands need it)

my $rh = SMT::Repositories::new($dbh, $log);
my $repo = $rh->getRepository($reponameid) if (not defined $target);
my $repo = $rh->getRepository($reponameid, 'CATALOGID') if (not defined $target);
my $repoid = undef;
$rh->getAndClearErrorMessage();

Expand Down Expand Up @@ -347,7 +347,7 @@ else
{
SMT::Utils::printLog($log, $vblevel, LOG_DEBUG,
sprintf "Found repository by CATALOGID '%s'.", $reponameid);
$repoid = $reponameid;
$repoid = $repo->{ID};
}

# $repo and $repoid should always be defined at this point
Expand Down
11 changes: 7 additions & 4 deletions www/perl-lib/SMT/Repositories.pm
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ Examples:
=cut

sub getAllRepositories ($$) {
sub getAllRepositories ($$;$) {
my $self = shift;
my $filter = shift || {};
my $key_name = shift || 'ID';

$self->{REPOS} = undef;
$self->{GOTALLREPOS} = 0;
Expand Down Expand Up @@ -250,7 +251,7 @@ sub getAllRepositories ($$) {
$row->{'TARGET'} = '' if (not defined $row->{'TARGET'});
$row->{'LAST_MIRROR'} = '' if (not defined $row->{'LAST_MIRROR'});
$row->{rownr} = $rownr;
$ret->{$row->{'ID'}} = $row;
$ret->{$row->{$key_name}} = $row;
$rownr++;
}

Expand All @@ -266,7 +267,7 @@ Returns a hash of repository data for given repository ID. The hash keys
correspond to Catalogs database table.
=cut
sub getRepository($$)
sub getRepository($$;$)
{
my $self = shift;

Expand All @@ -275,6 +276,8 @@ sub getRepository($$)
return undef;
};

my $key_name = shift || SMT::Repositories::REPOSITORYID; # ID or CATALOGID

my $repo;
if ($self->{GOTALLREPOS})
{
Expand All @@ -283,7 +286,7 @@ sub getRepository($$)
else
{
# Matches just one repository
my $repos = $self->getAllRepositories({SMT::Repositories::REPOSITORYID => $repository});
my $repos = $self->getAllRepositories({ $key_name => $repository }, $key_name);
$repo = $repos->{$repository} || undef;
}

Expand Down

0 comments on commit ef02bf7

Please sign in to comment.