-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathDistributionProvider.pm
54 lines (42 loc) · 1.77 KB
/
DistributionProvider.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# SUSE's openQA tests
#
# Copyright 2019-2021 SUSE LLC
# SPDX-License-Identifier: FSFAP
# Summary: A library that provides the certain distribution depending on the
# version of the product that is specified for a Test Suite.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>
package DistributionProvider;
use strict;
use warnings FATAL => 'all';
use version_utils;
use Distribution::Sle::AgamaDevel;
use Distribution::Sle::16Latest;
use Distribution::Sle::15sp0;
use Distribution::Sle::15sp2;
use Distribution::Sle::15_current;
use Distribution::Sle::12;
use Distribution::Opensuse::Leap::42;
use Distribution::Opensuse::Leap::15;
use Distribution::Opensuse::Leap::16Latest;
use Distribution::Opensuse::Tumbleweed;
use Distribution::Opensuse::AgamaDevel;
use testapi;
=head2 provide
provide();
Returns the certain distribution depending on the version of the product.
If there is no matched version, then returns Tumbleweed as the default one.
=cut
sub provide {
return Distribution::Sle::16Latest->new() if is_sle('16+');
return Distribution::Sle::AgamaDevel->new() if is_sle() && get_var('VERSION', '') =~ /agama/;
return Distribution::Sle::15_current->new() if (is_sle('>=15-sp3') || is_sle_micro);
return Distribution::Sle::15sp2->new() if is_sle('>15');
return Distribution::Sle::15sp0->new() if is_sle('=15');
return Distribution::Sle::12->new() if is_sle('12+');
return Distribution::Opensuse::Leap::16Latest->new() if is_leap('16.0+');
return Distribution::Opensuse::Leap::15->new() if is_leap('15.0+');
return Distribution::Opensuse::Leap::42->new() if is_leap('42.0+');
return Distribution::Opensuse::AgamaDevel->new() if is_opensuse() && get_var('VERSION', '') =~ /agama/;
return Distribution::Opensuse::Tumbleweed->new();
}
1;