aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-03 17:14:36 +0200
committerPer Øyvind Karlsen <proyvind@moondrake.org>2016-06-03 17:14:36 +0200
commitaa0a44ce356b31a44c4b41866259bb7a01e7a478 (patch)
tree04aed0dd4eb13c6f8d8e42864fd8f4e403c9f849
parente304a2d8c4c38cf69a6a1ffc5662b4d9273225d8 (diff)
parent3dd3d1aeea69a7248880c546cf94851c7ebba53f (diff)
downloadmgarepo-aa0a44ce356b31a44c4b41866259bb7a01e7a478.tar
mgarepo-aa0a44ce356b31a44c4b41866259bb7a01e7a478.tar.gz
mgarepo-aa0a44ce356b31a44c4b41866259bb7a01e7a478.tar.bz2
mgarepo-aa0a44ce356b31a44c4b41866259bb7a01e7a478.tar.xz
mgarepo-aa0a44ce356b31a44c4b41866259bb7a01e7a478.zip
Merge branch 'git' of github.com:mdkcauldron/mgarepo into git
-rw-r--r--MgaRepo/commands/buildrpm.py2
-rw-r--r--MgaRepo/rpmutil.py17
2 files changed, 14 insertions, 5 deletions
diff --git a/MgaRepo/commands/buildrpm.py b/MgaRepo/commands/buildrpm.py
index 421ece0..79653e8 100644
--- a/MgaRepo/commands/buildrpm.py
+++ b/MgaRepo/commands/buildrpm.py
@@ -14,6 +14,7 @@ Options:
-I Don't automatically try install missing build dependencies
-l Disable rpmlint check of packages built
-P USER Define the RPM packager information to USER
+ -d Use DNF
-q Quiet build output
-s Jump to specific build stage (--short-circuit)
@@ -25,6 +26,7 @@ def parse_options():
parser.add_option("-I", dest="installdeps", action="store_false", default=True)
parser.add_option("-l", dest="rpmlint", action="store_false", default=True)
parser.add_option("-P", dest="packager", default="")
+ parser.add_option("-d", "--dnf", dest="use_dnf", action="store_true", default=False)
parser.add_option("-q", "--quiet", dest="verbose", action="store_false", default=True)
parser.add_option("-s", "--short-circuit", dest="short_circuit", action="store_true", default=False)
opts, args = parser.parse_args()
diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py
index 50313f2..3a10380 100644
--- a/MgaRepo/rpmutil.py
+++ b/MgaRepo/rpmutil.py
@@ -381,6 +381,7 @@ def build_rpm(build_cmd="b",
short_circuit=False,
packager = None,
installdeps = True,
+ use_dnf = False,
macros = []):
top = os.getcwd()
topdir = "_topdir %s" % top
@@ -428,17 +429,23 @@ def build_rpm(build_cmd="b",
else:
if verbose:
print("Installing missing build dependencies")
+ if use_dnf:
+ pkg_mgr_base = ["dnf"]
+ pkg_mgr_builddep = pkg_mgr_base + ["--assume-yes", "--setopt=install_weak_deps=False", "builddep"]
+ else:
+ pkg_mgr_base = ["urpmi"]
+ pkg_mgr_builddep = pkg_mgr_base + ["--auto", "--buildrequires", "--no-recommends"]
if os.getuid() != 0:
- print("Trying to obtain privileges for urpmi:")
- sudocheck = ["sudo", "-l", "urpmi"]
+ print("Trying to obtain privileges for installing build dependencies:")
+ sudocheck = ["sudo", "-l"] + pkg_mgr_base
status, output = execcmd(*sudocheck, collecter=True, noerror=True)
if status:
raise Error("%s\nFailed! Cannot proceed without, aborting..."
% output.splitlines()[-1])
- urpmi = ["sudo", "urpmi"]
+ cmd_base = ["sudo"] + pkg_mgr_builddep
else:
- urpmi = ["urpmi"]
- cmd = urpmi + ["--auto", "--buildrequires", "--no-recommends", spec]
+ cmd_base = pkg_mgr_builddep
+ cmd = cmd_base + [spec]
status, output = execcmd(*cmd, show=verbose, collecter=True, noerror=True)
status, output = execcmd(*args + ["-b"+build_cmd], show=verbose)