+ ########## one individual package
+ def handle_package(self, package):
+ if not self.is_packaged_installed(package):
+ return self.do_package(package, "install")
+ else:
+ return self.do_package(package, "update")
+
+ def is_packaged_installed(self, package):
+ cmd = "rpm -q {} > /dev/null".format(package)
+ return os.system(cmd) == 0
+
+ def do_package(self, package, subcommand):
+ cmd = \
+ "{} {} -y {} {}".format(self.command, self.options,
+ subcommand, package)
+ Message("Invoking {}".format(cmd))
+ return os.system(cmd) == 0
+
+ ########## update one group
+ def update_group(self, group):
+ # it is important to invoke dnf group *upgrade* and not *update*
+ # because the semantics of groups has changed within dnf
+ if HAS_DNF:
+ cmd = \
+ "{} {} -y group upgrade {}".format(self.command, self.options, group)
+ else:
+ cmd = \
+ "{} {} -y groupinstall {}".format(self.command, self.options, group)
+ Message("Invoking {}".format(cmd))
+ return os.system(cmd) == 0
+
+ ########## update the whole system
+ def update_system(self):
+ cmd = "{} {} -y update".format(self.command, self.options)
+ Message("Invoking {}".format(cmd))
+ return os.system(cmd) == 0
+
+ def clean_all(self):
+ cmd = "{} clean all".format(self.command)
+ Message("Invoking {}".format(cmd))
+ return os.system(cmd) == 0