Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement system-upgrade and arbitrary offline transactions #1280

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ option(WITH_PYTHON_PLUGINS_LOADER "Build a special dnf5 plugin that loads Python
option(WITH_COMPS "Build with comps groups and environments support" ON)
option(WITH_MODULEMD "Build with modulemd modules support" ON)
option(WITH_ZCHUNK "Build with zchunk delta compression support" ON)
option(WITH_SYSTEMD "Build with systemd and D-Bus features" ON)
option(ENABLE_SOLV_URPMREORDER "Build with support for URPM-like solution reordering?" OFF)

# build options - documentation
Expand Down
2 changes: 1 addition & 1 deletion dnf5-plugins/needs_restarting_plugin/needs_restarting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ class NeedsRestartingCommand : public Command {

} // namespace dnf5

#endif // DNF5_COMMANDS_CHANGELOG_HPP
#endif // DNF5_COMMANDS_NEEDS_RESTARTING_HPP
26 changes: 26 additions & 0 deletions dnf5.spec
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Provides: dnf5-command(advisory)
Provides: dnf5-command(clean)
Provides: dnf5-command(download)
Provides: dnf5-command(makecache)
Provides: dnf5-command(offline)
Provides: dnf5-command(system-upgrade)


# ========== build options ==========
Expand All @@ -82,6 +84,7 @@ Provides: dnf5-command(makecache)
%else
%bcond_without zchunk
%endif
%bcond_without systemd

%bcond_with html
%if 0%{?rhel} == 8
Expand Down Expand Up @@ -161,6 +164,15 @@ BuildRequires: pkgconfig(modulemd-2.0) >= %{libmodulemd_version}
BuildRequires: pkgconfig(zck) >= %{zchunk_version}
%endif

%if %{with systemd}
BuildRequires: pkgconfig(sdbus-c++) >= 0.8.1
BuildRequires: systemd-devel

# We need to get the SYSTEMD_SYSTEM_UNIT_DIR from
# /usr/share/pkgconfig/systemd.pc
BuildRequires: systemd
%endif

%if %{with html} || %{with man}
BuildRequires: python3dist(breathe)
BuildRequires: python3dist(sphinx) >= 4.1.2
Expand Down Expand Up @@ -307,6 +319,12 @@ It supports RPM packages, modulemd modules, and comps groups & environments.
%{_mandir}/man5/dnf5.conf-todo.5.*
%{_mandir}/man5/dnf5.conf-deprecated.5.*

%if %{with systemd}
%{_unitdir}/dnf5-offline-transaction.service
%{_unitdir}/dnf5-offline-transaction-cleanup.service
%{_unitdir}/system-update.target.wants/dnf5-offline-transaction.service
%endif

# ========== libdnf5 ==========
%package -n libdnf5
Summary: Package management library
Expand Down Expand Up @@ -744,6 +762,7 @@ automatically and regularly from systemd timers, cron jobs or similar.
-DWITH_COMPS=%{?with_comps:ON}%{!?with_comps:OFF} \
-DWITH_MODULEMD=%{?with_modulemd:ON}%{!?with_modulemd:OFF} \
-DWITH_ZCHUNK=%{?with_zchunk:ON}%{!?with_zchunk:OFF} \
-DWITH_SYSTEMD=%{?with_systemd:ON}%{!?with_systemd:OFF} \
\
-DWITH_HTML=%{?with_html:ON}%{!?with_html:OFF} \
-DWITH_MAN=%{?with_man:ON}%{!?with_man:OFF} \
Expand Down Expand Up @@ -797,6 +816,13 @@ done
ln -sr %{buildroot}%{_bindir}/dnf5 %{buildroot}%{_bindir}/microdnf
%endif

%if %{with systemd}
mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants/
pushd %{buildroot}%{_unitdir}/system-update.target.wants/
ln -sr ../dnf5-offline-transaction.service
popd
%endif

%find_lang dnf5
%find_lang dnf5-plugin-automatic
%find_lang dnf5-plugin-builddep
Expand Down
16 changes: 15 additions & 1 deletion dnf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ if(NOT WITH_DNF5)
return()
endif()


find_package(Threads)

# set gettext domain for translations
Expand Down Expand Up @@ -32,8 +33,15 @@ target_link_libraries(dnf5 PRIVATE common libdnf5 libdnf5-cli Threads::Threads)
install(TARGETS dnf5 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

pkg_check_modules(RPM REQUIRED rpm>=4.17.0)
target_link_libraries(dnf5 PRIVATE ${RPM_LIBRARIES})

if(WITH_SYSTEMD)
pkg_check_modules(SDBUS_CPP REQUIRED sdbus-c++)
pkg_check_modules(LIBSYSTEMD REQUIRED libsystemd)
add_definitions(-DWITH_SYSTEMD)
target_link_libraries(dnf5 PRIVATE ${RPM_LIBRARIES} ${SDBUS_CPP_LIBRARIES} ${LIBSYSTEMD_LIBRARIES})
else()
target_link_libraries(dnf5 PRIVATE ${RPM_LIBRARIES})
endif()

find_package(bash-completion)
if(BASH_COMPLETION_FOUND)
Expand All @@ -48,6 +56,12 @@ install(FILES "README.plugins" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/dnf5/pl
install(DIRECTORY "config/usr/" DESTINATION "${CMAKE_INSTALL_PREFIX}" PATTERN ".gitkeep" EXCLUDE)
install(DIRECTORY "config/etc/" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}" PATTERN ".gitkeep" EXCLUDE)

if(WITH_SYSTEMD)
pkg_check_modules(SYSTEMD REQUIRED systemd)
pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)
install(DIRECTORY "config/systemd/system/" DESTINATION "${SYSTEMD_SYSTEM_UNIT_DIR}" PATTERN ".gitkeep" EXCLUDE)
endif()

# Makes an empty directory for dnf5-plugins configuration files
install(DIRECTORY DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/dnf/dnf5-plugins")
# Makes an empty directory for distribution dnf5-plugins configuration files
Expand Down
2 changes: 2 additions & 0 deletions dnf5/commands/autoremove/autoremove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

#include "autoremove.hpp"

#include <dnf5/shared_options.hpp>
#include <libdnf5/rpm/package_query.hpp>

namespace dnf5 {
Expand All @@ -35,6 +36,7 @@ void AutoremoveCommand::set_parent_command() {
void AutoremoveCommand::set_argument_parser() {
get_argument_parser_command()->set_description(
"Remove all unneeded packages originally installed as dependencies.");
create_offline_option(*this);
}

void AutoremoveCommand::configure() {
Expand Down
1 change: 1 addition & 0 deletions dnf5/commands/distro-sync/distro-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void DistroSyncCommand::set_argument_parser() {
allow_erasing = std::make_unique<AllowErasingOption>(*this);
auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this);
auto skip_broken = std::make_unique<SkipBrokenOption>(*this);
create_offline_option(*this);
}

void DistroSyncCommand::configure() {
Expand Down
1 change: 1 addition & 0 deletions dnf5/commands/downgrade/downgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void DowngradeCommand::set_argument_parser() {
auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this);
auto skip_broken = std::make_unique<SkipBrokenOption>(*this);
create_allow_downgrade_options(*this);
create_offline_option(*this);
}

void DowngradeCommand::configure() {
Expand Down
1 change: 1 addition & 0 deletions dnf5/commands/group/group_install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void GroupInstallCommand::set_argument_parser() {
auto skip_broken = std::make_unique<SkipBrokenOption>(*this);
create_allow_downgrade_options(*this);
create_downloadonly_option(*this);
create_offline_option(*this);
}

void GroupInstallCommand::configure() {
Expand Down
2 changes: 2 additions & 0 deletions dnf5/commands/group/group_remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

#include "group_remove.hpp"

#include <dnf5/shared_options.hpp>
#include <libdnf5/comps/comps.hpp>
#include <libdnf5/comps/group/group.hpp>
#include <libdnf5/comps/group/query.hpp>
Expand All @@ -36,6 +37,7 @@ void GroupRemoveCommand::set_argument_parser() {

no_packages = std::make_unique<GroupNoPackagesOption>(*this);
group_specs = std::make_unique<GroupSpecArguments>(*this, ArgumentParser::PositionalArg::AT_LEAST_ONE);
create_offline_option(*this);
}

void GroupRemoveCommand::configure() {
Expand Down
1 change: 1 addition & 0 deletions dnf5/commands/group/group_upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void GroupUpgradeCommand::set_argument_parser() {
allow_erasing = std::make_unique<AllowErasingOption>(*this);
auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this);
create_allow_downgrade_options(*this);
create_offline_option(*this);
}

void GroupUpgradeCommand::configure() {
Expand Down
1 change: 1 addition & 0 deletions dnf5/commands/install/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void InstallCommand::set_argument_parser() {
auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this);
auto skip_broken = std::make_unique<SkipBrokenOption>(*this);
create_allow_downgrade_options(*this);
create_offline_option(*this);
}

void InstallCommand::configure() {
Expand Down
Loading
Loading