diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0637cc3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/microdnf-2.tar.gz diff --git a/.microdnf.metadata b/.microdnf.metadata new file mode 100644 index 0000000..b66d4de --- /dev/null +++ b/.microdnf.metadata @@ -0,0 +1 @@ +5491a82ed3ab1b3bc86a6da3b5417e0e45fb4eb0 SOURCES/microdnf-2.tar.gz diff --git a/SOURCES/0001-print-downloading-packages-only-once.patch b/SOURCES/0001-print-downloading-packages-only-once.patch new file mode 100644 index 0000000..2c0b16a --- /dev/null +++ b/SOURCES/0001-print-downloading-packages-only-once.patch @@ -0,0 +1,47 @@ +From 15837579fef30f1e8fe1aa3017eb5441caf3f09c Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 17 Feb 2017 21:46:28 +0100 +Subject: [PATCH 1/2] print downloading packages only once + +Signed-off-by: Igor Gnatenko +--- + dnf/dnf-main.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c +index 610ad74..6473bb3 100644 +--- a/dnf/dnf-main.c ++++ b/dnf/dnf-main.c +@@ -29,6 +29,7 @@ + static gboolean opt_yes = TRUE; + static gboolean opt_nodocs = FALSE; + static gboolean show_help = FALSE; ++static gboolean dl_pkgs_printed = FALSE; + + static gboolean + process_global_option (const gchar *option_name, +@@ -115,8 +116,11 @@ state_action_changed_cb (DnfState *state, + g_print("Downloading metadata...\n"); + break; + case DNF_STATE_ACTION_DOWNLOAD_PACKAGES: +- g_print("Downloading: %s (%u%%)\n", action_hint, +- dnf_state_get_percentage (state)); ++ if (!dl_pkgs_printed) ++ { ++ g_print("Downloading packages...\n"); ++ dl_pkgs_printed = TRUE; ++ } + break; + case DNF_STATE_ACTION_TEST_COMMIT: + g_print("Running transaction test...\n"); +@@ -141,6 +145,7 @@ state_action_changed_cb (DnfState *state, + break; + case DNF_STATE_ACTION_CLEANUP: + g_print("Cleanup: %s\n", action_hint); ++ break; + default: + break; + } +-- +2.12.1 + diff --git a/SOURCES/0002-do-not-fail-on-empty-transactions.patch b/SOURCES/0002-do-not-fail-on-empty-transactions.patch new file mode 100644 index 0000000..318a891 --- /dev/null +++ b/SOURCES/0002-do-not-fail-on-empty-transactions.patch @@ -0,0 +1,129 @@ +From 5b9caacf40e20e74298da29b0e5de525096c0e13 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sat, 4 Mar 2017 16:56:43 +0100 +Subject: [PATCH 2/2] do not fail on empty transactions + +Closes: https://github.com/rpm-software-management/microdnf/issues/3 +Signed-off-by: Igor Gnatenko +--- + dnf/dnf-utils.c | 16 +++++++++------- + dnf/dnf-utils.h | 4 ++-- + dnf/plugins/install/dnf-command-install.c | 5 +++-- + dnf/plugins/update/dnf-command-update.c | 5 +++-- + 4 files changed, 17 insertions(+), 13 deletions(-) + +diff --git a/dnf/dnf-utils.c b/dnf/dnf-utils.c +index 16f4d08..b3d087c 100644 +--- a/dnf/dnf-utils.c ++++ b/dnf/dnf-utils.c +@@ -2,7 +2,7 @@ + * + * Copyright © 2010-2015 Richard Hughes + * Copyright © 2016 Colin Walters +- * Copyright © 2016 Igor Gnatenko ++ * Copyright © 2016-2017 Igor Gnatenko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -20,7 +20,7 @@ + + #include "dnf-utils.h" + +-void ++gboolean + dnf_utils_print_transaction (DnfContext *ctx) + { + g_autoptr(GPtrArray) pkgs = dnf_goal_get_packages (dnf_context_get_goal (ctx), +@@ -30,16 +30,18 @@ dnf_utils_print_transaction (DnfContext *ctx) + DNF_PACKAGE_INFO_UPDATE, + DNF_PACKAGE_INFO_REMOVE, + -1); +- g_print ("Transaction: "); ++ + if (pkgs->len == 0) +- g_print ("(empty)"); +- else +- g_print ("%u packages", pkgs->len); +- g_print ("\n"); ++ { ++ g_print ("Nothing to do.\n"); ++ return FALSE; ++ } ++ g_print ("Transaction: %u packages\n", pkgs->len); + + for (guint i = 0; i < pkgs->len; i++) + { + DnfPackage *pkg = pkgs->pdata[i]; + g_print ("%s (%s)\n", dnf_package_get_nevra (pkg), dnf_package_get_reponame (pkg)); + } ++ return TRUE; + } +diff --git a/dnf/dnf-utils.h b/dnf/dnf-utils.h +index d649109..f894800 100644 +--- a/dnf/dnf-utils.h ++++ b/dnf/dnf-utils.h +@@ -1,7 +1,7 @@ + /* dnf-utils.h + * + * Copyright © 2016 Colin Walters +- * Copyright © 2016 Igor Gnatenko ++ * Copyright © 2016-2017 Igor Gnatenko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -24,6 +24,6 @@ + + G_BEGIN_DECLS + +-void dnf_utils_print_transaction (DnfContext *ctx); ++gboolean dnf_utils_print_transaction (DnfContext *ctx); + + G_END_DECLS +diff --git a/dnf/plugins/install/dnf-command-install.c b/dnf/plugins/install/dnf-command-install.c +index 6f27768..ea549da 100644 +--- a/dnf/plugins/install/dnf-command-install.c ++++ b/dnf/plugins/install/dnf-command-install.c +@@ -2,7 +2,7 @@ + * + * Copyright © 2010-2015 Richard Hughes + * Copyright © 2016 Colin Walters +- * Copyright © 2016 Igor Gnatenko ++ * Copyright © 2016-2017 Igor Gnatenko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -75,7 +75,8 @@ dnf_command_install_run (DnfCommand *cmd, + } + if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), DNF_INSTALL, error)) + return FALSE; +- dnf_utils_print_transaction (ctx); ++ if (!dnf_utils_print_transaction (ctx)) ++ return TRUE; + if (!dnf_context_run (ctx, NULL, error)) + return FALSE; + g_print ("Complete.\n"); +diff --git a/dnf/plugins/update/dnf-command-update.c b/dnf/plugins/update/dnf-command-update.c +index 33f7974..652d902 100644 +--- a/dnf/plugins/update/dnf-command-update.c ++++ b/dnf/plugins/update/dnf-command-update.c +@@ -1,6 +1,6 @@ + /* dnf-command-update.c + * +- * Copyright © 2016 Igor Gnatenko ++ * Copyright © 2016-2017 Igor Gnatenko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -73,7 +73,8 @@ dnf_command_update_run (DnfCommand *cmd, + + if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), 0, error)) + return FALSE; +- dnf_utils_print_transaction (ctx); ++ if (!dnf_utils_print_transaction (ctx)) ++ return TRUE; + if (!dnf_context_run (ctx, NULL, error)) + return FALSE; + g_print ("Complete.\n"); +-- +2.12.1 + diff --git a/SOURCES/35.patch b/SOURCES/35.patch new file mode 100644 index 0000000..eedd938 --- /dev/null +++ b/SOURCES/35.patch @@ -0,0 +1,23 @@ +From 71ef959bb3bb8340ef142e2a10552dd4f38862ae Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Tue, 12 Jun 2018 09:12:45 +0200 +Subject: [PATCH] Remove call of dnf_context_set_yumdb_enabled + +The function was removed from libdnf-0.14.0 without replacement. There is no +yumdb support anymore. Information is stored in sqlight database. +--- + dnf/dnf-main.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c +index 09454e0..ef5a04e 100644 +--- a/dnf/dnf-main.c ++++ b/dnf/dnf-main.c +@@ -100,7 +100,6 @@ context_new (void) + dnf_context_set_check_transaction (ctx, TRUE); + dnf_context_set_keep_cache (ctx, FALSE); + dnf_context_set_cache_age (ctx, 0); +- dnf_context_set_yumdb_enabled (ctx, FALSE); + + return ctx; + } diff --git a/SPECS/microdnf.spec b/SPECS/microdnf.spec new file mode 100644 index 0000000..d3cb5b8 --- /dev/null +++ b/SPECS/microdnf.spec @@ -0,0 +1,81 @@ +%if 0%{?rhel} && 0%{?rhel} <= 7 +%global buildsys cmake +%global buildsys_req cmake >= 2.8.5 +%else +%global buildsys meson +%global buildsys_req meson >= 0.36.0 +%endif + +Name: microdnf +Version: 2 +Release: 6%{?dist} +Summary: The microdnf package contains a limited functionality package manager written in C + +License: GPLv3+ +URL: https://github.com/rpm-software-management/microdnf +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +Patch0001: 0001-print-downloading-packages-only-once.patch +Patch0002: 0002-do-not-fail-on-empty-transactions.patch +Patch0003: 35.patch + +BuildRequires: gcc +BuildRequires: %{buildsys_req} +BuildRequires: pkgconfig(glib-2.0) >= 2.44.0 +BuildRequires: pkgconfig(gobject-2.0) >= 2.44.0 +BuildRequires: pkgconfig(libpeas-1.0) >= 1.20.0 +BuildRequires: pkgconfig(libdnf) >= 0.22.0 + +%description +%{summary}. Supports basic commands like install, update and remove. + +%prep +%autosetup -p1 + +%if %{buildsys} == "cmake" +%build +mkdir %{_target_platform} +pushd %{_target_platform} + %cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo +popd +%make_build -C %{_target_platform} + +%install +%make_install -C %{_target_platform} +%endif + +%if %{buildsys} == "meson" +%build +%meson +%meson_build + +%install +%meson_install +%endif + +%files +%license COPYING +%doc README.md +%{_bindir}/%{name} + +%changelog +* Thu Feb 28 2019 Daniel Mach - 2-6 +- Rebuild against libdnf >= 0.22.0 with bumped soname +- Stop calling dnf_context_set_yumdb_enabled() - it was dropped from libdnf + +* Fri May 18 2018 Daniel Mach - 2-5 +- Rebuild on additional architectures + +* Thu Mar 23 2017 Igor Gnatenko - 2-4 +- Unbundle libpeas + +* Mon Mar 6 2017 Jan Silhan - 2-3 +- do not fail on empty transactions + extended summary + +* Mon Feb 20 2017 Jan Silhan - 2-2 +- print downloading packages only once + +* Mon Dec 12 2016 Jan Silhan - 2-1 +- Update to 2 + +* Mon Dec 12 2016 Igor Gnatenko - 1-1 +- Initial package