File: solver_problems.cpp

package info (click to toggle)
dnf5 5.4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,960 kB
  • sloc: cpp: 94,312; python: 3,370; xml: 1,073; ruby: 600; sql: 250; ansic: 232; sh: 104; perl: 62; makefile: 30
file content (435 lines) | stat: -rw-r--r-- 21,432 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
// Copyright Contributors to the DNF5 project.
// Copyright Contributors to the libdnf project.
// SPDX-License-Identifier: LGPL-2.1-or-later
//
// This file is part of libdnf: https://github.com/rpm-software-management/libdnf/
//
// Libdnf is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
//
// Libdnf is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with libdnf.  If not, see <https://www.gnu.org/licenses/>.


#include "solver_problems_internal.hpp"
#include "utils/string.hpp"

#include "libdnf5/utils/bgettext/bgettext-lib.h"
#include "libdnf5/utils/bgettext/bgettext-mark-domain.h"
#include "libdnf5/utils/format.hpp"

extern "C" {
#include <solv/pool.h>
#include <solv/solvable.h>
}

namespace libdnf5::base {


namespace {


// TODO(jmracek) Translation must be done later. After setting the locale.
static const std::map<ProblemRules, BgettextMessage> PKG_PROBLEMS_DICT = {
    {ProblemRules::RULE_DISTUPGRADE, M_("{} does not belong to a distupgrade repository")},
    {ProblemRules::RULE_INFARCH, M_("{0} from {1} has inferior architecture")},
    {ProblemRules::RULE_UPDATE, M_("problem with installed package")},
    {ProblemRules::RULE_JOB, M_("conflicting requests")},
    {ProblemRules::RULE_JOB_UNSUPPORTED, M_("unsupported request")},
    {ProblemRules::RULE_JOB_NOTHING_PROVIDES_DEP, M_("nothing provides requested {}")},
    {ProblemRules::RULE_JOB_UNKNOWN_PACKAGE, M_("package {} does not exist")},
    {ProblemRules::RULE_JOB_PROVIDED_BY_SYSTEM, M_("{} is provided by the system")},
    {ProblemRules::RULE_PKG, M_("some dependency problem")},
    {ProblemRules::RULE_BEST_1, M_("cannot install the best update candidate for package {}")},
    {ProblemRules::RULE_BEST_2, M_("cannot install the best candidate for the job")},
    {ProblemRules::RULE_PKG_NOT_INSTALLABLE_1, M_("package {0} from {1} is filtered out by modular filtering")},
    {ProblemRules::RULE_PKG_NOT_INSTALLABLE_2, M_("package {0} from {1} does not have a compatible architecture")},
    {ProblemRules::RULE_PKG_NOT_INSTALLABLE_3, M_("package {0} from {1} is not installable")},
    {ProblemRules::RULE_PKG_NOT_INSTALLABLE_4, M_("package {0} from {1} is filtered out by exclude filtering")},
    {ProblemRules::RULE_PKG_NOTHING_PROVIDES_DEP, M_("nothing provides {0} needed by {1} from {2}")},
    {ProblemRules::RULE_PKG_SAME_NAME, M_("cannot install both {0} from {1} and {2} from {3}")},
    {ProblemRules::RULE_PKG_CONFLICTS, M_("package {0} from {1} conflicts with {2} provided by {3} from {4}")},
    {ProblemRules::RULE_PKG_INSTALLED_CONFLICTS,
     M_("installed package {0} conflicts with {1} provided by {2} from {3}")},
    {ProblemRules::RULE_PKG_OBSOLETES, M_("package {0} from {1} obsoletes {2} provided by {3} from {4}")},
    {ProblemRules::RULE_PKG_INSTALLED_OBSOLETES, M_("installed package {0} obsoletes {1} provided by {2} from {3}")},
    {ProblemRules::RULE_PKG_IMPLICIT_OBSOLETES,
     M_("package {0} from {1} implicitly obsoletes {2} provided by {3} from {4}")},
    {ProblemRules::RULE_PKG_REQUIRES,
     M_("package {1} from {2} requires {0}, but none of the providers can be installed")},
    {ProblemRules::RULE_PKG_INSTALLED_REQUIRES,
     M_("installed package {1} requires {0}, but none of the providers can be installed")},
    {ProblemRules::RULE_PKG_SELF_CONFLICT, M_("package {0} from {1} conflicts with {2} provided by itself")},
    {ProblemRules::RULE_YUMOBS, M_("both package {0} from {1} and {3} from {4} obsolete {2}")},
    {ProblemRules::RULE_PKG_REMOVAL_OF_PROTECTED,
     M_("The operation would result in removing"
        " the following protected packages: {}")},
    {ProblemRules::RULE_PKG_REMOVAL_OF_RUNNING_KERNEL,
     M_("The operation would result in removing"
        " of running kernel: {}")},
    {ProblemRules::RULE_MODULE_DISTUPGRADE, M_("module {} does not belong to a distupgrade repository")},
    {ProblemRules::RULE_MODULE_INFARCH, M_("module {} has inferior architecture")},
    {ProblemRules::RULE_MODULE_UPDATE, M_("problem with installed module {}")},
    {ProblemRules::RULE_MODULE_JOB, M_("conflicting requests")},
    {ProblemRules::RULE_MODULE_JOB_UNSUPPORTED, M_("unsupported request")},
    {ProblemRules::RULE_MODULE_JOB_NOTHING_PROVIDES_DEP, M_("nothing provides requested {}")},
    {ProblemRules::RULE_MODULE_JOB_UNKNOWN_PACKAGE, M_("module {} does not exist")},
    {ProblemRules::RULE_MODULE_JOB_PROVIDED_BY_SYSTEM, M_("{} is provided by the system")},
    {ProblemRules::RULE_MODULE_PKG, M_("some dependency problem")},
    {ProblemRules::RULE_MODULE_BEST_1, M_("cannot install the best update candidate for module {}")},
    {ProblemRules::RULE_MODULE_BEST_2, M_("cannot install the best candidate for the job")},
    {ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_1, M_("module {} is disabled")},
    {ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_2, M_("module {} does not have a compatible architecture")},
    {ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_3, M_("module {} is not installable")},
    {ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_4, M_("module {} is disabled")},
    {ProblemRules::RULE_MODULE_PKG_NOTHING_PROVIDES_DEP, M_("nothing provides {0} needed by module {1}")},
    {ProblemRules::RULE_MODULE_PKG_SAME_NAME, M_("cannot install both modules {0} and {1}")},
    {ProblemRules::RULE_MODULE_PKG_CONFLICTS, M_("module {0} conflicts with {1} provided by {2}")},
    {ProblemRules::RULE_MODULE_PKG_OBSOLETES, M_("module {0} obsoletes {1} provided by {2}")},
    {ProblemRules::RULE_MODULE_PKG_INSTALLED_OBSOLETES, M_("installed module {0} obsoletes {1} provided by {2}")},
    {ProblemRules::RULE_MODULE_PKG_IMPLICIT_OBSOLETES, M_("module {0} implicitly obsoletes {1} provided by {2}")},
    {ProblemRules::RULE_MODULE_PKG_REQUIRES, M_("module {1} requires {0}, but none of the providers can be installed")},
    {ProblemRules::RULE_MODULE_PKG_SELF_CONFLICT, M_("module {1} conflicts with {0} provided by itself")},
    {ProblemRules::RULE_MODULE_YUMOBS, M_("both module {0} and {2} obsolete {1}")}};


std::string string_join(
    const std::vector<std::pair<ProblemRules, std::vector<std::string>>> & src, const std::string & delim) {
    if (src.empty()) {
        return {};
    }
    std::string output(SolverProblems::problem_to_string(*src.begin()));
    for (auto iter = std::next(src.begin()); iter != src.end(); ++iter) {
        output.append(delim);
        output.append(SolverProblems::problem_to_string(*iter));
    }
    return output;
}


}  // namespace

bool is_unique(
    const std::vector<std::pair<ProblemRules, std::vector<std::string>>> & origin,
    ProblemRules rule,
    const std::vector<std::string> & elements) {
    for (auto const & element : origin) {
        if (element.first == rule && element.second == elements) {
            return false;
        }
    }
    return true;
}

bool is_unique(
    const std::vector<std::vector<std::pair<ProblemRules, std::vector<std::string>>>> & problems,
    const std::vector<std::pair<ProblemRules, std::vector<std::string>>> & new_element) {
    auto new_element_size = new_element.size();
    for (auto const & element : problems) {
        if (element.size() != new_element_size) {
            continue;
        }
        bool identical = true;
        for (auto & [rule, strings] : element) {
            if (is_unique(new_element, rule, strings)) {
                identical = false;
                break;
            }
        }
        if (identical) {
            return false;
        }
    }
    return true;
}

class SolverProblems::Impl {
public:
    Impl(const std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> & problems);

private:
    friend SolverProblems;
    std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> problems;
};

SolverProblems::Impl::Impl(
    const std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> & problems)
    : problems(problems) {}

SolverProblems::SolverProblems(
    const std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> & problems)
    : p_impl(std::make_unique<Impl>(problems)) {}

SolverProblems::SolverProblems(const SolverProblems & src) : p_impl(new Impl(*src.p_impl)) {}
SolverProblems::SolverProblems(SolverProblems && src) noexcept = default;
SolverProblems & SolverProblems::operator=(const SolverProblems & src) {
    if (this != &src) {
        if (p_impl) {
            *p_impl = *src.p_impl;
        } else {
            p_impl = std::make_unique<Impl>(*src.p_impl);
        }
    }

    return *this;
}
SolverProblems & SolverProblems::operator=(SolverProblems && src) noexcept = default;
SolverProblems::~SolverProblems() = default;

std::string SolverProblems::problem_to_string(const std::pair<ProblemRules, std::vector<std::string>> & raw) {
    switch (raw.first) {
        case ProblemRules::RULE_JOB:
        case ProblemRules::RULE_JOB_UNSUPPORTED:
        case ProblemRules::RULE_PKG:
        case ProblemRules::RULE_BEST_2:
        case ProblemRules::RULE_MODULE_JOB:
        case ProblemRules::RULE_MODULE_JOB_UNSUPPORTED:
        case ProblemRules::RULE_MODULE_PKG:
        case ProblemRules::RULE_MODULE_BEST_2:
            if (raw.second.size() != 0) {
                throw std::invalid_argument("Incorrect number of elements for a problem rule");
            }
            return TM_(PKG_PROBLEMS_DICT.at(raw.first), 1);
        case ProblemRules::RULE_DISTUPGRADE:
        case ProblemRules::RULE_UPDATE:
        case ProblemRules::RULE_JOB_NOTHING_PROVIDES_DEP:
        case ProblemRules::RULE_JOB_UNKNOWN_PACKAGE:
        case ProblemRules::RULE_JOB_PROVIDED_BY_SYSTEM:
        case ProblemRules::RULE_BEST_1:
        case ProblemRules::RULE_MODULE_DISTUPGRADE:
        case ProblemRules::RULE_MODULE_INFARCH:
        case ProblemRules::RULE_MODULE_UPDATE:
        case ProblemRules::RULE_MODULE_JOB_NOTHING_PROVIDES_DEP:
        case ProblemRules::RULE_MODULE_JOB_UNKNOWN_PACKAGE:
        case ProblemRules::RULE_MODULE_JOB_PROVIDED_BY_SYSTEM:
        case ProblemRules::RULE_MODULE_BEST_1:
        case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_1:
        case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_2:
        case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_3:
        case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_4:
            if (raw.second.size() != 1) {
                throw std::invalid_argument("Incorrect number of elements for a problem rule");
            }
            return utils::sformat(TM_(PKG_PROBLEMS_DICT.at(raw.first), 1), raw.second[0]);
        case ProblemRules::RULE_INFARCH:
        case ProblemRules::RULE_PKG_NOT_INSTALLABLE_1:
        case ProblemRules::RULE_PKG_NOT_INSTALLABLE_2:
        case ProblemRules::RULE_PKG_NOT_INSTALLABLE_3:
        case ProblemRules::RULE_PKG_NOT_INSTALLABLE_4:
        case ProblemRules::RULE_MODULE_PKG_NOTHING_PROVIDES_DEP:
        case ProblemRules::RULE_MODULE_PKG_REQUIRES:
        case ProblemRules::RULE_MODULE_PKG_SELF_CONFLICT:
        case ProblemRules::RULE_MODULE_PKG_SAME_NAME:
        case ProblemRules::RULE_PKG_INSTALLED_REQUIRES:
            if (raw.second.size() != 2) {
                throw std::invalid_argument("Incorrect number of elements for a problem rule");
            }
            return utils::sformat(TM_(PKG_PROBLEMS_DICT.at(raw.first), 1), raw.second[0], raw.second[1]);
        case ProblemRules::RULE_PKG_NOTHING_PROVIDES_DEP:
        case ProblemRules::RULE_PKG_REQUIRES:
        case ProblemRules::RULE_PKG_SELF_CONFLICT:
        case ProblemRules::RULE_MODULE_PKG_CONFLICTS:
        case ProblemRules::RULE_MODULE_PKG_OBSOLETES:
        case ProblemRules::RULE_MODULE_PKG_INSTALLED_OBSOLETES:
        case ProblemRules::RULE_MODULE_PKG_IMPLICIT_OBSOLETES:
        case ProblemRules::RULE_MODULE_YUMOBS:
            if (raw.second.size() != 3) {
                throw std::invalid_argument("Incorrect number of elements for a problem rule");
            }
            return utils::sformat(TM_(PKG_PROBLEMS_DICT.at(raw.first), 1), raw.second[0], raw.second[1], raw.second[2]);
        case ProblemRules::RULE_PKG_SAME_NAME:
        case ProblemRules::RULE_PKG_INSTALLED_CONFLICTS:
        case ProblemRules::RULE_PKG_INSTALLED_OBSOLETES:
            if (raw.second.size() != 4) {
                throw std::invalid_argument("Incorrect number of elements for a problem rule");
            }
            return utils::sformat(
                TM_(PKG_PROBLEMS_DICT.at(raw.first), 1), raw.second[0], raw.second[1], raw.second[2], raw.second[3]);
        case ProblemRules::RULE_PKG_CONFLICTS:
        case ProblemRules::RULE_PKG_OBSOLETES:
        case ProblemRules::RULE_PKG_IMPLICIT_OBSOLETES:
        case ProblemRules::RULE_YUMOBS:
            if (raw.second.size() != 5) {
                throw std::invalid_argument("Incorrect number of elements for a problem rule");
            }
            return utils::sformat(
                TM_(PKG_PROBLEMS_DICT.at(raw.first), 1),
                raw.second[0],
                raw.second[1],
                raw.second[2],
                raw.second[3],
                raw.second[4]);
        case ProblemRules::RULE_UNKNOWN:
        case ProblemRules::RULE_MODULE_UNKNOWN:
            if (raw.second.size() != 0) {
                throw std::invalid_argument("Incorrect number of elements for a problem rule");
            }
            return raw.second[0];
        case ProblemRules::RULE_PKG_REMOVAL_OF_PROTECTED:
        case ProblemRules::RULE_PKG_REMOVAL_OF_RUNNING_KERNEL:
            auto elements = utils::string::join(raw.second, ", ");
            return utils::sformat(TM_(PKG_PROBLEMS_DICT.at(raw.first), 1), elements);
    }
    return {};
}


std::string SolverProblems::to_string() const {
    if (p_impl->problems.empty()) {
        return {};
    }
    std::string output;
    if (p_impl->problems.size() == 1) {
        output.append(_("Problem: "));
        output.append(string_join(*p_impl->problems.begin(), "\n  - "));
        return output;
    }
    const char * problem_prefix = _("Problem {}: ");

    output.append(utils::sformat(problem_prefix, 1));
    output.append(string_join(*p_impl->problems.begin(), "\n  - "));

    int index = 2;
    for (auto iter = std::next(p_impl->problems.begin()); iter != p_impl->problems.end(); ++iter) {
        output.append("\n ");
        output.append(utils::sformat(problem_prefix, index));
        output.append(string_join(*iter, "\n  - "));
        ++index;
    }
    return output;
}


std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> SolverProblems::get_problems()
    const {
    return p_impl->problems;
};


static std::string module_solvid2str(Pool * pool, Id source) {
    auto * solvable = pool_id2solvable(pool, source);
    const char * summary = solvable_lookup_str(solvable, SOLVABLE_SUMMARY);
    return fmt::format(
        "{}:{}:{}.{}",
        solvable_lookup_str(solvable, SOLVABLE_DESCRIPTION),
        pool_id2str(pool, solvable->evr),
        summary ? summary : "",
        pool_id2str(pool, solvable->arch));
}


std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> process_module_solver_problems(
    Pool * pool, const std::vector<std::vector<std::tuple<ProblemRules, Id, Id, Id, std::string>>> & solver_problems) {
    std::vector<std::vector<std::pair<libdnf5::ProblemRules, std::vector<std::string>>>> problems;

    for (auto & problem : solver_problems) {
        std::vector<std::pair<ProblemRules, std::vector<std::string>>> problem_output;

        for (auto & [rule, source, dep, target, description] : problem) {
            std::vector<std::string> elements;
            ProblemRules tmp_rule = rule;
            switch (rule) {
                case ProblemRules::RULE_MODULE_DISTUPGRADE:
                case ProblemRules::RULE_MODULE_INFARCH:
                case ProblemRules::RULE_MODULE_UPDATE:
                case ProblemRules::RULE_MODULE_BEST_1:
                case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_2:
                case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_3:
                    elements.push_back(module_solvid2str(pool, source));
                    break;
                case ProblemRules::RULE_MODULE_JOB:
                case ProblemRules::RULE_MODULE_JOB_UNSUPPORTED:
                case ProblemRules::RULE_MODULE_PKG:
                case ProblemRules::RULE_MODULE_BEST_2:
                    break;
                case ProblemRules::RULE_MODULE_JOB_NOTHING_PROVIDES_DEP:
                case ProblemRules::RULE_MODULE_JOB_UNKNOWN_PACKAGE:
                case ProblemRules::RULE_MODULE_JOB_PROVIDED_BY_SYSTEM:
                    elements.push_back(pool_dep2str(pool, dep));
                    break;
                case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_1:
                case ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_4:
                    if (false) {
                        // TODO (jmracek) (modularExclude && modularExclude->has(source))
                    } else {
                        tmp_rule = ProblemRules::RULE_MODULE_PKG_NOT_INSTALLABLE_4;
                    }
                    elements.push_back(module_solvid2str(pool, source));
                    break;
                case ProblemRules::RULE_MODULE_PKG_SELF_CONFLICT:
                    elements.push_back(pool_dep2str(pool, dep));
                    elements.push_back(module_solvid2str(pool, source));
                    break;
                case ProblemRules::RULE_MODULE_PKG_NOTHING_PROVIDES_DEP:
                case ProblemRules::RULE_MODULE_PKG_REQUIRES:
                    elements.push_back(pool_dep2str(pool, dep));
                    elements.push_back(module_solvid2str(pool, source));
                    break;
                case ProblemRules::RULE_MODULE_PKG_SAME_NAME:
                    elements.push_back(module_solvid2str(pool, source));
                    elements.push_back(module_solvid2str(pool, target));
                    std::sort(elements.begin(), elements.end());
                    break;
                case ProblemRules::RULE_MODULE_PKG_CONFLICTS:
                case ProblemRules::RULE_MODULE_PKG_OBSOLETES:
                case ProblemRules::RULE_MODULE_PKG_INSTALLED_OBSOLETES:
                case ProblemRules::RULE_MODULE_PKG_IMPLICIT_OBSOLETES:
                case ProblemRules::RULE_MODULE_YUMOBS:
                    elements.push_back(module_solvid2str(pool, source));
                    elements.push_back(pool_dep2str(pool, dep));
                    elements.push_back(module_solvid2str(pool, target));
                    break;
                case ProblemRules::RULE_MODULE_UNKNOWN:
                    elements.push_back(description);
                    break;
                case ProblemRules::RULE_DISTUPGRADE:
                case ProblemRules::RULE_INFARCH:
                case ProblemRules::RULE_UPDATE:
                case ProblemRules::RULE_JOB:
                case ProblemRules::RULE_JOB_UNSUPPORTED:
                case ProblemRules::RULE_JOB_NOTHING_PROVIDES_DEP:
                case ProblemRules::RULE_JOB_UNKNOWN_PACKAGE:
                case ProblemRules::RULE_JOB_PROVIDED_BY_SYSTEM:
                case ProblemRules::RULE_PKG:
                case ProblemRules::RULE_BEST_1:
                case ProblemRules::RULE_BEST_2:
                case ProblemRules::RULE_PKG_NOT_INSTALLABLE_1:
                case ProblemRules::RULE_PKG_NOT_INSTALLABLE_2:
                case ProblemRules::RULE_PKG_NOT_INSTALLABLE_3:
                case ProblemRules::RULE_PKG_NOT_INSTALLABLE_4:
                case ProblemRules::RULE_PKG_NOTHING_PROVIDES_DEP:
                case ProblemRules::RULE_PKG_SAME_NAME:
                case ProblemRules::RULE_PKG_CONFLICTS:
                case ProblemRules::RULE_PKG_INSTALLED_CONFLICTS:
                case ProblemRules::RULE_PKG_OBSOLETES:
                case ProblemRules::RULE_PKG_INSTALLED_OBSOLETES:
                case ProblemRules::RULE_PKG_IMPLICIT_OBSOLETES:
                case ProblemRules::RULE_PKG_REQUIRES:
                case ProblemRules::RULE_PKG_INSTALLED_REQUIRES:
                case ProblemRules::RULE_PKG_SELF_CONFLICT:
                case ProblemRules::RULE_YUMOBS:
                case ProblemRules::RULE_UNKNOWN:
                case ProblemRules::RULE_PKG_REMOVAL_OF_PROTECTED:
                case ProblemRules::RULE_PKG_REMOVAL_OF_RUNNING_KERNEL:
                    libdnf_throw_assertion("Unexpected rpm problem rule in module solver problems");
            }
            if (is_unique(problem_output, tmp_rule, elements)) {
                problem_output.push_back(std::make_pair(tmp_rule, std::move(elements)));
            }
        }
        if (is_unique(problems, problem_output)) {
            problems.push_back(std::move(problem_output));
        }
    }
    return problems;
}


}  // namespace libdnf5::base