diff --git a/SOURCES/0002-print-downloading-packages-only-once.patch b/SOURCES/0002-print-downloading-packages-only-once.patch index 7859e93..87bed96 100644 --- a/SOURCES/0002-print-downloading-packages-only-once.patch +++ b/SOURCES/0002-print-downloading-packages-only-once.patch @@ -1,7 +1,7 @@ From 15837579fef30f1e8fe1aa3017eb5441caf3f09c Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Fri, 17 Feb 2017 21:46:28 +0100 -Subject: [PATCH 2/2] print downloading packages only once +Subject: [PATCH 2/3] print downloading packages only once Signed-off-by: Igor Gnatenko --- diff --git a/SOURCES/0003-do-not-fail-on-empty-transactions.patch b/SOURCES/0003-do-not-fail-on-empty-transactions.patch new file mode 100644 index 0000000..63bdae3 --- /dev/null +++ b/SOURCES/0003-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 3/3] 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.7.4 + diff --git a/SPECS/microdnf.spec b/SPECS/microdnf.spec index 7937dd0..52950de 100644 --- a/SPECS/microdnf.spec +++ b/SPECS/microdnf.spec @@ -8,8 +8,8 @@ Name: microdnf Version: 2 -Release: 2%{?dist}.1.1 -Summary: Micro DNF +Release: 3%{?dist}.1.1 +Summary: The microdnf package contains a limited functionality package manager written in C License: GPLv3+ and LGPLv2+ URL: https://github.com/rpm-software-management/microdnf @@ -17,6 +17,7 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Source1: https://download.gnome.org/sources/libpeas/1.20/libpeas-1.20.0.tar.xz Patch0001: 0001-use-bundled-libpeas-in-case-proper-one-not-found.patch Patch0002: 0002-print-downloading-packages-only-once.patch +Patch0003: 0003-do-not-fail-on-empty-transactions.patch BuildRequires: gcc BuildRequires: %{buildsys_req} @@ -30,7 +31,7 @@ BuildRequires: intltool Provides: bundled(libpeas) = 1.20.0 %description -%{summary}. +%{summary}. Supports basic commands like install, update and remove. %prep %autosetup -p1 -a1 @@ -63,8 +64,11 @@ popd %{_bindir}/%{name} %changelog +* 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 +- print downloading packages only once * Mon Dec 12 2016 Jan Silhan - 2-1 - Update to 2