Skip to content

Commit f334579

Browse files
jermypkratoch
authored andcommitted
Add '--noplugins' tsflag config value
This flag allows the user to disable running of rpm plugins (separately from libdnf5 plugins), and could help with testing and work around some troubles installing packages in more complicated build environments. This is to match adding this option in dnf#2299. I've also removed documentation that was copied from dnf which didn't seem to be relevant since this seems to be always compiled against newer librpm which will have these symbols present. Parsing of options has had to move because this option affects the behaviour of rpmtsSetupTransactionPlugins which is called by rpmtsAdd* functions via rpm_transaction.fill.
1 parent c3c2b64 commit f334579

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

doc/dnf5.conf.5.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ repository configuration file should aside from repo ID consists of baseurl, met
594594
``nocaps`` ``RPMTRANS_FLAG_NOCAPS``
595595
``nocrypto`` ``RPMTRANS_FLAG_NOFILEDIGEST``
596596
``deploops`` ``RPMTRANS_FLAG_DEPLOOPS``
597+
``noplugins`` ``RPMTRANS_FLAG_NOPLUGINS``
597598
================ ===============================
598599

599600
The ``nocrypto`` option will also set the ``_RPMVSF_NOSIGNATURES`` and
@@ -603,8 +604,7 @@ repository configuration file should aside from repo ID consists of baseurl, met
603604
It includes downloading of packages, OpenPGP keys check (including permanent import of
604605
additional keys if necessary), and rpm check to prevent file conflicts.
605606

606-
The ``nocaps`` is supported with rpm-4.14 or later. When ``nocaps`` is used but rpm
607-
doesn't support it, DNF5 only reports it as an invalid tsflag.
607+
The ``noplugins`` option disables use of rpm plugins.
608608

609609
Default: empty.
610610

libdnf5/base/transaction.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ constexpr std::pair<const char *, rpmtransFlags_e> string_tsflag_map[]{
7676
{"nocaps", RPMTRANS_FLAG_NOCAPS},
7777
{"nocrypto", RPMTRANS_FLAG_NOFILEDIGEST},
7878
{"deploops", RPMTRANS_FLAG_DEPLOOPS},
79+
{"noplugins", RPMTRANS_FLAG_NOPLUGINS},
7980
};
8081

8182
const std::map<base::Transaction::TransactionRunResult, BgettextMessage> TRANSACTION_RUN_RESULT_DICT = {
@@ -947,15 +948,7 @@ Transaction::TransactionRunResult Transaction::Impl::_run(
947948
return TransactionRunResult::ERROR_LOCK;
948949
}
949950

950-
// fill and check the rpm transaction
951951
libdnf5::rpm::Transaction rpm_transaction(base);
952-
rpm_transaction.fill(*transaction);
953-
if (!rpm_transaction.check()) {
954-
for (auto it : rpm_transaction.get_problems()) {
955-
transaction_problems.emplace_back(it.to_string());
956-
}
957-
return TransactionRunResult::ERROR_CHECK;
958-
}
959952

960953
rpmtransFlags rpm_transaction_flags{RPMTRANS_FLAG_NONE};
961954
for (const auto & tsflag : config.get_tsflags_option().get_value()) {
@@ -978,6 +971,18 @@ Transaction::TransactionRunResult Transaction::Impl::_run(
978971
}
979972
}
980973

974+
// Set flags to ensure "noplugins" option is set before transactions are started
975+
rpm_transaction.set_flags(rpm_transaction_flags);
976+
977+
// fill and check the rpm transaction
978+
rpm_transaction.fill(*transaction);
979+
if (!rpm_transaction.check()) {
980+
for (auto it : rpm_transaction.get_problems()) {
981+
transaction_problems.emplace_back(it.to_string());
982+
}
983+
return TransactionRunResult::ERROR_CHECK;
984+
}
985+
981986
// Run rpm transaction test
982987
rpm_transaction.set_flags(rpm_transaction_flags | RPMTRANS_FLAG_TEST);
983988
//TODO(jrohel): Do we want callbacks for transaction test?

0 commit comments

Comments
 (0)