return pakfire.remove(what)
-def update(pkgs, **pakfire_args):
+def update(pkgs, check=False, **pakfire_args):
pakfire = Pakfire(**pakfire_args)
- return pakfire.update(pkgs)
+ return pakfire.update(pkgs, check=check)
def info(patterns, **pakfire_args):
# Create pakfire instance.
# Remove the temporary copy of the repository we have created earlier.
repo.remove()
- def update(self, pkgs):
+ def update(self, pkgs, check=False):
+ """
+ check indicates, if the method should return after calculation
+ of the transaction.
+ """
request = self.create_request()
# If there are given any packets on the command line, we will
if not t:
logging.info(_("Nothing to do"))
+
+ # If we are running in check mode, we return a non-zero value to
+ # indicate, that there are no updates.
+ if check:
+ return 1
+ else:
+ return
+
+ # Just exit here, because we won't do the transaction in this mode.
+ if check:
+ t.dump()
return
# Ask the user if the transaction is okay.
self.parse_command_remove()
self.parse_command_info()
self.parse_command_search()
+ self.parse_command_check_update()
self.parse_command_update()
self.parse_command_provides()
self.parse_command_grouplist()
"install" : self.handle_install,
"localinstall" : self.handle_localinstall,
"remove" : self.handle_remove,
+ "check_update" : self.handle_check_update,
"update" : self.handle_update,
"info" : self.handle_info,
"search" : self.handle_search,
help=_("Give a name of a package to update or leave emtpy for all."))
sub_update.add_argument("action", action="store_const", const="update")
+ def parse_command_check_update(self):
+ # Implement the "check-update" command.
+ sub_check_update = self.sub_commands.add_parser("check-update",
+ help=_("Check, if there are any updates available."))
+ sub_check_update.add_argument("package", nargs="*",
+ help=_("Give a name of a package to update or leave emtpy for all."))
+ sub_check_update.add_argument("action", action="store_const", const="check_update")
+
def parse_command_info(self):
# Implement the "info" command.
sub_info = self.sub_commands.add_parser("info",
def handle_update(self):
pakfire.update(self.args.package, **self.pakfire_args)
+ def handle_check_update(self):
+ pakfire.update(self.args.package, check=True, **self.pakfire_args)
+
def handle_install(self):
pakfire.install(self.args.package, **self.pakfire_args)