Browse code

Merge "Allow use of dnf instead of yum on Fedora"

Jenkins authored on 2014/12/11 23:26:10
Showing 2 changed files
... ...
@@ -1162,7 +1162,7 @@ function uninstall_package {
1162 1162
     if is_ubuntu; then
1163 1163
         apt_get purge "$@"
1164 1164
     elif is_fedora; then
1165
-        sudo yum remove -y "$@"
1165
+        sudo $YUM remove -y "$@" ||:
1166 1166
     elif is_suse; then
1167 1167
         sudo zypper rm "$@"
1168 1168
     else
... ...
@@ -1171,7 +1171,7 @@ function uninstall_package {
1171 1171
 }
1172 1172
 
1173 1173
 # Wrapper for ``yum`` to set proxy environment variables
1174
-# Uses globals ``OFFLINE``, ``*_proxy``
1174
+# Uses globals ``OFFLINE``, ``*_proxy``, ``YUM``
1175 1175
 # yum_install package [package ...]
1176 1176
 function yum_install {
1177 1177
     [[ "$OFFLINE" = "True" ]] && return
... ...
@@ -1183,7 +1183,7 @@ function yum_install {
1183 1183
     # https://bugzilla.redhat.com/show_bug.cgi?id=965567
1184 1184
     $sudo http_proxy=$http_proxy https_proxy=$https_proxy \
1185 1185
         no_proxy=$no_proxy \
1186
-        yum install -y "$@" 2>&1 | \
1186
+        $YUM install -y "$@" 2>&1 | \
1187 1187
         awk '
1188 1188
             BEGIN { fail=0 }
1189 1189
             /No package/ { fail=1 }
... ...
@@ -1193,7 +1193,7 @@ function yum_install {
1193 1193
 
1194 1194
     # also ensure we catch a yum failure
1195 1195
     if [[ ${PIPESTATUS[0]} != 0 ]]; then
1196
-        die $LINENO "Yum install failure"
1196
+        die $LINENO "$YUM install failure"
1197 1197
     fi
1198 1198
 }
1199 1199
 
... ...
@@ -639,6 +639,12 @@ API_WORKERS=${API_WORKERS:=$(( ($(nproc)/2)<2 ? 2 : ($(nproc)/2) ))}
639 639
 # Service startup timeout
640 640
 SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
641 641
 
642
+# Support alternative yum -- in future Fedora 'dnf' will become the
643
+# only supported installer, but for now 'yum' and 'dnf' are both
644
+# available in parallel with compatible CLIs.  Allow manual switching
645
+# till we get to the point we need to handle this automatically
646
+YUM=${YUM:-yum}
647
+
642 648
 # Following entries need to be last items in file
643 649
 
644 650
 # Local variables: