[cloud-init/f22: 9/9] Switch to dnf instead of yum when available

gholms gholms at fedoraproject.org
Fri Feb 20 02:22:23 UTC 2015


commit 37c3202f9915493994e36ba313e32354d0f8b377
Author: Garrett Holmstrom <gholms at devzero.com>
Date:   Thu Feb 19 18:14:45 2015 -0800

    Switch to dnf instead of yum when available
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1194451

 cloud-init-0.7.6-dnf.patch | 33 +++++++++++++++++++++++++++++++++
 cloud-init.spec            |  5 +++++
 2 files changed, 38 insertions(+)
---
diff --git a/cloud-init-0.7.6-dnf.patch b/cloud-init-0.7.6-dnf.patch
new file mode 100644
index 0000000..380661c
--- /dev/null
+++ b/cloud-init-0.7.6-dnf.patch
@@ -0,0 +1,33 @@
+Index: cloud-init-0.7.6/cloudinit/distros/rhel.py
+===================================================================
+--- cloud-init-0.7.6.orig/cloudinit/distros/rhel.py
++++ cloud-init-0.7.6/cloudinit/distros/rhel.py
+@@ -20,6 +20,8 @@
+ #    You should have received a copy of the GNU General Public License
+ #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ 
++import os.path
++
+ from cloudinit import distros
+ from cloudinit import helpers
+ from cloudinit import log as logging
+@@ -181,13 +183,12 @@ class Distro(distros.Distro):
+         if pkgs is None:
+             pkgs = []
+ 
+-        cmd = ['yum']
+-        # If enabled, then yum will be tolerant of errors on the command line
+-        # with regard to packages.
+-        # For example: if you request to install foo, bar and baz and baz is
+-        # installed; yum won't error out complaining that baz is already
+-        # installed.
+-        cmd.append("-t")
++        if os.path.isfile('/usr/bin/dnf'):
++            LOG.debug('Using DNF for package management')
++            cmd = ['dnf']
++        else:
++            LOG.debug('Using DNF for package management')
++            cmd = ['yum', '-t']
+         # Determines whether or not yum prompts for confirmation
+         # of critical actions. We don't want to prompt...
+         cmd.append("-y")
diff --git a/cloud-init.spec b/cloud-init.spec
index 781e283..3c6c041 100644
--- a/cloud-init.spec
+++ b/cloud-init.spec
@@ -47,6 +47,10 @@ Patch5:         cloud-init-0.7.6-network-online.patch
 # http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/revision/1050
 Patch6:         cloud-init-0.7.6-user-session.patch
 
+# Use dnf instead of yum when available
+# https://bugzilla.redhat.com/show_bug.cgi?id=1194451
+Patch7:         cloud-init-0.7.6-dnf.patch
+
 # Deal with noarch -> arch
 # https://bugzilla.redhat.com/show_bug.cgi?id=1067089
 Obsoletes:      cloud-init < 0.7.5-3
@@ -168,6 +172,7 @@ rm -rf $RPM_BUILD_ROOT
 - Changed network.target systemd deps to network-online.target [RH:1110731 RH:1112817 RH:1147613]
 - Fixed race condition between cloud-init.service and the login prompt
 - Stopped enabling services in %%post (now done by kickstart) [RH:850058]
+- Switched to dnf instead of yum when available [RH:1194451]
 
 * Fri Nov 14 2014 Colin Walters <walters at redhat.com> - 0.7.6-2
 - New upstream version [RH:974327]


More information about the scm-commits mailing list